From f324f8bc3886802a172fbc33641cf80c1f48f5c7 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 23 Sep 2012 11:58:43 +0200 Subject: [PATCH] add 'unexpected directories' warning --- pandoraclient | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pandoraclient b/pandoraclient index 33a492c..4856166 100755 --- a/pandoraclient +++ b/pandoraclient @@ -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' ] } }