Python 写入数据到MP3文件中,pythonmp3,[Python]代码wr
Python 写入数据到MP3文件中,pythonmp3,[Python]代码wr
[Python]代码
writeMp3Header = { "SongName":"", "SongPeople":"", "ZhuanJi":"", "Year":"", "Bak":"" } def setMp3Header(mp3file): mp3Id3V1 = { "SongName":-125, "SongPeople":-95, "ZhuanJi":-65, "Year":-35, "Bak":-31 } tags = ['SongName','SongPeople','ZhuanJi','Bak'] f = open(mp3file,'r+') try: f.seek(-128,2) try: tempstr = f.read(3) if tempstr == 'TAG': for tag,startPos in mp3Id3V1.items(): if writeMp3Header[tag] != '': f.seek(startPos,2) if tag in tags: if len(writeMp3Header[tag]) > 30: f.write(writeMp3Header[tag][:30]) else: f.write(writeMp3Header[tag]) print startPos,tag,writeMp3Header[tag] else: print 'is not a mp3file' except IOError: print 'read error' finally: f.close()
相关内容
- Python 分割文件以及合并文件,python分割,[Python]代码#!
- Python 调用默认浏览器,python调用浏览器,[Python]代码im
- Python 获取中央电视台的节目单,python节目单,[Python]代码
- python shelve模块,pythonshelve,[Python]代码de
- Python anydbm模块,pythonanydbm模块,[Python]代码im
- Python CET查分,pythoncet查分,[Python]代码#!
- Django-缓存机制详解,django-机制详解,1.设定缓存 缓存选
- PycURL 实现POST方法,pycurl实现post,[Python]代码im
- PycURL 自动处理cookie,PycURL处理cookie,[Python]代码im
- Python 使用xlrd读取Excel格式文件,pythonxlrd,[Python]代码i
评论关闭