Help with custom scanner

Hi,



I’m trying to create a custom scanner because I like to name my shows differently, e.g.



Show #1.14.mkv instead of Show S01E14.mkv



I know, I’m stubborn.



I had this working perfectly under Plex 8, but I understand there have been changes. After reading the forums, this is what I did:



[list]

[] Create a new folder here: /Library/Application Support/Plex Media Server/Scanners/Series

[
] Copied the file “/Library/Application Support/Plex Media Server/plug-ins/Scanners.bundle/Contents/Resources/Series/Plex Series Scanner.py” into that folder.

[] Renamed the new copy to “My Scanner”.py

[
] Changed the lines

[/list]



episode_regexps = [ <br />
    '(?P<show>.*?)[sS](?P<season>[0-9]+)[\._ ]*[eE](?P<ep>[0-9]+)([- ]?[Ee+](?P<secondEp>[0-9]+))?',                           # S03E04-E05<br />
    '(?P<show>.*?)[sS](?P<season>[0-9]{2})[\._\- ]+(?P<ep>[0-9]+)',                                                            # S03-03<br />
    '(?P<show>.*?)([^0-9]|^)(?P<season>[0-9]{1,2})[Xx](?P<ep>[0-9]+)(-[0-9]+[Xx](?P<secondEp>[0-9]+))?',                       # 3x03<br />
    '(.*?)[^0-9a-z](?P<season>[0-9]{1,2})(?P<ep>[0-9]{2})([\.\-][0-9]+(?P<secondEp>[0-9]{2})([ \-_\.]|$)[\.\-]?)?([^0-9a-z%]|$)' # .602.<br />
  ]



to


epsiode_regexps = [<br />
     '(?P<show>.*?)[ ][#](?P<season>[0-9]+)[\._ ]*[\.](?P<ep>[0-9]+)([- ]?[Ee+](?P<secondEp>[0-9]+))?',<br />
     '(?P<show>.*?)[#](?P<season>[0-9]{1,2})[\.](?P<ep>[0-9]+)(-[0-9]+[Xx](?P<secondEp>[0-9]+))?',<br />
     '(?P<show>[A-Za-z0-9\!'\-\. ]+) #(?P<season>[0-9]+)\.(?P<ep>[0-9]+)?'<br />
]<br />




[list]
[*] And finally, went to "Edit Section" in the Media Server to use my scanner.
[/list]

Before I started this, my shows were actually being found... mostly. Episodes 10-19 started to disappear though, so I created the new scanner. It hasn't helped. I made my own regexp in Plex 8 and didn't have a problem, but I don't know what's going wrong here.

The other problem is 30 Rock, where for each season it seems to only think episode 30 is there. That's definitely not right. Again, the same regex in 8 found them all.

For the curious, here's what I had in Plex 8 in advancedsettings.xml that worked perfectly:


<br />
<tvshowmatching action="prepend"><br />
    <regexp>Season ([0-9]{1,3})/[A-Za-z0-9\!'\-\. ]+ #[0-9]{1,3}\.([0-9]{1,3})*</regexp><br />
    <regexp>Series ([0-9]+)/[A-Za-z0-9\!'\-\. ]+ #[0-9]+\.([0-9]+)*</regexp><br />
</tvshowmatching><br />




Any help would be greatly appreciated!

This is better posted in the Developer > Scanners forum here…



James

Oops - I didn’t see this section! Thanks.



Any help appreciated!

I recommend you run from Terminal like this:



<br />
$ alias pms="~/Library/Application\ Support/Plex/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner"<br />
$ pms --list<br />
$ pms --scan --section X<br />




(replacing X with the number of the section)

You can then put print statements in the code to figure out what's wrong.

I admire your tenacity :)

I’ve finally had a chance to test this, and it worked very well! It immediately pointed out my two typos. (Funnily enough, I should have seen one of them in the syntax coloring above!)



Thanks so much for your help!

I’m trying to do something very similar, but matching:



Show

Season ##

Show - [SSxEE] - Title



I could do this in Plex 8 with regexp, but I can’t seem to get it to work in 9. For whatever reason Plex seems to think this:



Top Gear

Season 13

Top Gear - [13x01] - 2009.06.21 [FoV].avi



Is season 8. Every season of Top Gear is listed as the wrong season #.

I recommend you run from Terminal like this:
 

$ alias pms="~/Library/Application\ Support/Plex/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner"
$ pms --list
$ pms --scan --section X

Since PMS already means Plex Media Server, I'm going to instead suggest

alias pmscanner="~/Library/Application\ Support/Plex/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner"

Which, for those keeping score at home means:

OSX

alias pmscanner="~/Library/Application\ Support/Plex/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner"

Linux 

alias pmscanner="/usr/lib/plexmediaserver/Plex\ Media\ Scanner"

Windows

(No such thing as aliases, so someone else can fill in the Scanner location here if they feel it's needed)

This wouldn't work for me at all due to it not finding the library paths (on ubuntu), so I put it in a shell script in /usr/local/bin instead:

#!/bin/sh
SCRIPTPATH=/usr/lib/plexmediaserver
export LD_LIBRARY_PATH="${SCRIPTPATH}"
"${SCRIPTPATH}"/Plex\ Media\ Scanner "$@"
 
You probably want to execute
 
$ sudo su plex
 
beforehand to make sure you are executing the command as the right user

I know this is an old thread, but under OSX 10.9, you want to set the alias as follows...

alias pmscanner="/Applications/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner"

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.