sendEmail("audio conversion error (" + sys.exc_info()[0].__name__ + ")",genErrorPrintout()) def sendCompletionEmail(): sendEmail("audio conversion complete") def findSongs(path,listOfSongs = []): for fold in os.listdir(path): try: open(path + "/" + fold) listOfSongs.append(path + "/" + fold) except IOError, mess: if mess[0]==13: findSongs(path + "/" + fold,listOfSongs) else: raise return listOfSongs sourceFold = "C:/My Music/iMesh" destFold = "C:/Documents and Settings/Owner.YOUR-45F4F212AB/My Crap/converted music" print "To terminate this program, hit Ctrl+C" try: auto = Automate() songList = findSongs(sourceFold) for song in songList: tag = ASF(song) auto.automateConversion(song,destFold,unicode(tag["Author"][0]).strip(),unicode(tag["Title"][0]).strip(),unicode(tag["WM/AlbumTitle"][0]).strip(),unicode(tag["WM/TrackNumber"][0]).strip(),tag.info.length) closeWinamp() sendCompletionEmail() except: sendErrorEmail()
for fold in os.listdir(path): try: open(path + "/" + fold) listOfSongs.append(path + "/" + fold) except IOError, mess: if mess[0]==13: findSongs(path + "/" + fold,listOfSongs) else: raise return listOfSongs audacityPath, winampPath = load() sourceFold = raw_input("Please enter the folder containing the audio files: ") destFold = raw_input("Please enter the folder you wish for the converted files to be put in: ") destFold = destFold.replace("\\","/") checkDest(destFold) print audacity = progLoc(audacityPath,"Audacity","audacity.exe") print winamp = progLoc(winampPath,"Winamp","winamp.exe") print save(audacity,winamp) delete = raw_input("Would you like to delete each track after conversion?(y/n): ")=="y" auto = Automate(audacity,winamp) allSongs = findSongs(sourceFold) for song in allSongs: tagInfo = get_info(song) auto.automateConversion(song,destFold,tagInfo["artist"],tagInfo["title"],tagInfo["album"],tagInfo["track"],tagInfo["length"],delete)