So I am currently working on a tool that will take the metadata that the pms has downloaded and embed that within mp4/m4v files. This way, those files will look all nice when loaded into iTunes, etc. I used to have scripts that would use themoviedb and thetvdb as the datasource, so this isn’t that much different. Biggest difference will be that my scripts had to parse the media items filename’s, while this tool can query the pms for all the information.
Now, my natural inclination is to make this be a command line script as it doesn’t really need much of a UI. Now, I understand that some people just prefer tools to be GUI ones, but I wanted to get a sense for how vital it is. Even if the vote goes one way or the other, doesn’t mean that I will change my current approach. Just wanted to put out some feelers to get a general idea.
It’s still a work in progress, but here is a link to the current source:
https://github.com/ccjensen/PlexMediaTagger
disclaimer Although I try and test my code, nothing is fool proof. I take NO responsibility if the script does something damaging to your files. It is using SublerCLI for the actual embedding of the tags, and this is a tool written by one of the amazing handbrake devs. These guys are always really good about their apps, but even they can make mistakes, so no guarantees.
Please throw in any feature requests, should there be any.
Just wanted to add that another advantage of it being a commandline tool is that it will be much more cross platform friendly. Quite likely just the tagging script/tool will have to be changed. Just saying
I'm for any tool that will bring Plex content into iTunes automatically, so command line or AppleScript preffered ( or if GUI will include a way to schedule scans ). Files AND Metadata.
How are you bringing your PLex content into iTunes? Manually or automatically converting to iTunes friendly file format?
the tool will only tag the files (if they support tags. mp4/m4v's do so), not transcode/convert them. Imagine a library full of mp3's (which support id3 tags) loaded into plex and plex downloaded a ton of metadata, then a tool came along that could write that metadata into the mp3 files so that when those files are loaded into something like iTunes, the metadata is present. My tool will do the same, but for video's of type mp4/m4v.
I manually convert my content using handbrake.
Hmmm… setting MKV metadata would be nice too for an even cooler CLI application … mkvmerge (part of MKVToolnix) can be utilized for that.
I realize that would not be of help with iTunes and thus is out of scope here, but it would make for more well rounded application… just saying
I don't really have very many mkv files to test with, but it should be trivial to add support for this. Once I feel the script is done, I will check back and see if anyone is interested in helping me test mkv tagging.
MB-Max:ccjensen-PlexMediaTagger-8103f52 mmanfrin$ ./plexmediatagger.py -h
Traceback (most recent call last):
File “./plexmediatagger.py”, line 29, in
from lxml import etree
ImportError: No module named lxml
When trying to compile the lxml lib I got this:
B-Max:lxml mmanfrin$ sudo python setup.py build --static-deps
Password:
Building lxml version 2.3.
Latest version of libiconv is 1.13.1
Using existing libiconv downloaded into libs/libiconv-1.13.1.tar.gz (delete this file if you want to re-download the package)
Unpacking libiconv-1.13.1.tar.gz into build/tmp
Latest version of libxml2 is 2.7.8
Using existing libxml2 downloaded into libs/libxml2-2.7.8.tar.gz (delete this file if you want to re-download the package)
Unpacking libxml2-2.7.8.tar.gz into build/tmp
Latest version of libxslt is 1.1.26
Using existing libxslt downloaded into libs/libxslt-1.1.26.tar.gz (delete this file if you want to re-download the package)
Unpacking libxslt-1.1.26.tar.gz into build/tmp
Starting build in build/tmp/libiconv-1.13.1
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… build-aux/install-sh -c -d
checking for gawk… no
checking for mawk… no
checking for nawk… no
checking for awk… awk
checking whether make sets (MAKE)... yes<br />
checking whether make sets (MAKE)… (cached) yes
checking for gcc… gcc
checking for C compiler default output file name…
configure: error: in /Users/mmanfrin/Downloads/ccjensen-PlexMediaTagger-8103f52/lxml/build/tmp/libiconv-1.13.1':<br /> configure: error: C compiler cannot create executables<br /> See
config.log’ for more details.
Traceback (most recent call last):
File “setup.py”, line 150, in
STATIC_CFLAGS, STATIC_BINARIES),
File “/Users/mmanfrin/Downloads/ccjensen-PlexMediaTagger-8103f52/lxml/setupinfo.py”, line 56, in ext_modules
multicore=OPTION_MULTICORE)
File “/Users/mmanfrin/Downloads/ccjensen-PlexMediaTagger-8103f52/lxml/buildlibxml.py”, line 300, in build_libxml2xslt
cmmi(configure_cmd, libiconv_dir, multicore, **call_setup)
File “/Users/mmanfrin/Downloads/ccjensen-PlexMediaTagger-8103f52/lxml/buildlibxml.py”, line 244, in cmmi
call_subprocess(configure_cmd, cwd=build_dir, **call_setup)
File “/Users/mmanfrin/Downloads/ccjensen-PlexMediaTagger-8103f52/lxml/buildlibxml.py”, line 236, in call_subprocess
raise Exception(‘Command “%s” returned code %s’ % (cmd_desc, returncode))
Exception: Command “./configure --disable-dependency-tracking --disable-shared --prefix=/Users/mmanfrin/Downloads/ccjensen-PlexMediaTagger-8103f52/lxml/build/tmp/libxml2” returned code 77
Hi,
Thanks for giving it a shot. I forgot to include instructions that lxml was a dependency in the readme, and some help on getting it installed on snow leopard. I have updated the readme now, but for convinience, here was the magic line that let me install it on my mbp:
sudo env ARCHFLAGS="-arch i386 -arch x86_64" easy_install lxml
Hope that helps. I would advise that you make sure to run the script on test files only, as the script is still very alpha!
@ccjensen: this is a frakkin' awesome idea! I really appreciate your effort and will certainly download and try out your script. Commandline is just fine for now, I guess - also voted accordingly.
I was looking for something like that a while ago and I ended up buying iFlicks.
This is much more what I was looking for, as I really, really like the automagical metadata matching/mapping of the PMS library.
Thanks again and keep up the good work!
alex
ok, so the script is pretty feature ready (imho). Going to give it the good ol’ college try tonight, and hopefully some of you will give it a go (please use it on some duplicate files, or test data first).
Hi,
Is there a way to choose what content to tag directly without interaction?
For example:
plexmediatagger.py “Big buck bunny”
and the Plexmediatagger will look for content like “Big buck bunny” and tag that? This would be awesome as I’m thinking of using Plexmediatagger as a part of an automation script.
Best regards,
Kristofer
Hi Kristofer,
So my intention was for scripts that wanted to run my script (ie part of an automation pipeline), was for the PlexMediaTagger (pmt) to be run with the “batch” flag turned on. It will then evaluate all the content in all the sections, but only tag files that it has not previously tagged. That said, if you can make a good case for why that is not sufficient or applicable in all cases, then I am ready to be convinced
ok, done some testing and it seems to work well for me. Would love to hear from others if it works for them too
That said, it was primarily designed for my own use, so it was worth it even if no one else tries it
Awesome, I’ve wanted something to do this for ages, thanks for developing it, I wouldn’t know where to start myself. I shall give it a go in the next couple of days on some test files and let you know how I get on. Does it play nicely on Lion?
Plexmnky
Excellent! I haven’t upgraded to lion yet, but I don’t see any reason why it wouldn’t work fine. Just remember to install the extra python module that is required (information is in the github readme)
For people who do not know how to install code, how can we go about installing this script to get it to work?
Now it compiles but when executed it says 0 movies in the library, even tough I have 202 elements in it
"0. Movies" means that your section named "Movies" has the section ID 0. I think.
yea, atrus is right. 0 is the identifier for that section, so it’s asking you to select a section. So either push return (which will be the “All sections” selection), or enter “0” then hit return which means you select the movies section.
I would love suggestions on how to make things more clear, should you have some