Add advanced option to ignore folder patterns (#2037).

Applies to post processing folders and library scan folders. There is no configuration option in the web interface (yet), but one can specify the following in the INI file (make sure Headphones is shut down!).

[Advances]
...
ignored_folders = *.git, *.btsync
...
This commit is contained in:
Bas Stottelaar
2014-12-06 13:24:57 +01:00
parent eb49d303ad
commit ce296e691b
4 changed files with 50 additions and 17 deletions
+13 -1
View File
@@ -1078,10 +1078,22 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None):
else:
folders.append(path_to_folder)
# Scan for ignored folders. A copy of the list is taken because the original
# list is modified and list comprehensions don't work because of logging.
patterns = headphones.CONFIG.IGNORED_FOLDERS
ignored = 0
for folder in folders[:]:
if helpers.path_match_patterns(folder, patterns):
logger.debug("Folder ignored by pattern: %s", folder)
folders.remove(folder)
ignored += 1
# Log number of folders
if folders:
logger.info('Found %i folders to process.', len(folders))
logger.debug('Expanded post processing folders: %s', folders)
logger.info('Found %d folders to process (%d ignored).',
len(folders), ignored)
else:
logger.info('Found no folders to process. Aborting.')
return