Skip to main content

Remove advertisements from subtitle files

Project description

Subscleaner

subscleaner

PyPI version codecov docker

Subscleaner is a Python script that removes advertisements from subtitle files. It's designed to help you enjoy your favorite shows and movies without the distraction of unwanted ads in the subtitles.

Features

  • Removes a predefined list of advertisement patterns from subtitle files.
  • Supports various subtitle formats through the pysrt library.
  • Automatically detects the encoding of subtitle files using chardet.
  • Available as a Docker image for easy deployment and usage.

Installation

Automatic installation

To install with pip:

sudo pip install subscleaner

Manual installation

To install Subscleaner, you'll need Python 3.9 or higher. It's recommended to use Poetry for managing the project dependencies.

  1. Clone the repository:
git clone https://gitlab.com/rogs/subscleaner.git
  1. Navigate to the project directory:
cd subscleaner
  1. Install the dependencies with Poetry:
poetry install

Docker

Subscleaner is also available as a Docker image. You can pull the image from Docker Hub:

docker pull rogsme/subscleaner

Usage

If you installed the package automatically, you can pipe a list of subtitle filenames into the script:

find /your/media/location -name "*.srt" | subscleaner

If you installed the package manually:

find /your/media/location -name "*.srt" | poetry run subscleaner

Alternatively, you can use the script directly if you've installed the dependencies globally:

find /your/media/location -name "*.srt" | python3 subscleaner.py

Docker

To use the Docker image, you can run the container with the following command:

docker run -e CRON="0 0 * * *" -v /your/media/location:/files rogsme/subscleaner
  • Replace 0 0 * * * with your desired cron schedule for running the script.
  • Replace /your/media/location with the path to your media directory containing the subtitle files.

The Docker container will run the Subscleaner script according to the specified cron schedule and process the subtitle files in the mounted media directory.

If you are using YAMS

YAMS is a highly opinionated media server. You can know more about it here: https://yams.media/

Add this container to your docker-compose.custom.yaml:

  subscleaner:
    image: rogsme/subscleaner
    environment:
      - CRON=0 0 * * *
    volumes:
      - ${MEDIA_DIRECTORY}:/files

To get more information on how to add your own containers in YAMS: https://yams.media/advanced/add-your-own-containers/

Contributing

Contributions are welcome! If you have any suggestions or improvements, feel free to fork the repository and submit a pull request.

License

Subscleaner is licensed under the GNU General Public License v3.0 or later. See the LICENSE file for more details.

Acknowledgments

This repository is a rewrite of this Github repository: https://github.com/FraMecca/subscleaner.

Thanks to FraMecca in Github!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

subscleaner-1.1.4.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

subscleaner-1.1.4-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file subscleaner-1.1.4.tar.gz.

File metadata

  • Download URL: subscleaner-1.1.4.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/5.15.154+

File hashes

Hashes for subscleaner-1.1.4.tar.gz
Algorithm Hash digest
SHA256 c18a632ef3f6da0e0466cdc6b31d41a2b7289d7ce71058a6aea5732ea271a8cb
MD5 8d154879fd1c9ad4dd37081f73f6ba6c
BLAKE2b-256 bc953ca57a921d009b739a3a9dc439f32420169d31b69c1e95ec5a5375d085d0

See more details on using hashes here.

File details

Details for the file subscleaner-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: subscleaner-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/5.15.154+

File hashes

Hashes for subscleaner-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 376b0f2813b208b6e0400bdacce1be8563d56bbdee1d7ae4e9fcd1f55f0291b2
MD5 81328a34194f568327abe2947473d44e
BLAKE2b-256 3879671d12663817826e83a44f7ea74f89953d47661c9286e525b7c218212920

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page