Permalink
Browse files

Removed old code that will be replaced by new and improved fuzzy matc…

…hing. Split fuzzy matching tasks into artist (level 1) and album (level 2) tasks. This requires artist/album/ folder structure beneath root directory.
  • Loading branch information...
1 parent b7fa921 commit 2c5db2ab3260878e18f6db0d826eb907e65d25b3 @MusikPolice committed Jul 15, 2012
Showing with 23 additions and 17 deletions.
  1. +23 −17 app.py
View
@@ -46,7 +46,7 @@ def like(string1, string2):
# a new approach that pre-computes the merges
# dirsToCompare - a fully-qualified list of directories that should be compared to one another in a search for duplicates.
-def CombineSimilarlyNamedFolders2(dirsToCompare):
+def CombineSimilarlyNamedFolders(dirsToCompare):
# append trailing slashes to dirs
# TODO: maybe also check for non-existent dirs here
@@ -263,33 +263,39 @@ def DeleteEmptyDirectories():
while True:
print('')
print ('Select an action to perform:')
- print ('1. Combine Similarly Named Folders')
- print ('2. Rename Folders That Contain Non-Alphanumeric Characters')
- print ('3. Delete Unwanted File Types')
- print ('4. Delete Empty Directories')
- print ('5. Quit')
+ print ('1. Combine Artist Folders (level 1)')
+ print ('2. Combine Album Folders (level 2)')
+ print ('3. Rename Folders That Contain Non-Alphanumeric Characters')
+ print ('4. Delete Unwanted File Types')
+ print ('5. Delete Empty Directories')
+ print ('6. Quit')
action = raw_input('>')
if action == '1':
- if not rootDir.endswith('/'): rootDir = rootDir + '/'
- print ('Searching ' + rootDir + ' for similarly named folders...')
+ if not startingDir.endswith('/'): startingDir = startingDir + '/'
+ print ('Searching ' + startingDir + ' for similarly named artists...')
- artistDirectories = os.listdir(rootDir)
+ artistDirectories = os.listdir(startingDir)
artistDirectories.sort()
- CombineSimilarlyNamedFolders2(artistDirectories)
+ CombineSimilarlyNamedFolders(artistDirectories)
- artistDirectories = os.listdir(rootDir)
+ if action == '2':
+ if not startingDir.endswith('/'): startingDir = startingDir + '/'
+ print ('Searching ' + startingDir + ' for similarly named albums...')
+ artistDirectories = os.listdir(startingDir)
artistDirectories.sort()
albumDirectories = []
for a in artistDirectories:
- albumDirectories.append(os.listdir(a))
- CombineSimilarlyNamedFolders2(albumDirectories)
+ for sub in os.listdir(startingDir + a):
+ albumDirectories.append(a + '/' + sub + '/')
+ albumDirectories.sort()
+ CombineSimilarlyNamedFolders(albumDirectories)
- elif action == '2':
- RenameFoldersNonAlphanumericRecursive(startingDir)
elif action == '3':
- DeleteUnwantedFileTypes()
+ RenameFoldersNonAlphanumericRecursive(startingDir)
elif action == '4':
- DeleteEmptyDirectories()
+ DeleteUnwantedFileTypes()
elif action == '5':
+ DeleteEmptyDirectories()
+ elif action == '6':
break

0 comments on commit 2c5db2a

Please sign in to comment.