I am trying to hash some mp3 files and store that hash value in the mp3's metadata. Is there a way that I can add a custom key/tag in the metadata other than the traditional tags of ['author', 'album', 'date']
?
Asked
Active
Viewed 668 times
1

Bob
- 741
- 2
- 9
- 18
-
Possible duplicate of [Create new ID3 tag using python and eyed3](https://stackoverflow.com/questions/31326789/create-new-id3-tag-using-python-and-eyed3) – chickity china chinese chicken Jul 19 '17 at 22:25
-
I was able to create a new tag using the code from the linked duplicate, and changing `file.tag.artist = u"MP3 Artist"` line to `file.tag.hash = u"
"` – chickity china chinese chicken Jul 19 '17 at 22:26 -
@downshift when I did `initTag()`, it wipes my existing tags, is there a way to do it without wiping my initial tags? – Bob Jul 19 '17 at 23:17
-
My apologies, appears the `initTag()` line is not required. Remove that line and it should keep the current tags' info. – chickity china chinese chicken Jul 20 '17 at 00:47
1 Answers
0
As mentioned in the comments, eyeD3 can do this. Custom key/tag works the same the other predefined key/tags. Choose a key/tag name, reference and assign it to your value.
import eyed3
audiofile = eyed3.load('audio_file.mp3')
# add your hash key/tag/value
audiofile.tag.hash = u"ec457d0a974c48d5685a7efa03d137dc8bbde7e3" # example value
print audiofile.tag.hash # ec457d0a974c48d5685a7efa03d137dc8bbde7e3
Confirm other metadata is intact:
print audiofile.tag.artist # e.g. Henry Reed
Hope this helps.

chickity china chinese chicken
- 7,709
- 2
- 20
- 49