Another Plex Series Scanner

Attached is a simple very limited scanner I threw together one afternoon a couple weeks back to allow plex read my TV series library without me having to rename everything to Plex's default naming convention.  I have not used this scanner for very long, I'm using Plex for the first time.  It has only been tested on a Synology 112 with PMS 0.9.13 and only with my standard formatted library.  

Don't expect it to work for you!

This scanner expects file names to use the convention:
Show Name (First Year)/Season XX (Season Year Start - Season Year End)/Show Name - SYYEZZ - Episode Title (Year-Month-Day) [File Information].extension

For Example:

Doctor Who (2005)/Season 7 (2012-2013)/Doctor Who (2005) - S07E01 - Asylum of the Daleks (2012-09-01) [1080p x264 AC3 6ch].mkv

In some cases will still try to match if there is data missing, but it has not been tested in any other case so I can't say it wont produce bad results! It will definitely ignore files if it cant find at least: Show Title, Season Number, and Episode Number (or Date). If it will use the information found in file name first, if it cant find information in the file name it will use information from the directory structure. If there is a miss match between information in the file name and the directory (ex. file name says Season 7 and directory is named Season 2) it will print a warning with the miss match information and file name (printout visible if running from command line). If it cant find the minimum information it will an print error message with the information it did find and ignore the file. It will report all information found to plex including episode title and date, I'm not sure how the plex uses the additional information, the default scanner doesn't use information it has in some cases, or if a metadata agent takes advantage of the additional information or if it just confuses the agent, but I did it anyway.

Multi part or multi episode files are not supported in this version.

This could use a major cleanup and re-write, its a hack, I just stopped working once it was working for me. I'm just putting it out there in case it helps someone (no point in just keeping it to myself). If you find it useful let me know and I'll put some more work into it!

 

sorry, but I did not find any attachment in your post.

Missing attachment aside (though I'd love to check it out!), I'm interested in your specific motivation to create this scanner.  Reading your description, it seems like the only thing that may not be handled well by the default one is the ability to put a year range in parentheses after the season directory name.  I have to say I'm not sure I've seen that as a convention before, but in the interest of making the default scanner as flexible as possible, can you explain your rationale there?  Where would one find media organized that way?  is it common?  How would you expect the year range to be interpreted and used in your library?  If it makes sense (and doesn't break existing behavior) it would be great to just handle as many cases as possible out of the box.

Oops! Sorry about the attachment, I will attach it when I get home.

I think its more then just the parenthesis in the season directory name keeping the default scanner from working with my file naming convention. I think the default scanner miss identified shows for other reasons as well, but I dont remember which cases. I didn't spend much time with the default scanner before just starting a new one from scratch. I was in a rush and since all my files are named the same way I didn't need the flexibility of the default scanner. This scanner wont work in most of the cases that the default scanner will work in, and only happens to work in a small set of cases where the default doenst.

I doubt anyone else uses this convention, I've never seen it either. Its probably not worth putting effort into supporting it in the default scanner. I don’t expect the year range to be used in the library, my scanner just ignores it, its only for me going through directories.

Why did I choose the convention?
0. Before using plex I just navigated the folder structure, no metadata to use for searching so I had to put all the information I might want in the file / directory name.
1. Putting the year with the show title in the  folder name helps differentiate shows with the same name (ex Doctor Who).
2. Putting the year range in the season just helps me find stuff. For example if I remember it an episode I was looking for was from 2010, but I don’t know what season number that is (which is usually the case), then I can still narow down the list of possible episodes quickly.
3. Putting all the info in the file name helps me make sure the file is stored in the right directory. Ex. if I left out the show title from the file name I would have to watch it to make sure its in the right directory.
4. Putting both the episode number and the episodes date in the file name helps if there is more than one excepted episode ordering system (ex Firefly has different air date orderings from DVD orderings I think).
5. Putting the media information in the file name lets me know which devices can play it without transcoding. I also helps me sort out which version to keep if I have duplicates, or if I should consider buying a bluray copy because the the copy in my library is one I recorded from an old TV or somthing.
6. Having all that information helps me recognize if Plex has misidentified it.

Rational for just doing a new scanner:
1. I wanted the scanner to output its results. Once an item is matched by the scanner its not always obvious in Plex if the match is right without actually watching the video. The first indication I had that the default scanner wasn't working was seeing shows pop up in Plex that I knew didn't exist in my library. I don't watch Korean drama. I'm sure it great, but its not my thing and I definatly dont have any.
2. I would rather the scanner not import something then import it wrong, and of course tell me why it didn’t import it is a big help.
3. I wanted to know if there were any files misnamed or misfiled. I could do this with a separate script to audit my library, but this was a convenient place to do it.
4. This is my first time writing Python and running something on a DiskStation. It also gave me a chance to practice regex, which I don't use often enough.

5. Since all my files are formatted the same way my scanner could be very simple compared to the default scanner. If a file doenst match the format its a sign I should fix the file instead of making the scanner read the other format.

6. Honestly the default scanner was just too hard to follow given the amount of time I wanted to spend on this. For example sometimes it would pick up the odd mp4 file tag on the 375th episode it scanned and grab some bad information I didn't even realize was in the file. When I first put some printouts in the default scanner to see how it worked, it took me a few minutes before I had the right print statements in there to identify that it was even using that matching branch for that file. Not being familiar with python, or how plex used the scanner, and having to move the results on and off the diskstation to review, I was spending to much time searching my results and not enough making progress. I realized it would just be more reliable and quicker for me in my narrow case to just write somethign from scratch.

 

See attached for scanner.

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