This script coordinates several tools to process recorded TV and save the files without commercials in a Plex compatible file structure.
The basic steps:
- For each video file matching the pattern:
- Find or create commercial file (using Comskip)
- Find or create the subtitle file (using ccextractor)
- Determine Series, Season, & Episode Number
- Cut commercials out of video file & convert to h.264 w/ AAC audio
- Cut commercials out of subtitles file
- Save new video and new subtitles file to
[Series]/Season #/[Series] - s##e## - [Episode].[ext]
Use your favorite package manager (or download & compile):
- ffmpeg
- python3
Example:
brew install ffmpeg python3
pip3 install -r requirements.txt
Feel free to use a virtualenv
python3 processing.py
Optionally pass the path to the config.ini
: python3 processing.py path/to/config.ini
See sample_config.ini
for examples
Obtain a TVDB API account here: http://thetvdb.com/?tab=apiregister
- ${orig_basename} - The original basename of the file (eg
path/to/video.wtv
=>video
) - ${ext} - The appropiate file extension
- ${season} - The season number (
1
or10
) - ${season_padded} - The season number padded to two digits (
01
or10
) - ${episode} - The episode number (
1
or10
) - ${episode_padded} - The episode number padded to two digits (
01
or10
) - ${episode_name} - The episode name
- ${series} - The series name
- $$ - The character
$
Default is ${series}/Season ${season}/${series} - s${season_padded}e${episode_padded} - ${episode_name}.${ext}
which results in something like: The Closer/Season 1/The Closer - s01e02 - About Face.mp4