Modifying Common\VideoFile.py to ignore local trailers

Hi all,



I’m new to the forums (and python for that matter) but a huge fan of Plex. But I’m having a little bit of trouble because Plex is adding all of my local trailers to the library creating a few hundred useless entries and clogging things up a bit.



As some background, I store trailers locally in each movie folder in the following scheme: “Movie railers railer.mov”.



I found that in “Plex Media Server\Resources\Plug-ins\Scanners.bundle\Contents\Resources\Common” there is a file named VideoFile.py that filters out certain video files, like samples for example. So I tried to update the file like this to fix my problem:



ignore_files = ['[-\._ ]sample', 'trailer', 'sample[-\._ ]', '-trailer\.']<br />
ignore_dirs =  ['extras?', '!?samples?', 'bonus', '.*bonus disc.*', '.*trailer.*']<br />
ignore_suffixes = ['.dvdmedia']



But, no matter what regex combination I try, it still adds my trailers. Any ideas?

(For the record, I'm using the "Plex Movie Scanner" to add movies, but I believe it pulls from this file)

Thanks,
bdizzle

Ok, so as an update, I figured out the problem - I was modifying the wrong version of the file. If anybody else finds this thread, make sure you’re editing this file:



C:\Users\[USER]\AppData\Local\Plex Media Server\Plug-ins\Scanners.bundle\Contents\Resources\Common\VideoFiles.py



Also, here are the more personalized RegEx:


ignore_files = ['[-\._ ]sample', 'sample[-\._ ]', '-trailer\.', 'trailer[0-9]*\.']<br />
ignore_dirs =  ['extras?', '!?samples?', 'bonus', '.*bonus disc.*', '!?trailers?']<br />
ignore_suffixes = ['.dvdmedia']



This works great, until I restart the machine and all my changes are somehow overwritten. Is this a standard occurence or is this something specific to my machine?

I have this same concern. I’ve just deleted all of my trailers to cope.



It would be great if this option to ignore certain files could be built into the Plex settings.



It's standard, auto-update restores the bundle to its pristine condition. If you'd like to edit the scanner, you'll need to create a custom scanner and use that. Check this thread out ~ http://forums.plexapp.com/index.php/topic/19396-how-to-install-a-custom-scanner/


Thanks for the heads up elan. I'll write my own scanner then.

Any chance at getting this integrated into Plex though? It is a very common local trailer format and if Plex is already set to ignore "-trailer" files, shouldn't it be set to ignore all trailer files?

I use "Media Center Master" (MCM) to organize generate metadata for "MediaBrowser" for my Windows Media Center 8 x64 bit.  MCM awesome program autodownloads trailers form multiple sources in the  railers\ subfolder (as well as integrates with Utorrent if your into that).  I disable all internet updates (using only local metadata) for Plex and MediaBrowser for a consistent metadata experience.

I know MS may be old in the tooth, I've standardized on Windows Media Center so I get Cablecard support for Live/Recorded TV + Downloaded Media since it will be supported at least for 10 years from release of Windows 8...and it's better than the Cable Company box.     I use MediaBrowser for my downloaded media for the played from my HomePC split to 4 TV's via HDMI controlled with a few RF WMC Remote control.   I've was looking to augment home and remote access using tablets & mobile phones (both Surface RT and Windows Phone have Plex apps) .    Unfortunately, the Plex "Media Center" application doesn't work well with touch control system in our foyer nor does it work using Media Center Extenders (Xbox 360s).  Lastly, Windows Media Center has home automation program plugins like HomeSeer and MControl that makes it one box that can control the whole home media experience (and windows shades).

Adding Plex to the mix seems to work great and MCM just needed a checkbox to also to also generate the NFO files for every movie folder.  Trailers are another story and I quickly got double the files.  

While I'm happy the -trailer is a built in option, It would be really nice if Plex ignored "in the box" as it's quite common.  All the formats I've seen are:

  • *_trailer.*(underscore)
  • *-trailer.* (hyphen)
  • trailer.*
  • railers\ or railer\ (folder/subfolder)  - This is all I needed now so the custom code in the forum worked.

However, in this case the solution was creating a new custom scanner with the code above worked ....though it was a bit tricky and took me a few days to figure out about why it kept disappearing :)  Thanks to @elan's response above I'll work on creating a custom scanner solution..  

@AgileHumor, you can make a .plexignore file containing the following and stick it in the root directory of your movies section:

_trailer.*
*-trailer.*
trailer.*
trailers/*
trailer/*

This will cause the scanner to ignore these files.  Broader changes to the default scanner behavior need to be carefully considered, since people use a wide variety of organization and naming conventions, and making changes there is almost guaranteed to break some percentage of those.

@AgileHumor, you can make a .plexignore file containing the following and stick it in the root directory of your movies section:

_trailer.*
*-trailer.*
trailer.*
trailers/*
trailer/*

This will cause the scanner to ignore these files.  Broader changes to the default scanner behavior need to be carefully considered, since people use a wide variety of organization and naming conventions, and making changes there is almost guaranteed to break some percentage of those.

I did not know that, this seems like it would work and be the easiest solution :)

Do you know if I can put this in the \Movies\ root folder, and not each of my 500 movie subfolders (\Movies\My Movie #1\ & \Movies\My Movie #2\) ?

Yes, only needs to be in the root.

You rock kind sir!

@AgileHumor, you can make a .plexignore file containing the following and stick it in the root directory of your movies section:

_trailer.*
*-trailer.*
trailer.*
trailers/*
trailer/*

This will cause the scanner to ignore these files.  Broader changes to the default scanner behavior need to be carefully considered, since people use a wide variety of organization and naming conventions, and making changes there is almost guaranteed to break some percentage of those.

You guys make this seem so easy.  I am not sure what I am doing wrong.  I am taking the above and putting it into a TXT doc and the renaming it to .plexignore file.  Than I am putting it in my root movies folder.  It is still importing my trailers.  What could I be doing wrong?

You guys make this seem so easy.  I am not sure what I am doing wrong.  I am taking the above and putting it into a TXT doc and the renaming it to .plexignore file.  Than I am putting it in my root movies folder.  It is still importing my trailers.  What could I be doing wrong?

Can anyone help me with this?

Can anyone help me with this?

Are you on Windows?  Make sure the file is called exactly ".plexignore" and does not have a .txt extension, for example.  Note that the extension may be hidden by default.

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