[REL] Extended Personal Media Scanner

Hi mjarends

Thanks very much for that… unfortunately all the sub folders are a little different from various training companies but most seem to have some kind of sub folder structure with related materiel including the video’s…etc… So I was looking for any way to essentially ignore/skip any folder name if thats at all possible, I’ve been trying to use the ‘*’ but have not been able to get it working at yet… I’ll keep messing around and see if I get lucky.

Eg, all the shows I have just about fall under the following possibilities\structure:
\Show Title\s1e09 - Episode Title.mp4
\Show Title\SUBFOLDER\s1e09 - Episode Title.mp4
\Show Title\SUBFOLDER\SUBFOLDER\s1e09 - Episode Title.mp4

Thanks again for your help!

@Jon_C This should work for you:

(?P<showTitle>[^\\/]+)[\\/][\w\d\\/]*[sc](?P<seasonNumber>[0-9]+)[e](?P<episodeNumber>[0-9]+)[ ]*[-\.]{0,1}[ ]*(?P<episodeTitle>.*)\.(?P<ext>.+)

OMG mjarends… You did it…

It’s working 100% in the testing website! but I think I have one final issue as after removing the library from plex and re-adding a new one it’s added the media but I’m still getting sub folder names as show names so I’m guessing it’s just picking up some of the other rules… do you sugest I remove all other rules you have in place (py file) or have I missed something silly… I tried to move the “class SeriesEpisodeMediaParser(BaseMediaParser):” above “class SeriesDateBasedMediaParser(BaseMediaParser):” and I also put the new line of code in at the very top of the list of rules for scanning hoping once it matched the first rule it would not bother looking further but I’m thinking thats not how it works?

This is the first rule in both py files now

#\Show Title\s2012e09 - Episode Title.mp4
#\Show Title\Folder\s2012e09 - Episode Title.mp4
#\Show Title\Folder\Folder\s2012e09 - Episode Title.mp4
r'(?P<showTitle>[^\\/]+)[\\/][\w\d\\/]*[sc](?P<seasonNumber>[0-9]+)[e](?P<episodeNumber>[0-9]+)[ ]*[-\.]{0,1}[ ]*(?P<episodeTitle>.*)\.(?P<ext>.+)$',

@Jon_C Placing the rule first in the episode parser will give it priority within that parser. If you want to change the order or the number of parsers used you would need to modify the list of series_parsers (show below) within both the scanner and metadata agent.

    # List of series parsers
    series_parsers = [SeriesDatedEpisodeMediaParser(), SeriesDateBasedMediaParser(), SeriesEpisodeMediaParser()]

If you remove parsers from the list they will no longer be used when processing files. If you move SeriesEpisodeMediaParser() first in the series_parsers list it’s regexes will be considered first.

Additionally you need to ensure that the same changes are made in both the Scanner and Metadata Agent.

@mjarends Thanks again for all your help, I have made all the changes and I noticed I now have another issue due to some of hte training material not having as static sub folder names… :frowning:

I’ve found some of the sub folders have spaces dashes or full stops in the name as well so the skip criteria needs to include this I’m busy playing around with this now to see if I can work it out and appreciate all your help especially considering your plugin was not really designed for these needs! (Many thanks again!)

\Show Title\s2012e09 - Episode Title.mp4
\Show Title\Folder\s2012e09 - Episode Title.mp4
\Show Title\Folder\Folder\s2012e09 - Episode Title.mp4
\Show Title\Folder folder\Folder\s2012e09 - Episode Title.mp4
\Show Title\Folder - folder_folder\Folder.folder\s2012e09 - Episode Title.mp4

@Jon_C In the regex below I am assuming that all of your training videos are in the same root library folder. In the regex below replace “Library Root” with the name of the folder where your videos are stored.

[\\/]Library Root[\\/](?P<showTitle>[^\\/]+)[\d\D\\/]*[sc](?P<seasonNumber>[0-9]+)[e](?P<episodeNumber>[0-9]+)[ ]*[-\.]{0,1}[ ]*(?P<episodeTitle>.*)\.(?P<ext>.+)

@mjarends , One word… WOW… No idea what you did there and can’t quite get my head around it but I’m very impressed!

I’ve been taking stabs in the dark hoping i could work it out but looking at the above code I never think I would have guessed or tried that and I’ve been trying allot :slight_smile:

Thanks very much once again for all your fantastic help and support! It seems it’s all working very well now! I have 58 shows listed and I had 58 ‘shows’’ listed in the folder I’ve added so far which is my main work training folder… I also have some workout training vids in another folder I will start working on but I’m sure I’ll manage to work that out after your great help in getting me upto speed on the basics of how it all works :wink:

I created a plex pass vote for plex to add these features by default if anyone wants to vote for it:

Thanks a ton for making this by the way.

1 Like

Hello everyone, I am new here and have a question regarding the installation of custom scanners in my new PLEX Windows Server 2012 R2 environment. My previous installation of PLEX was on a WS 2008 R2 installation and it worked great. my dilemma is that I am unable to locate the specified folder “scanners” or “scanners.bundle”. I do have the following path which I tried, but did not contain the folder I need, C:\Users\Administrator\AppData\Local\Plex Media Server.
The instructions and links to download were graciously provided by mjarends.
Could someone please clarify, and point me in the right direction.
Thanks in advance.

@prdebruin I’m not in front of my home server now but I believe the steps included in the following comment (they are specific to Windows 7/8) should help you find the right place to put the files. I think you may have to create the Scanners directory as it might not be there by default.

mjarends, you’re right, I created the folder structure required and uploaded the series folder. At first it didn’t work, until I realized that there was a setting under Settings\Server\General called: The path where local application data is stored It was point towards the system32 folder for some reason. Once I updated the path there it worked. I hope others will benefit from this post, since there isn’t very much information about this configuration in Server 2012 R2.
Thanks again for the fast response.
Cheers!

@mjarends You have a small error in your linux install instructions, and it’s somewhat related to the previous comment. In the newest version of ubuntu and PMS, there’s no scanner folder by default, so people have to create it and give it the right permissions (which is somewhat difficult for beginners due to all the permission wierdness). You now need to:

cd /var/lib/plexmediaserver/Library/Application Support/Plex Media Server
sudo mkdir Scanners
sudo cp -R [directory a] [directory b]
sudo chown -R plex:plex Scanners [making sure the person is still in /var/lib/plexmediaserver/Library/Application Support/Plex Media Server]

@inferno596 I have have updated the first post with your instructions. Thanks!

I have updated the scanner and metadata plugins to make using the media file’s last modified timestamp as an episode release date optional. Users had reported issues with the scanner/metadata agent and displaying episode numbers shows out of order. See the metadata agent thread for more details on disabling/enabling the option.

@mjarends said:
See the documentation here for more details on this scanner Bitbucket

Change Log:

4/4/2015: Moved the creation of the scanners to within the Scan method

5/29/2015: Added support for episode formatted files that contain episode release dates (ex: s1e1 - 2014-12-13 - Episode Title.mp4)

1/6/2016: Added support for two digit episode index numbers in date-based episodes (ex: \Show Title - s2012e09 - 2015-12-31_25 - Episode Title.mp4. (NOTE: Updating the plug-in and rescanning your library will result in new episode numbers being created)

6/29/2017: Removed functionality that sets the episode release date from the scanner to the metadata agent

8/22/2017: Added support for using the keyword Lesson, lesson, L, or l in directory and file names in place of the word Season, season, S, or s.

I am unsure what is causing this but for some reason I have a bunch of content that is being skipped and it looks like there’s an error in the .py script for the Scanner. Here’s a copy of the log, hopefully you can help me troubleshoot this. If I switch the scanner to something else it picks up the files without issue.

Excerpt from log showing error:

Oct 25, 2017 15:15:01.374 [2748] DEBUG - Directory had 93 files, database had 0 files, can’t skip.
Oct 25, 2017 15:15:01.461 [2748] ERROR - Error in Python: Running scanner:
Traceback (most recent call last):
File “C:\Users\Administrator\AppData\Local\Plex Media Server\Scanners\Series\Extended Personal Media Scanner.py”, line 392, in Scan
parser.parse(absFilePath, language)
File “C:\Users\Administrator\AppData\Local\Plex Media Server\Scanners\Series\Extended Personal Media Scanner.py”, line 141, in parse
self.setValues(match)
File “C:\Users\Administrator\AppData\Local\Plex Media Server\Scanners\Series\Extended Personal Media Scanner.py”, line 222, in setValues
self.episodeReleaseDate = datetime.datetime(self.episodeYear, self.episodeMonth, self.episodeDay)
ValueError: month must be in 1…12
Oct 25, 2017 15:15:01.462 [2748] ERROR - We got an error scanning in \192.168.2.6\Media\eLearning

That also comes up immediately after scanning the files it can’t seem to read for some reason. I changed the filename to test.mp4 as well as others, it never picks up the files but it reads one folder fine. I don’t get it.

EDIT: Also there are double slashes for whatever reason this site is not showing them but you can see them in the log.

EDIT 2: If I switch to folder view I can see the folders but no files.

After hours upon hours of troubleshooting I have come to the conclusion it has something to do with X amount of characters along with dashes

BOB Microsoft Windows Server 2012 70-700 shows no files in this folder
BOB Microsoft Windows Server 2012 10-100 shows an incorrect file name like it’s parsing wrong the file in the folder is 01 Introduction.mp4 it shows up as “0\Lesson 01\01 Introduction”
BOB Microsoft Windows Server 2012 10100 shows correct
BOB Microsoft Windows Server 2012 70700 correct

It also doesn’t seem to read files correctly if there are any hyphens in the name.

  1. Introduction to 70-410.mp4 does not show up
  2. Introduction to 70410.mp4 shows up

@LVNeptune It’s because the media is not following any of the patterns supported by the Extended Personal Media scanner and the metadata plugin. In order for the scanner to work you would need to modify the media to use the SxxExx pattern. See the readme page here for more details: https://bitbucket.org/mjarends/plex-scanners

If you don’t want to rename everything then I would recommend using the Plex default scanner as it supports adding unstructured content to Plex.

Actually the Plex scanner won’t pick them up either. I realize some of it is not normal but it does actually pick them up correctly if he dashes are removed. There is most definitely an issue with the regex somewhere causing it to exclude stuff with so many characters and dashes.

The problem is that the regexs are all expecting media to be named in a certain format. In your case the scanner and metadata agent are incorrectly trying to parse the following name as it were a date-based episode.

CBT Nuggets - Microsoft Windows Server 2012 70-410 with R2 Updates\10. Configure Server Core.mp4

It sees the 2012 70-410 as a date and tries to use that to build the season and episode numbers that Plex requires for the TV libraries. That is also the reason you are getting the error that you put in your first post. If you aren’t following the formats then the plugins will not work. Currently there are no easy ways to override the built-in regexes to get custom file names to work.

noob here. Any suggestion as to how I can create the required folders for a plex server on a synology nas? I can’t even see where things are installed and I’m far removed from understanding how it all works under the hood >.<