Skip to main content

A tool for validating and cleaning M3U playlists

Project description

m3uclean

Star on GitHub Fork on GitHub Watch on GitHub

Version 1.0.0 License: MIT Built with Python

A robust tool designed to validate and clean M3U playlists by verifying each channel's stream availability and removing any entries with invalid streams.

Features

  • Stream Validation: Automatically checks each channel's stream availability
    • Rate Limiting Protection: Smart handling of rate limits with automatic backoff
    • Slow Mode: Conservative request rates for more reliable validation
  • Cleaning: Cleans and corrects malformed entries
    • Aggressive Cleaning: Removes potentially dangerous characters completely
  • Duplicate Removal: Identifies and removes duplicate channel entries
  • Logging: Detailed logs of actions performed on the playlists
  • Docker Integration: Packaged into a Docker container for easy deployment

Installation

Using pip

pip install m3uclean

From source

git clone https://github.com/samestrin/m3uclean.git
cd m3uclean
pip install -e .

Using Docker

docker pull samestrin/m3uclean

Or build the Docker image yourself:

git clone https://github.com/samestrin/m3uclean.git
cd m3uclean
docker build -t m3uclean .

Usage

Command Line

# Basic usage
m3uclean input.m3u -o output.m3u

# With stream validation
m3uclean input.m3u -o output.m3u -v

# With stream validation in slow mode (recommended for large playlists)
m3uclean input.m3u -o output.m3u -v --slow

# With aggressive cleaning
m3uclean input.m3u -o output.m3u -a

# With custom log file
m3uclean input.m3u -o output.m3u -l logfile.log

# Full options
m3uclean input.m3u -o output.m3u -l logfile.log -v -a --slow

Using Docker

docker run -it --rm \
  -e INPUT_FILE="/var/tmp/m3u/playlist.m3u" \
  -e OUTPUT_FILE="/var/tmp/m3u/playlist_clean.m3u" \
  -e LOG_FILE="/var/tmp/m3u/m3uclean.log" \
  -e STREAM_VALIDATE="true" \
  -e AGGRESSIVE_CLEAN="true" \
  -v "/path/to/your/local/m3ufiles:/var/tmp/m3u" \
  m3uclean

Environment Variables

When using Docker, you can configure the application using the following environment variables:

  • INPUT_FILE: Path to the input M3U playlist file
  • OUTPUT_FILE: Path to the output M3U playlist file
  • LOG_FILE: Path to the log file
  • STREAM_VALIDATE: Set to "true" to enable stream validation
  • AGGRESSIVE_CLEAN: Set to "true" to enable aggressive cleaning

Contribute

Contributions to this project are welcome. Please fork the repository and submit a pull request with your changes or improvements.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Share

Twitter Facebook LinkedIn

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

m3uclean-1.0.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

m3uclean-1.0.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file m3uclean-1.0.0.tar.gz.

File metadata

  • Download URL: m3uclean-1.0.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for m3uclean-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2bae21ae433e1857fd2802a3a85a1db006eb176ee5d51678df1fcb4fe46c3c6c
MD5 8633a3d5151bee9ed19f3faf2a0c3cc6
BLAKE2b-256 1e44faf412caa7a09760642961b77ed1e0681d5a85935e9e7d45b82db7833021

See more details on using hashes here.

File details

Details for the file m3uclean-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: m3uclean-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for m3uclean-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a5b2918418e0a3e97450261178554ca4efd98ea21f50059a0ce843de5129f2e
MD5 d51d4083a2b66fd8329f51adf5733b49
BLAKE2b-256 d378862b8fff8708591476c1528179104575bda323380448d3a004fde80c5d19

See more details on using hashes here.

Supported by

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