Plex Movie/Series Scanner with Ignore Options

The following scanners allow you to ignore certain directories while scanning Movies or Series.



To use:

  • install the scanners in ~/Library/Application Support/Plex Media Server/Scanners/Movies/ and ~/Library/Application Support/Plex Media Server/Scanners/Series/ (create the Movies and Series folder as needed)

    On Windows: C:\Users<user>\AppData\Local\Plex Media Server\Plug-ins\Scanners.bundle\Contents\Resources\Movies and Series
  • Create .plexignore files in the directories you want to ignore.
  • Use the “Plex Movie Scanner with Ignore Options” scanner (or the Series equivalent), in the appropriate sections.
  • Empty and re-scan the section(s) containing newly ignored folders (or manually remove the videos that are now ignored, if that’s possible).



    Note that ignored dirs will NOT be ignored if they are included in a section definition.

    i.e. if you have a /Movies/Something/.plexignore file, and /Movies is in your Movies section, the files in /Movies/Something/ will not be added in the Movies section, but you can create a new section that contains /Movies/Something directly, and that will work.



    Anyone who wants to implement this in another scanner can do so easily.

    Just copy-paste the following code block before the Scan method:

def Ignore(subdirs):<br />
	#print "Checking for Ignores in the following subdirs:" + pprint.pformat(subdirs)<br />
	subdirs_to_whack = []<br />
	for subdir in subdirs:<br />
		if os.path.exists(subdir + '/.plexignore'):<br />
			print "Found .plexignore file in " + subdir + ". Ignoring."<br />
			subdirs_to_whack.append(subdir)<br />
<br />
	# Whack subdirs.<br />
	subdirs_to_whack = list(set(subdirs_to_whack))<br />
	for subdir in subdirs_to_whack:<br />
		subdirs.remove(subdir)


and call this at the beginning of the Scan method:

Ignore(subdirs)

And the scanners! :slight_smile:

Thanks for this mod! I’m going to test it out tonight on a Windows setup.



For Windows users this should be dropped into the C:\Users<user>\AppData\Local\Plex Media Server\Plug-ins\Scanners.bundle\Contents\Resources\Movies folder for it to show up in the PMM, Edit Section, Advanced, Media Scanner drop-down dialog. Also note, to create a file called ‘.plexignore’ file in Windows 7, right-click an empty area in Windows Explorer, New, Text Document, naming the new document, ‘.plexignore.’, click Yes when the warning message appears. You’ll first want to disable hiding of file extensions which is the default in Windows 7.

Guillaume,



How would one ignore certain file types only? Could you explain how this approach could be modified?



Thanks,



TC

Try this (untested):



<br />
  for f in files:<br />
    if f.endswith('.bli') or f.endswith('.bla'):<br />
      files.remove(f)<br />




Add those lines in both .py files, after the line with:

  Ignore(subdirs)



Careful with indentation. The number of spaces is important.

The end result should look like this:


<br />
  # Don't scan ignored subdirs<br />
  Ignore(subdirs)<br />
<br />
  for f in files:<br />
    if f.endswith('.bli') or f.endswith('.bla'):<br />
      files.remove(f)<br />
<br />
  # Scan for video files.<br />
  VideoFiles.Scan(path, files, mediaList, subdirs)<br />




Evidently, change .bli and .bla for whatever extensions you don't want. Add more as needed, or remove the "or ..." part if you only want to ignore one extension.

I added in these scripts to my plex media server (running on debian) to this location /usr/lib/plexmediaserver/Resources/Plug-ins/Scanners.bundle/Contents/Resources/Movies & /usr/lib/plexmediaserver/Resources/Plug-ins/Scanners.bundle/Contents/Resources/Series



I restarted the service and I still do not see the “with ignore option” listed under the “media scanner”, just the standard ones.



Please let me know if you have any ideas, thanks.



The script works great! I really appreciate it!

I made a minor modification that I thought I would share that ignores subdirectories named "trailers" so you don't have to create a file for each one.


<br />
def Ignore(subdirs):<br />
        #print "Checking for Ignores in the following subdirs:" + pprint.pformat(subdirs)<br />
        subdirs_to_whack = []<br />
        for subdir in subdirs:<br />
                if os.path.exists(subdir + '/plex.dna'):<br />
                        print "Found plex.dna file in " + subdir + ". Ignoring."<br />
                        subdirs_to_whack.append(subdir)<br />
                elif os.path.basename(subdir) == "trailers":<br />
                        print "Found trailers subdirectory. Ignoring."<br />
                        subdirs_to_whack.append(subdir)<br />
<br />
        # Whack subdirs.<br />
        subdirs_to_whack = list(set(subdirs_to_whack))<br />
        for subdir in subdirs_to_whack:<br />
                subdirs.remove(subdir)<br />




One question though - do you know how to remove an entry in the library once you add a .plexignore (or plex.dna file in my case)? Or do you just have to recreate a new section everytime?

For instance, the scanner added several files to a section, which I would like to remove. It would be awesome to be able to add a .plexignore (or plex.dna) file to those folders and have them automatically removed from that section.

Do you know how to do this? Or where the python script responsible for cleaning a section is?

Does anybody know if there something similar to this that will help ignore keywords? for e.g. 720p, 1080p, 2013, 2012 etc..

Recently i have noticed some movies are failing to find a correct match because plex is looking for these as part of the movie title i.e Plex would search for 'Elysium 720p' rather than just searching for 'Elysium' and fails to find a match.

My file naming structure -

 Folder - Elysium (2013)

  File - Elysium (720p).mp4

Can I use this method to stop the adding of AppleDouble files?

This is a pain.

Media server running on ReadyNAS, Currently running V0.9.9.14

![post-149650-0-16240500-1412778596.png|690x238](upload://AlA8sAv5I1zcYnwYjIWdAepT3AI.png)

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