Skip to content

Docker Mod to strip unwanted tracks from media files upon import to Radarr or Sonarr (compatible with linuxserver/radarr and linuxserver/sonarr) ✂️

License

Notifications You must be signed in to change notification settings

TheCatLady/dockermod-strip-tracks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dockermod-strip-tracks ✂️

Image Size Last Commit Build Status
Python Code Quality Become a GitHub Sponsor

Docker Mod to strip unwanted tracks from media files upon import to Radarr or Sonarr (compatible with linuxserver/radarr and linuxserver/sonarr)

Also fetches hotio's awesome Arr Discord Notifier script for pretty Discord notifications! ✨

Behavior

This Docker Mod was created for my own personal use, but it is still somewhat configurable to suit your own personal preferences. 🐱

Initialization

On each container start, the strip-tracks-init.sh script will:

  1. Fetch, chmod, and chown hotio's Arr Discord Notifier script (have I mentioned yet that it is awesome?)

  2. Install MKVToolNix

  3. Install required Python dependencies for, chmod, and chown the strip-tracks.py script

Media Processing

When added for the On Import and/or On Upgrade triggers in Radarr and/or Sonarr, the strip-tracks.py script will:

  1. Query The Movie Database (TMDb) to determine the original language of the movie or TV show

  2. Use mkvmerge to remove unwanted tracks from the video file, keeping only:

    • the first video track
    • the first audio track matching the original language which does not contain any excluded keywords
    • any subtitle tracks matching a provided ISO 639-2 language code which do not contain any excluded keywords

    (If there is not at least one video track and one audio track based on this logic, the file will not be modified.)

  3. Call the Radarr/Sonarr command API endpoint to refresh the movie or TV show

  4. Run hotio's super awesome Arr Discord Notifier script if the DISCORD_WEBHOOK environment variable was configured

Usage

This Docker Mod is configured by defining the following environment variables for your linuxserver/radarr and/or linuxserver/sonarr containers:

Parameter Function Required?
DOCKER_MODS thecatlady/dockermod-strip-tracks (or ghcr.io/thecatlady/dockermod-strip-tracks) yes
TMDB_API_KEY Your TMDb API key yes
SUBTITLE_LANGUAGES Comma-delimited list of ISO 639-2 language codes for which subtitle tracks should be kept (if not specified, no subtitles will be kept) no
EXCLUDED_KEYWORDS Comma-delimited list of keywords for which subtitle tracks should be excluded no

Please refer to hotio's Arr Discord Notifier documentation for details on how to configure and customize the pretty Discord notifications.

Then, simply add a Custom Script connection in Radarr and/or Sonarr in Settings → Connect. Enter /usr/local/bin/strip-tracks.py for the path, select the On Import and/or On Upgrade triggers, and you're all set!

Note that you should not add hotio's Arr Discord Notifier script as a separate connection, since strip-tracks.py will execute it for you after it has finished processing the media file.

How to Contribute

Show your support by starring this project! 🌟 Pull requests, bug reports, and feature requests are also welcome!

You can also support me by becoming a GitHub sponsor or making a one-time donation 💖

Additionally, don't forget to show your support for both hotio and the wonderful folks over at LinuxServer.io!

About

Docker Mod to strip unwanted tracks from media files upon import to Radarr or Sonarr (compatible with linuxserver/radarr and linuxserver/sonarr) ✂️

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages