-
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
Implement multi-value genres tag #5426
base: master
Are you sure you want to change the base?
Implement multi-value genres tag #5426
Conversation
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
4b84406
to
7ef0726
Compare
That makes sense, thanks for the clarification!
…On Friday, September 20, 2024, Rylee ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In test/test_library.py
<#5426 (comment)>:
> self._assert_dest(b"/base/Pop")
def test_first_skip(self):
- self.i.genres = "Pop; Rock; Classical Crossover"
- self._setf("%first{$genres,1,2}")
+ self.i.sub_genres = "Pop; Rock; Classical Crossover"
+ self._setf("%first{$sub_genres,1,2}")
The tests are testing the %first{} function extracting from a string
split on ; . Genres was the tag used for the tests initially, but now
genres is a MULTI_VALUE_DSV which is separated by null characters instead.
Rather than rewriting the tests both to the full
%first{text,count,skip,sep,join} format to specify the null character
separator, which would be changing whats being tested, the original author
just swapped out the genres tag for a nonexistent sub_genres tag which
would continue to work as a standard string for %first to act on.
—
Reply to this email directly, view it on GitHub
<#5426 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAACJFY5YIKQOCKXT67PTHLZXTKQRAVCNFSM6AAAAABOPR74YGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMJZGYZDIOBSHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Christopher Larson
***@***.***, ***@***.***
Principal Software Engineer, Embedded Linux Solutions, Siemens Digital
Industries Software
|
7ef0726
to
d4175f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice and tiny PR, thanks @ibrokemypie!
docs/changelog.rst
Outdated
@@ -20,6 +20,7 @@ New features: | |||
* :doc:`plugins/autobpm`: Add new configuration option ``beat_track_kwargs`` | |||
which enables adjusting keyword arguments supplied to librosa's | |||
``beat_track`` function call. | |||
* New multi-value `genres` tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand a bit here, maybe with an example that shows why it's useful? The point of such a tag should be made obvious to end users scrolling through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* New multi-value `genres` tag | |
* New multi-valued ``genres`` tag. This change brings up the ``genres`` tag to the same state as the ``*artists*`` multi-valued tags (see :bug:`4743` for details). | |
:bug: `5426` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bal-e In my initial version I even had "There is not much use-cases for this yet....", but I kicked it out again. You fine with a simple changelog like that?
@ibrokemypie have a look at my changelog suggestion and please rebase on-to master. To all involved (@kergoth, @snejus @bal-e), am I seeing right that this is minimal and can be safely merged? It probably is not of much use yet, but brings |
d4175f7
to
8f26241
Compare
Done and Done. |
Let me test this - I have a feeling this will suffer from the same issue like #5045 so we'd need one additional small change to address it |
Unfortunately this change is a bit less innocent than it may seem. From what I've this does not interact very well with the pre-existing
This fake change will always show up if genre in the file is not in line with This is the same issue as we've seen with other fields that @JOJ0 mentioned above. See issues below for more context
We've got a hack for this issue which synchronises values between the two fields, however it only does so when the item is re-imported / autotagged. Before then, genres in music files will get cleared on write. This makes me think we need a more appropriate solution here. I don't think we have a reason to keep both singular and plural fields in place (except for backwards-compatibility), and we've seen how much headache this has been causing us with other fields ( I want to keep a single source of truth (don't care whether it's named Does this need to have the |
Thanks for your detailed analysis @snejus I will read it later in detail. In my opinion a lot of headache is also caused because mediafile, i.e. on the lowest level
Would a change like this allow to save Hypothetically for now BUT if we see that it solves our problems, I would want to vote and investigate why a low-level "magic" ever was needed and if we can get rid of it. Even though it might be a breaking change, I honestly don't see the point anymore why beets should constantly work around this issue. Mediafile is used by a few other projects, well I actually only know of only one and we can get in contact. |
@JOJ0 the above encourages duplication, and I imagine it would suffer from the same issue since this way both |
I was thinking about something like this: #5606 |
That is true. It encourages believing genre and genres attribute is something different, which then it is not. Actually I tried to find out what the "official" name of the low-level tag is and it took me longer than I thought. Maybe I opened that draft idea over there only to "make my tagging 101 homework. Maybe something you didn't know yet in there, don't know...: beetbox/mediafile#81 (comment) And BTW maybe the code in the PR is also misleading, I kind of had the idea that maybe we can make 2 differnt tags with 2 differnt things....at least at the low-level. But that turns out to be not possible or useful anyway, since id3 only defines one tag for genre (actually content type) and that technical name is Anyway, not really helpful, will better read your code now! ;-) Thanks! |
a reason for removing the misleading genre field in mediafile entirely in my opinion. We can only read it? And not write to it? Is this because of beets or because of mediafile? At least the docstring of the mediafile function says something like "...can get and set the first item of the list...". beetbox/mediafile#81 (comment)
another reason to get rid of one of those fields in mediafile. It's just confusing useless (magic) in my opinion 🤣
See my linked comment again. I was wondering if this chosen separator has anything to do with the fact that id3v2.4 was the first (and it's still current) to define an actual "delimiter standard" for saving lists. |
Something else: To avoid confusion we should name it the same as it is in mediafile (if this is not a prerequisiste anyway?). There we have |
But after looking through your code in #5606.... Am I right that (so far) we write to a beets library field |
I think the way it's implemented in I think the issue is with the implementation on our side, where both singular and plural fields are used simultaneously which gave rise to the issues we had. We should use either one of them, preferably the plural version.
Indeed. We should just drop |
Regarding the delimiter, I tested a couple of them and 'anything goes' it seems, so we could make it configurable by the user methinks. |
Description
Resurrects #4751. Rebased just the genre field changes on to master.
"Adds support for setting the genre tag to be either a single or multi."
To Do
Documentation.(not required / no place to put this except the changelog)docs/changelog.rst
to the bottom of one of the lists near the top of the document.)