using python to modify file properties-->comments of non-mp3 files

Status
Not open for further replies.

grammalvsu

Beta member
Messages
2
ok, here's the situation. i want to tag the files on my hard drive. i was thinking it'd be best to use the "comments" box under file properties rather than tacking the tag onto the actual file name or using some media organizers own proprietary comment box (for flexibility sake)

for mp3s i can modify this field en masse w a variety of music tagging programs, no problem. but w non-mp3s i can't find a program that'll work. so i was thinking of using python, but the thing is that i have no idea where the comment information is stored in non-mp3s, and i can't find it even when i enter a string into the comments field manually, and then do a binary search for that string.

for example, if i manually enter "comments" into the comment field in an mp3, and then run the code below, i'll get the location of the comments in the file, which i can then rewrite if i want, or tack tags onto. but this only works for mp3s. for other files the string is not found. so where the heck is it stored?

import os, os.path
import string

def printFilesByExt( dir, ext ):
for root, dirnames, filenames in os.walk( dir ):
for fn in filenames:
if fn.endswith( ext ):
f = open(os.path.join( root, fn ), "r+")
loc=string.find(f.read(), 'comments--')
print loc
f.seek(loc+1,0)
f.write("testing")
f.close()

printFilesByExt('F:\dup6\dup5', '.mp3' )

any help would be greatly appreciated! thanks!
 
Status
Not open for further replies.
Back
Top Bottom