How to override/update VideoFiles.py?

VideoFiles.py "helpfully" ignores folders called "extras
The VideoFiles.py file that ships with Plex ignores folders that include the word 'extras', thanks to an ignore_dirs array. Presumably this is so that DVD extras don't clutter up movie listings. It's extremely unhelpful when trying to keep the popular BBC series 'Extras' in my library.

I've manually modified the file, removing the 'extras' regex from the array, but something helpfully overwrites my changes with the pristine file, and my series disappears again.

On OSX, the file in question is: ~/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/Scanners.bundle/Contents/Resources/Common/VideoFiles.py

I've got a custom scanner installed already, for other reasons, but I don't know where to put a customized version of VideoFiles.py so that it will be used, nor how to stop Plex from re-disappearing my series.

Help?

I think I’ve found a solution for this. In ~/Library/Application Support/Plex Media Server/Scanners, I created a Common directory and put my slightly-modified VideoFiles.py in there. That seems to have worked.

Ah, no, I spoke too soon.



My question stands: Is there any way to override VideoFiles.py so that the television show Extras is allowed to exist in Plex?

Interesting that I’ve been trying to figure out this exact same thing today. Except I’m trying to exclude qHD (quarter HD) from the file name. Please let me know if you figure this out.

Finally figured out a way around this. I had to add a custom path to search for the import files.



Copied /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Scanners.bundle/Contents/Resources/Common/

to

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Scanners/Common/




Now, inside the new Common directory, I copied VideoFiles.py to VideoFilesCustom.py

Modifiy VideoFilesCustom.py to how you see fit.



The only file that needs to be modified in the Common directory is Stack.py. Run the following so that is now references the new VideoFilesCustom.py file.

sed -i ‘s/VideoFiles/VideoFilesCustom/g’ Stack.py



Make sure all the permissions are correct in the files here. For me:

chown plex:nogroup *



Now go into the Scanners/Movies/ folder.

Modify your custom movie scanner. I took the original one and copied it to this folder and renamed it to:

Plex_Movie_Scanner_Custom.py



Modify your custom scanner:



You will need to change all references of VideoFiles to VideoFilesCustom:

sed -i ‘s/VideoFiles/VideoFilesCustom/g’



Now the piece to add the path for your import to the new Common directory you made:

Here are the relevant lines for my file:



import re, os, os.path, sys

sys.path.append("/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Scanners/Common")

import Media, VideoFilesCustom, Stack, Utils



Check your permissions again.



Note: You probably don’t need to copy all of the files from the original Common to the new one. You probably only need the renamed version of VideoFiles.py to make this work.



I feel like doing it in this manner is using a sledge hammer to drive in a penny nail.



Because of how crucial to properly pick up the files in one’s library, the developers should add a method to modify this in the web settings under Advanced for a individual library. This is far too complicated to fix for something that should be be fundamental part of a scanners job.

You have done exactly what I need to do, but unfortunatly I am running PMS on a Windows server.

I was able to follow your instructions to the point where I was supposed to run a "sed" command.

I dont know how... It is a unix command right?

Is it possible for you to attach a zip-file containing the needed altered files in its actual directory structure?

Like:

Plex Media Server/Scanners/Common/*

Plex Media Server/Plug-ins/Scanners.bundle/Contents/Resources/Common/*

Sorry if I missunderstood you in any way, I am a slow learner...

Thank you in advance

You have done exactly what I need to do, but unfortunatly I am running PMS on a Windows server.

I was able to follow your instructions to the point where I was supposed to run a "sed" command.

I dont know how... It is a unix command right?

Is it possible for you to attach a zip-file containing the needed altered files in its actual directory structure?

Like:

Plex Media Server/Scanners/Common/*

Plex Media Server/Plug-ins/Scanners.bundle/Contents/Resources/Common/*

Sorry if I missunderstood you in any way, I am a slow learner...

Thank you in advance

I created a thread soon after I posted that for instructions and an attache file to use it under windows.  See this thread:

http://forums.plexapp.com/index.php/topic/62128-modified-movie-scanner-to-exclude-names-in-files/?p=362823

This came up recently in Chat for slightly different reasons and I just stumbled on this thread.

If your show folder for "Extras" is at the top level of your TV section (which is recommended for TV organization/naming anyway), then it will not be skipped by the scanner.  So, if you name it like this, e.g.:

TV Root Directory/Extras/Season 1/Extras - S01E01.mkv

you should be fine.  I would also be curious to know if there's a compelling reason to have show folders lower in the hierarchy than that.

mmccurdy, I don't know how compelling my reason is, but I have 3.96TB of television file split across three external hard disks. The disks themselves are 1, 2, and 3TB. Looking at the distribution now, I could consolidate things onto just two drives, but not one.

A consequence of my need to split things up is that I split the files into functional groupings: Animation, British TV, Cable TV, Reality TV, and Television. Somethings this is a happy consequence, and sometimes it's a pain, but I'm hard-pressed to think of how I could get everything into a single folder so I could have a "TV Root Directory." So instead I have five.

So for me, it's: /Volumes/Marvin/British\ Television/Extras/Extras - Season 1 (2005)/Extras - 1x01 - Ben Stiller.avi

And Plex periodically updates things and disappears Extras again.  :(

Sorry, I didn't mean that you needed to have a *single* root directory, you can have more than one.  I think I see your problem though.  Just remove the word "Extras" from the Season directory, so instead of "Extras - Season 1 (2005)" just call it "Season 1."

Since you're in the code anyway, if you're interested, here's the logic that adds that list of ignores to everything *except* things directly in the root of the section: 

https://github.com/plexinc-plugins/Scanners.bundle/blob/master/Contents/Resources/Common/VideoFiles.py#L164

The problem is, when it scans that Season directory, it's not at the root of the section, it's one directory down (under "Extras"), so it filters it out. Make sense?

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