How to add custom field - ID3 Popularimeter
- Dominant language
- Python
- Stars
- 120
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
I need to read/write the [ID3 Popularimeter tag](http://id3.org/id3v2.3.0#Popularimeter) within my app, specifically in the way that [Native Instruments Traktor](https://www.native-instruments.com/de/products/traktor/dj-software/traktor-pro-3/) 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:
```
$ mutagen-inspect tracks_api/tests/fixtures/popm.mp3
-- tracks_api/tests/fixtures/popm.mp3
- MPEG 1 layer 3, 32678 bps (VBR), 44100 Hz, 1 chn, 5.04 seconds (audio/mp3)
POPM=traktor@native-instruments.de=0 102/255
TSSE=Lavf57.83.100
```
So far I'm using pure mutagen in my app to do it:
```python
from mutagen.id3 import ID3
from mutagen.id3 import POPM
ID3_POPM = 'POPM'
class SimpleID3(ID3):
def __init__(self, filename):
super().__init__(filename)
@property
def rating(self):
rating = self.getall(ID3_POPM)
if rating:
rating = rating[0].rating
return int(rating / 51)
return None
@rating.setter
def rating(self, rating: int):
popm = POPM(email='traktor@native-instruments.de', rating=rating * 51, count=0)
self[ID3_POPM] = popm
```
How can I achieve something similar with mediafile, adding the popularimeter tag as a custom field?
Contributor guide
Research direction
Start with the sample file at tracks_api/tests/fixtures/popm.mp3 and inspect its POPM output using mutagen-inspect. Review how mediafile exposes custom fields, then define what read and write behavior is needed to match the Traktor popularimeter tag and verify it against the sample.】【。
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100