Python id3 tag from containing folder
PodNova organizes podcasts by folder. the iPod organizes podcasts by album tag. If you use GtkPod to copy podcasts from PodNova, this can help keep mp3 podcasts categorized properly.
#!/usr/bin/python import sys # requires ID3 module, easily googled from ID3 import * for arg in sys.argv: fullfilename = arg # This only works for mp3 files, I would love suggestions for mp4 tags id3info = ID3(fullfilename) # Print command useful for logging. print id3info # Check if album info exists if not id3info.has_key('ALBUM'): print 'appending album tag' # truncate to just containing directory: folder = fullfilename[1:rfind(fullfilename,'/')] # define album based on podcast's directory album = (folder[rfind(folder,'/'):]).strip('/') id3info.album = album if id3info.album == album: print 'success!' else: print 'nothing to change'