all repos — auto-movie-tagger @ 24cdc4fa114ac07b411c74d5842e75dc18f60831

A Python script that auto tags and adds poster to mkv or mp4 movie files.

Corrections in comments and readme
Prithu Goswami prithugoswami524@gmail.com
Tue, 09 May 2017 19:50:26 +0530
commit

24cdc4fa114ac07b411c74d5842e75dc18f60831

parent

9901b5c5bd9fbbb7dc4b3d51c734ab6f5450159a

2 files changed, 10 insertions(+), 7 deletions(-)

jump to
M README.mdREADME.md

@@ -1,5 +1,6 @@

# Auto Movie Tagger -A Python script that auto tags and adds poster to mkv or mp4 movie files. +A Python script that auto tags and adds poster to MKV or MP4 movie files. +Also adds subtitles if provided. The metadata it adds: + Genre - Movie's genres

@@ -19,7 +20,7 @@ <li><a href="https://pypi.python.org/pypi/mutagen">mutagen</a> - Python module to handle media files' metadata</li>

</ul> ## Installing ffmpeg -You need to first download ffmpeg <a href="https://ffmpeg.org/download.html">(from here)</a> and add it to your PATH variable. +You need to first download ffmpeg (<a href="https://ffmpeg.org/download.html">from here</a>) and add it to your PATH variable. Here's a <a href="http://www.wikihow.com/Install-FFmpeg-on-Windows">wikiHow article on how to install ffmpeg on Windows</a> ## Installing Python module dependencies

@@ -31,16 +32,16 @@ </ul>

## How to use <ol> - <li>Move all the movie files you want to be tagged into one folder. Make sure that the filename is <strong>only</strong> the title of the movie</li> + <li>Move all the movie files you want to be tagged into one folder. Make sure that the filename is <strong>only</strong> the title of the movie.</li> <li>If you want subtitles to be embedded into the movie file(s) then add a subtitle file (.srt only) in the same folder named exactly the same as the movie file(s).</li> <li>Download the script (<a href="amt.py">amt.py</a>) and run it in that directory and sit back and relax till it ends executing. </li> </ol> ## Notes <ul> - <li>This script only works for mp4 and mkv file types as they are the mmost common file types for HD Movie files.</li> + <li>This script only works for mp4 and mkv file types.</li> <li>The final file is always a MP4 file.</li> - <li>Make sure if you are having a MKV file, it should not contain picture based subtitles (hdmv-pgs/vobsub,etc). You can use <a href="https://mkvtoolnix.download/">MKVToolNix</a> or any other similar GUI utility to quickly remove the picture based subtitles or you can use ffmpeg to this as well. If the file already has an SRT subtitle then the script will just copy it.</li> + <li>Make sure if you are having a MKV file, it should not contain picture based subtitles (hdmv-pgs/vobsub,etc) as MP4 files do not support picture based subtitles. You can use <a href="https://mkvtoolnix.download/">MKVToolNix</a> or any other similar GUI utility to quickly remove the picture based subtitles or you can use ffmpeg to this as well. If the file already has an SRT subtitle then the script will just copy it.</li> <li>If you would like to use your own poster image then add an image file (jpg only) in the same folder and rename it to the same name as the movie file.</li> <li>Although I have provided my own TMDb API key in the source, I would recommend you get you own from <a href="https://www.themoviedb.org/documentation/api">here</a></li> <li> Tip - When you sort your tagged movies according to the comment they get sorted by ascending/descending order of their IMDb rating.</li>
M amt.pyamt.py

@@ -1,9 +1,11 @@

"""A Script that tags you movie files. + This script might seem a little messy and ugly and I know maybe there is better and effecient way to do some of the tasks. but I am unaware of them at the moment and am a begginer in Python and this is my first, or maybe second python script. + TO-DO 1. Add a way to notify when the script is done running 2. Seems a little too much for now but I could change/add stream specific

@@ -78,7 +80,7 @@

def start_process(filenames, mode): """ This is the main funtion of the script - where it does its main processing\n + where it does its main processing.\n filenames is the list of files to be processed\n mode = 1,2,3 or 4\n 1 means mp4 to tagged mp4\n

@@ -179,7 +181,7 @@ + imdb_movie.plot_outline)

# setting the genres of the movie. I use ';' as a delimeter # to searate the multiple genre values genre = ';'.join(imdb_movie.genres) - # Going overboard and adding directors name to artist taf of + # Going overboard and adding directors name to artist tag of # the mp4 file directors = imdb_movie.directors_summary director = directors[0].name