-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Continued retagging of the albumtype
field (and potentially other fields)
#4715
Comments
That's not entirely true. When beets does this rigmarole, it changes the file's timestamp, which will cause tools like Nextcloud to go through the whole procedure as if there's a whole new version of the file (Nextcloud, and WebDAV-based tools in general IIRC, do not allow incremental file updates.) |
Thanks a lot, important detail! I'll add that to the description later today!! |
A potential hacky fix could be to copy the albumtype from the file on disk to the tags to be written, so the comparison thinks all is well. Perhaps I'll give that a shot. EDIT: removed question about what files are affected: inspected mediafile code, conclusion: all files affected. Also changing proposed solution. |
Can confirm that solution fixes the issue. Is it the best solution? Hell if I know. Does it stop the continued retagging? Yes. E: Really, I think the best solution would be to make the code simply ignore the albumtype field in all cases where it would be trying to write to disk, not just this command, as well as not displaying the extraneous "changes" that would be patched out. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thank you @JOJ0 @judemille you were right about the issue with the release type. I did not update to GIT version, but only pulled the latest version from the Linux repo before. My apologies for not trying that :). That issue is fixed. With the release types corrected, now I do observe the issue with he albumtype.
and similar. Checking the file with ffmpeg for the tag still shows the old one, so it did not update the actual tag. |
I am running into a similar issue - it does not update the albumtype, even if reimported. |
I have the same issue. Knowing next to nothing about the code but after some debugging I think the problem lies in mediafile.py (version 0.12 = same as master):
When the albumtype tag is set correctly in this routine (to e.g., compilation) it gets immediately reverted back to album the next iteration of that loop which happen to set albumtypeS. My guess is that somehow mediafile overrides albumtype with the first entry of albumtypes again (by some operator overloading or such, haven't digged deeper yet). Albumtype is also defined lower down in mediafile.py as a single field of albumtypes, which I assume will be the first entry of albumtypes:['album', 'compilation'].
|
Reading some other issues, the cause might already been known :-) Is there any agreement on how to handle this? Just write albumtype as is, or check whether albumtype is in albumtypes? Both reading and writing. |
@ilmc888 I'd love to finally get to fixing this but I'm not yet sure what's the best way. If you feel like it help me brainstorm. The following ideas and I didn't check any of it in code:
Take everything with a grain of salt and double check. Probably I'm just thinking out loud, being too lazy to read code atm (other music coding things in mind right now ;-)) I'd love to get help with tackling that issue, it's been long due.... |
I might not be aware of all the intricacies yet, but I do understand that Musicbrainz has both albumtype and albumtypes information, but we can have only one tag 'MusicBrainz Album Type'? Does it make sense to take a look at Musicbrainz Picard and how that information is handled there (just tag one track and ffprobe it)? Those are their own tags after all: In general I would just think about how it will be used by music player. If albumtype tag can / would be a list (or we make an extra albumtypes tag; if this is even possible), will this actually be used by music players? I suspect not (yet), so this would not be really practically useful? On the other hand, I agree using the first entry of albumtypes might not be always informative (e.g., often just 'album' instead of 'live', 'compilation', etc.), so I understand why there was some logic included in beets to handle this. Still, I see this more as a flaw of Musicbrainz than anything else and wouldn't mind a one-on-one mapping ignoring albumtypes all together (until there is an accepted solution in the audio community). Including such logic will always be prone to errors (I believe I saw albumtypes of album / live / compilation / soundtrack, what would be the first one?). Actually not sure if there is extra logic to extract one type from albumtypes? Does MB expose the primary release type (or can we find how they do it in the Picard code?)?
Well this seems like a solution to make the albumtype useful, but wasn't the problem that with a beet update you would then have to compare it to the internal albumtypes data (using the same approach to extract it). Otherwise you get the infinite update / write loop. Or just ignore the whole albumtypes in the database. On beet import / mbsync, use the MB albumtypes to extract a useful albumtype for the database and write it to the tag field (ignore the MB albumtype itself). A subsequent beet update will just compare the albumtype one-on-one and thus does not need any change. This reply turned out longer than I expected, with likely a lot of (false) assumptions, but I hope it helps. |
I only had time to give it a brief look, so unsure if I'm looking at the right snippet but Here I see that releasetype, which is presumably written as a tag (see id3.py), is a concatenation of primary and secondary releasetypes. What would be the problem if beets is doing the exact same thing? And on beet update, if a MB id exist (or a albumtypes is in the DB) compare the MB albumtype tag, which is a list then (again, assumption Im making), to that same concatenation. |
@JOJ0 I'm probably overthinking things as it seems the only problem at the moment is writing the right tag to disk. In that case your solution will work fine. I think that change has to be in mediafile.py (?) as there a single album type is extracted from album types. However, what about just changing the order of album types when pulling the data from MB. Reorder it so the most important type is in front (compilation, live, ...) instead of just album. In that case mediafile.py will just work as is (I think it simply extracts the first element)? Other sources will also just work, and the change is contained within the MB code itself? |
@arogl you could try quickfixing your issue #5042 by following my ideas in above comment. I still think that (at least) part of the problem could be solved like this: #4715 (comment) So what I'm trying to say is: Try ignoring the (single) We won't loose the information since musicbrainz also provides a multi field called albumtypes (I'm not sure of the name that comes from the MB api!) which will then be handled by Even a dirty quickfix would help us to draft a proper PR at some point! |
albumtype
field.albumtype
field (and potentially other fields)
Sorry to jump in, but this is driving me crazy so I thought I'd try something to help. Lines 555 to 558 in 296f01b
Behaviour before:
Behaviour after:
So it fixes my infinite Based on Oh, and in both cases,
|
Thanks @celynw yeah it helps. I have something very similar in the queue, which basically just ignores albumtype and never uses it anywhere in beets in favor of albumtypes. It's coded finished but too busy to file the PR this week but hopefully during the next month. |
Some notes on a very high level for this issue:
Some of these issues I tried to address here: #5075 but I think that getting rid of |
After merging of #4582 there is a related issue remaining that was intentionally not addressed in that pull request.
We still see continued retagging of the
albumtype
(singular) field in certain cases.Note: This bug is not about the
['a', 'l', ...]
problem! This has been fixed in #4582 already! You might still have broken data in your database and thus see it. Follow this description to clean up your library: #4582 (comment)The problem
The MusicBrainz API provides
albumtypes
andalbumtype
separately, but beets tries to derive thealbumtype
when reading files as being the first element ofalbumtypes
. This can lead to the problem where beet write tries to modify the albumtype every time.If an album has multiple types the MusicBrainz API seems to indicate that one of those is the "primary" type, and beets stores that in the db as the
albumtype
, but parsing the ID3 tag of the file it seems like it just uses the first element ofalbumtypes
as thealbumtype
.Writing the
albumtype
of those files doesn't actually write the file's tag, sobeet write
will always report trying to write it. It will update the timestamp of the file though, which could confuse other tools, making them "think" the file received relevant changes.Reproduction of the problem
Timestamp of file is 10:34
$ ls -l "/Users/jojo/Music/dev-beets/Compilations/The Dark Side of Italo Disco/01 Body Heat (vocal).flac" -rw-r--r-- 1 jojo staff 46857531 Dec 19 10:34 /Users/jojo/Music/dev-beets/Compilations/The Dark Side of Italo Disco/01 Body Heat (vocal).flac
Albumtype file tag is
album / compilation
:which in reality is two values, each being set to a single tag:
Now writing shows changes but they only show a single value instead of both values:
The file's timestamp gets updated:
The file's tag is still the same,
beet write
shouldn't have bothered to update the file!Setup
My configuration (output of
beet config
) is:not relevant
Related iterations of this bug
We might have a related issue if not exactly the same issue with other multi-valued fields (
mb_albumartistids
, ...) that have a single representation of that same fieldmb_albumartistid
, ...). The logic inmediafile
is identical. A detailed report of a user is found here: #5045The text was updated successfully, but these errors were encountered: