Hey all,
Is it possible to call the scanners for TV Shows and Movies from the command line or another python script? I want to write a script that automatically puts content in the right directories so that PMS can pick them up.
Thanks,
Erwin
I don’t know if you are interested in using non plex apps to do this, but you can use folder actions and applescripts to set this type of thing up. It’s pretty well documented.
yes you can, plex media scanner can be run very easily from the command line:
~/Library/Application\ Support/Plex/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner -h<br />
Plex Media Scanner (c) 2010 Plex Development Team.<br />
<br />
-h, --help Display this message.<br />
-v, --verbose Show more output.<br />
-p, --progress Show special progress output.<br />
<br />
Actions:<br />
<br />
-r, --refresh Refresh the metadata.<br />
-s, --scan Scan for new media.<br />
-i, --info Get information.<br />
-l, --list List.<br />
-g, --generate Regenerate thumbnails/fanart.<br />
-t, --tree Show a section tree.<br />
-w, --reset Delete all media out of a section.<br />
--add-section <name> --section-type <type:1,2,8> --section-location <path> Add a new section<br />
<br />
Items to which actions apply:<br />
<br />
-c, --section A library section ID.<br />
-o, --item An item ID.<br />
-d, --directory A directory path.<br />
-f, --file A file.<br />
-x, --force Force an operation (e.g. refresh)<br />
Thanks Billy,
I did find out you can run the Plex Media Scanner from the command line, but as far as I can see those commands are only used to rescan the content that is already in the directory structure.
What I want is a script that takes a file from anywhere and copies it to the appropriate directory in the PMS directory structure.
So when I give it a file, I want to use the logic that is already present in the scanners to extract either the movie title or the serie, season and episode number.
Does that make sense? And is that really not possible with the PMS command line tool?
Thanks,
Erwin
So you want scanners to have file manipulation capabilities such as mv and/or rm ?
Not really. I would be happy if I could throw a file at a scanner and get back the result what the file is. Either a movie with a freebase reference or a tv show with a tvdb reference.
I can then do the rest myself.
Either that or just import functionality in PMS, so that PMS can accept any file and moves it to the right directory, but that would be a lot of work I guess.
There is a way in finder to determine what sites a file has metdata from. There is folder in plex media server in application support called metadata. Vthats where your metadata is stored. Biz this sort of what you looking for?
Nope, but I really appreciate you thinking with me :)
What I want is to make a script that imports files into PMS. So a file that is downloaded from the net, copied from a USB stick, found on an old hard drive etc. I want to throw a file at the script and have the script move the file to the appropriate directory in my PMS folder structure so that PMS will pick it up and it will be available.
To make such a script almost all the functionality is trying to figure out if it is a movie or a tv show and what movie and/or tv show it is. All the functionality is already in PMS and I am trying to reuse that.
Does that make sense?
problem is, even today plex has no real way of telling whether something is a tv episode or a movie, the tv and movie scanners are separate and one or the other gets invoked based on which library section you are scanning. (and the tv scanner is highly dependent on the directory structure to find the show name). so even if you directly imported and called functions from the scanners ( http://github.com/plexinc-plugins/Scanners.bundle ) you’ve still got a lot of very very painful regex work ahead of you.
btw, the scanners dont know anything about the matching to the online databases, that’s the agents’ job.
Plus I dont think that plex agents or scanners can move or copy files
To determine if movie or tv you could look for sxxexx in the file name
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.