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

Allow writing lists of bytes into M4A freeform tags #641

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KraXen72
Copy link

@KraXen72 KraXen72 commented Feb 6, 2024

when i wanted to write the ----:com.apple.iTunes:ARTISTS as a mutli-value tag, no matter what i tried, i got one of two errors:
if i used bytes, like for everything else, for example [b'EDEN', b'Leah Kelly'], it would tell me:

File "C:\Users\Nex\scoop\apps\python\current\Lib\site-packages\mutagen\mp4\__init__.py", line 825, in __render_text
    raise TypeError("%r not str" % v)
TypeError: b'EDEN' not str

even if i absolutely ensured it was a string all the way through my tagging code, it somehow got converted to bytes internally and threw this error, or a similar one, something along side bare string with no encoding. This small PR just allows the value to be already bytes, since it get's internally converted to bytes somewhere along the way.

i tested it by editing my local install of mutagen, and it writes tags correctly now.

@KraXen72
Copy link
Author

KraXen72 commented Feb 6, 2024

the tests are failing because it's testing for that specific error, however, i don't really see why it would cause a problem, so maybe that test can be altered/removed? please let me know if there is a way to write the multi-value m4a freeform tags.

if of any use, this is the tagger i'm currently writing/using. see files tagging.py>tagger_m4a() and metadata.py>get_mbids_for_song() how i'm doing it.
If there is a genuine way to do this without my PR, please provide a code example/modification of my code that you tried, because i've spent over 3 hours on this issue and patching that function was the only thing that solved it.

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

Successfully merging this pull request may close these issues.

1 participant