Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Uses the metadata held in the PlexMediaServer to tag media files

branch: master

update readme

latest commit 2adc9a2821
Christopher Campbell Jensen authored
Octocat-spinner-32 Items make sure iTunes path and plex path are normalized to make comparisso… May 31, 2012
Octocat-spinner-32 extra fixed bug in itunes recover tag script where it would only update the… January 05, 2012
Octocat-spinner-32 .gitignore split pms communication into separate class. added gitignore file June 28, 2011
Octocat-spinner-32 AtomicParsley32 updated batch mode, implemented optimize and forcetagging, improved c… July 08, 2011
Octocat-spinner-32 ColorizingStreamHandler.py Added console class to handle formatting of messages in console. Some… April 06, 2012
Octocat-spinner-32 Console.py Added console class to handle formatting of messages in console. Some… April 06, 2012
Octocat-spinner-32 DataTokens.py updated reading of tag data. Now keeps embedded playcount if higher t… March 23, 2012
Octocat-spinner-32 LibraryStatistics.py Added console class to handle formatting of messages in console. Some… April 06, 2012
Octocat-spinner-32 PmsRequestHandler.py handle case when thumb attribute is missing March 08, 2012
Octocat-spinner-32 README.md update readme November 05, 2012
Octocat-spinner-32 SectionProcessor.py fix breadcrumb casing issues October 23, 2012
Octocat-spinner-32 SublerCLI-v010 work continues June 30, 2011
Octocat-spinner-32 Summary.py added 'add to itunes' function that will add a media item to your itu… May 29, 2012
Octocat-spinner-32 VideoItemProcessor.py add support for embedding any srt sidecar subs, and generating chapte… November 05, 2012
Octocat-spinner-32 plexmediatagger.py add support for embedding any srt sidecar subs, and generating chapte… November 05, 2012
Octocat-spinner-32 subler_tags.txt refactored code, renamed variables to match style guide, artwork down… July 05, 2011
README.md

Plex Media Tagger

Tested on Mac OS X 10.7 (Lion)

thanks goes to:
the Plex team, their PMS takes care of all the hard work of gathering the metadata and providing an intuitive web API to browse the local library.
the Subler team, their CLI tool takes care of the actual embedding of the information.
the AtomicParsley team, their CLI tool helps with the detection of previously tagged files.

Installation:

Either:

  • Download the project: Zip of project
  • or, if you think you might want to tweak the code, clone the repository::

        git clone git://github.com/ccjensen/PlexMediaTagger.git
    

The tool requires python (pre-installed on most versions of Mac OS X and linux). I have tested it with Python v2.7.2 for windows. If you want pretty colors for the output, you might also have to download and install the ctypes module for python (it says it's included, but didn't seem to be with v2.7.2).

Note: Embedding metadata in files only works on OS X, as it uses a tool that unfortunately only is available for that system. Exporting of resources (subtitles, artwork, etc) and statistics gathering should work fine on both unix, linux and windows.

Usage:

    Usage: plexmediatagger.py [options]
    Example 1: plexmediatagger.py --tag
    Example 2: plexmediatagger.py -bq --tag --remove-all-tags --optimize --export-subtitles --embed-subtitles -ip 192.168.0.2 --port 55400
    Example 3: plexmediatagger.py --subtitles -m 'D:\Movies' '/Volumes/Media/Movies' -m '\' '/'
    Example 4: plexmediatagger.py -tb --batch-mediatype=movie --batch-breadcrumb='kids>cars'
        only tag movies who are in a section containing the word 'kids' and movies who's name contains 'cars'
    Example 5: plexmediatagger.py -tb --batch-mediatype=show --batch-breadcrumb='>lost>season 1>pilot'
        only tag tv episodes, matches all sections, show name contains lost, season 1, episode title contains 'pilot'
    Example 6: plexmediatagger.py -tb --batch-breadcrumb='tv>weeds>>goat'
        only tag items who are in a section who's title contains 'tv', where the movie or show name contains 'weeds', any season and episode title contains 'goat'

The tool uses the comment metadata field to store metadata that does not have its own tag, but is a value that iTunes stores in its internal database (such as rating and playcount). There is an iTunes script in the extra's folder that can load this information into iTunes, or you can try using the --add-to-itunes flag that will make sure the item being processed isn't already present in iTunes and it will add in the extra metadata for you. If you do want to do this step manually, add the newly tagged file to iTunes and select the corresponding entry in iTunes and run the script. This will load in that extra information that cannot be embedded directly.

Note: Filepaths to media items in PMS need to be the same as on machine that is running this script (can be worked around by using the -m option to modify the file path).

Options:

Options:
-h, --help show this help message and exit
-t, --tag tag all compatible file types, and update any
previously tagged files (if metadata in plex has
changed)
--tag-update update previously tagged files if the PMS entry has
changed since last time (modification time)
--tag-tv-prefer-season-artwork when tagging tv show episodes, the season artwork will
be used instead of the episode thumbnail
-r, --remove-tags remove all compatible tags from the files
-f, --force ignore previous work and steam ahead with task (will re-tag previously tagged files, re-enters data into iTunes, etc.)
-o, --optimize interleave the audio and video samples, and put the
"MooV" atom at the beginning of the file
--chapter-previews generate preview images for any chapter markers
--export-subtitles export any subtitles to the same path as the video
file
--embed-subtitles embed compatible files with a compatible "sidecar"
subtitle file if present
--export-artwork export the artwork to the same path as the video file
--stats gather "interesting" statistics about the items being
processed
-m <find> <replace> perform a find & replace operation on the pms' media
file paths (useful if you are running the script on a
different machine than the one who is hosting the pms,
i.e. the mount paths are different). Supply multiple
times to perform several different replacements
(operations are performed in order supplied).
--open open a Finder window at the containing folder of the
file just processed (Mac OS X only)
--add-to-itunes adds the item to iTunes if not already present
-i IP, --ip=IP specify an alternate IP address that hosts a PMS to
connect to (default is localhost)
-p PORT, --port=PORTspecify an alternate port number to use when
connecting to the PMS (default is 32400)
--interactive interactivly select files to operate on [default]
-b, --batch disable interactive mode. Requires no human
intervention once launched, and will perform
operations on all valid files
--batch-mediatype=[movie/show]
only specified media type will be processed
--batch-breadcrumb=breadcrumb
only items matching the breadcrumb trail will be
processed. Components seperated by '>' (case
insensitive)
-v, --verbose increase verbosity (can be supplied 0-2 times)
-q, --quiet ninja-like processing (can only be used when in batch
mode)
-d, --dry-run pretend to do the job, but never actually change or
export anything. Pretends that all tasks succeed.
Useful for testing purposes

Something went wrong with that request. Please try again.