Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » using python to modify file properties-->comments of non-mp3 files
Closed Thread
Old 08-07-2006, 03:53 AM   #1 (permalink)
 
Newb Techie

Join Date: Aug 2006

Posts: 2

grammalvsu

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

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!
grammalvsu is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On