add 'unexpected directories' warning

This commit is contained in:
rolux 2012-09-23 11:58:43 +02:00
parent 6fe330b0c4
commit f324f8bc38

View file

@ -79,6 +79,7 @@ def organize():
'non-canonical filenames': [],
'non-canonical filenames (target exists)': [],
'system files': [],
'unexpected directories': [],
'unexpected files': [],
'unknown extensions': []
}
@ -99,8 +100,9 @@ def organize():
if is_system_file(filename):
issues['system files'].append(path)
else:
# unexpected files
length = len(path.split('/'))
# unexpected files, unexpected directories
parts = path.split('/')
length = len(parts)
if length < 4:
issues['unexpected files'].append(path)
if length <= 4:
@ -114,6 +116,8 @@ def organize():
if not file['hash'] in files_by_hash:
files_by_hash[file['hash']] = []
files_by_hash[file['hash']].append(file)
elif not parts[3] in ['Extras', 'Versions']:
issues['unexpected direcories'].append(path)
if not dirnames and (not filenames or not filter(lambda x: not is_system_file(x), filenames)):
issues['empty directories'].append(relative_path)
@ -212,8 +216,10 @@ def organize():
keys = {
'automatic': {
'remove': [
'empty directories', 'system files',
'unexpected files', 'unknown extensions'
'empty directories',
'system files',
'unexpected files',
'unknown extensions'
],
'rename': [
'incorrect filenames',
@ -226,8 +232,11 @@ def organize():
'non-canonical filenames (target exists)'
],
'resolve': [
'duplicate files', 'missing subtitles',
'missing video', 'multiple versions'
'duplicate files',
'missing subtitles',
'missing video',
'multiple versions',
'unexpected directories'
]
}
}