-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add custom field - ID3 Popularimeter #23
Comments
Hi! There is not a built-in extensibility mechanism in MediaFile, but it would be cool to add this field if you're interested. Have you tried extending MediaFile directly to add one more |
Yes it probably makes sense to add the field to the library as it's a standard ID3 field and also used by other Software.
From what I understand I have to add a new |
Yep! I see that the field seems to store a proportional value as a denormalized integer. A good place to start might be this existing storage style that deals with fixed-point storage: Lines 1417 to 1437 in b6b3520
Presumably, a similar thing for normalizing an integer should be similar but simpler. |
I think I know how to implement this now and just had a look how the mediafile tests are setup, to prepare a new PR with popularimeter-feature. Unfortunately, running the tests in Docker (and also on bare metal OSX), one test from current master branch fails with all Python versions:
The test fails while checking "bitdepth" attribute. To reproduce:
|
Aha; nice catch! This actually has nothing to do with your Docker setup; it's a dependency version thing. The root cause is a new feature in the latest version of Mutagen. The symptom is that the We should probably just bump our required Mutagen version and then change this line to give a value of 16 instead of 0 for that field: mediafile/test/test_mediafile.py Line 933 in b6b3520
|
Alright, good that I asked 😉 |
Good question---I worry a little that pinning dependency versions for (e.g.) CI will just move the problem somewhere else, when a dependent project notices breakage. (Because of the way Python manages dependencies, it’s nice to keep the “real” library dependency specs in setup.py as permissive as possible rather than pinning a specific version, as npm makes it safe to do.) But happy to add a requirements.txt just for faster Docker builds or whatever if you’re interested. |
I got the basic implementation working within my fork - changes I made: master...ifischer:master
This is how I can currently access the Popularimeter with my fork:
Let me know what you think of a behavior like this. |
This looks very interesting! |
I need to read/write the ID3 Popularimeter tag within my app, specifically in the way that Native Instruments Traktor writes them.
This is a sample file containing the tag as written by Traktor:
https://github.com/ifischer/django-tracks-api/raw/master/tracks_api/tests/fixtures/popm.mp3
This is how mutagen-inspect shows it on command line:
So far I'm using pure mutagen in my app to do it:
How can I achieve something similar with mediafile, adding the popularimeter tag as a custom field?
The text was updated successfully, but these errors were encountered: