Skip to content
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

Unifying (and fixing) removal of specific tags #611

Open
TJ-59 opened this issue Sep 23, 2023 · 0 comments
Open

Unifying (and fixing) removal of specific tags #611

TJ-59 opened this issue Sep 23, 2023 · 0 comments

Comments

@TJ-59
Copy link

TJ-59 commented Sep 23, 2023

So, basically, I noticed that (apparently, didn't test every possibility) whenever the tag itself is a string, entering an empty string removes that tag.
Example :

>>> somemp3.tag.album_artist
# None, hence no display, confirmed by
>>> type(somemp3.tag.album_artist)
<class 'NoneType'>
# and by 
>>> somemp3.tag.album_artist is None
True
>>> somemp3.tag.album_artist = "some dudes with instruments"
>>> somemp3.tag.album_artist
'some dudes with instruments'
>>> somemp3.tag.album_artist = ""
>>> somemp3.tag.album_artist
>>> somemp3.tag.album_artist is None
True

Note that trying
>>> somemp3.tag.album_artist = None
IS working for pure str tags like this one, but does NOT work and cause ERRORS for URL tags like artist_url and the rest of _url tags
(typically : AttributeError: 'NoneType' object has no attribute 'encode')

So, this can be "solved" by never using the "None" method, and always using the empty string method instead AFAIK,
BUT, some other types of tags do not have this ability, one that I found is the "BPM" tag.
Initially, it gives a None, as it is not yet set to any value.
Let's say you have a cat jumping on the keyboard, while you have some homemade tag editor using eyeD3, and the cat move the focus to the BPM entry (probably by tippy-tapping on TAB or something) and then sets a weird value (like 69420... which is high even for a hummingbird on coke) and finally press ENTER, which saves the changes (somemp3.tag.save()).
You're now having a mp3 with a set bpm tag of 69420, which isn't very fitting for the content, since it is some meditation track for yoga classes or some talk-show podcast with no BPM at all.
You can of course always set it to 0 (zero), but unlike the string tags with the empty string method, this does NOT remove that tag, meaning some mediaplayers will spend a few seconds showing you some irrelevant info about the bpm.
That bpm tag does not accept None as a value either, and no amount of tinkering from my part managed to get any result in removing that tag. I could of course remove everything by going initTag, but it's sort of a nuclear option and implies setting back everything else.

SO, for a TL;DR and question : Shouldn't tagname = None be some sort of accepted default method of removing ANY specific tag ?
Also, if anyone knows how to remove an int typed tag, please let me know, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant