from ID3 import * import os, sys, readline # 2008-04-06 # batch mp3 id3, altere o id3 dos seus arquivos .mp3 com agilidade :) # Author: Alisson Sales # http://alisson.zusee.com/ # http://alisson.zusee.com/blog mp3s = [] last_artist = '' last_album = '' for root, dirs, files in os.walk(os.getcwd()): mp3s.extend([os.path.join(root, file) for file in files if os.path.splitext(file)[1] == '.mp3']) mp3s.sort() for mp3 in mp3s: id3info = ID3(mp3) print(os.path.basename(mp3)) try: new_title = raw_input('\tTitle: [%s] (type enter to keep it): ' % id3info.title) if (last_artist): new_artist = raw_input('\tArtist: [%s] (type enter to keep it, - to last artist entered "%s"): ' % (id3info.album, last_artist)) else: new_artist = raw_input('\tArtist: [%s] (type enter to keep it): ' % id3info.artist) if (last_album): new_album = raw_input('\tAlbum: [%s] (type enter to keep it, - to last album entered "%s"): ' % (id3info.album, last_album)) else: new_album = raw_input('\tAlbum: [%s] (type enter to keep it): ' % id3info.album) if id3info.track: new_track_number = raw_input('\tTrack #: [%s] (type enter to keep it): ' % id3info.track) else: new_track_number = raw_input('\tTrack #: [] (type enter to keep it): ') except KeyboardInterrupt: print('\n\nApplication halted by the user\n') sys.exit() if (new_title): id3info['TITLE'] = new_title if (new_artist): if (new_artist == '-' and last_artist): id3info['ARTIST'] = last_artist else: id3info['ARTIST'] = new_artist last_artist = new_artist if (new_album): if (new_album == '-' and last_album): id3info['ALBUM'] = last_album else: id3info['ALBUM'] = new_album last_album = new_album if (new_track_number): id3info['TRACKNUMBER'] = new_track_number print('')