plexinc-plugins/Scanners.bundle — pull request #22 by mmccurdy07 (2013-05-31 05:01:45+00:00)
Title: Implement .plexignore, refactor some Utils

Allows for a .plexignore file in any directory or in the root of a source for a section. Has a .gitignore-style syntax:

* Blank lines are ignored.
* Lines starting with # are comments.
* Patterns without '/'s (e.g. *.mkv) match filenames in the same directory as the .plexignore file, or anywhere in the tree if .plexignore is in the root of the section.
* Patterns with '/'s (e.g. somedir/*) are treated like python-style globs and always match relative to the directory containing the .plexignore file.

Utils refactor consists of:
* Using os.path.split() to implement SplitPath() (which is slightly safer than string searches for delimiters)
* Adding JoinPath()
* Moving ContainsFile into Utils.py

Note: a lot of this path stuff would be unnecessary if there were some way to pass the path to the section source root explicitly to the Scanner. I worked around it, and it's not a huge deal either way, but it feels kind of ugly and like it's the wrong place for this logic. If you have some ideas for how I might do that, I'll give it a shot.