def processFolder(curFold): innerFolds = findFolders(curFold) if len(innerFolds)>0: for inner in innerFolds: print inner for song in os.listdir(inner): song = inner + "/" + song song = song.replace("\\","/") tag = getTagInfo(song) fixTrackNo(song,tag["trackno"]) fixFilename(song,tag["artist"]) print if len(os.listdir(inner))==0: print "The folder \"" + inner + "\" will be removed." os.rmdir(inner)
def createBandList(root): fullTrackList = [] foldTracks = [] print "current folder:" for fold in os.listdir(root): print fold foldTrackList = [] for track in os.listdir(root + "/" + fold): trackInfo = getTagInfo(root + "/" + fold + "/" + track) try: foldTrackList.insert(0,trackInfo["artist"].lower()) except AttributeError: pass foldTracks.insert(0,foldTrackList) for foldList in foldTracks: for track in foldList: fullTrackList.insert(0,track) sortedList = list(set(fullTrackList)) #set removes duplicates, and converting it back to a list allows me to sort the results easily sortedList.sort() return sortedList
def copier(root,save,folder,track,copyBands,bandsToCopy,sort,songString,illegal): try: tagInfo = getTagInfo(root + "/" + folder + "/" + track) except TypeError, mess: print str(mess) + ". It will be skipped." tagInfo = None