-
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
Fetch work title from MusicBrainz #2452
Comments
maybe if a given performer has made several recordings of the same work, add the date of the recording. |
and if there is no performer or recording artist, use the release artist |
Ok, sounds intriguing! How would you propose to expose the "parent work" information? Would we just record the title, or other stuff too? Do you have ideas for the names of the fields that should hold this information? |
Hi! Thanks for your reply. I would say the title and the disambiguation (for example for arrangements like https://musicbrainz.org/work/51bb8773-8492-3773-ab88-73a89c922c3d ). The composer information would be saved on a different tag. |
OK, so just to summarize, you'd like to be able to access these fields in path templates, right?
|
Ideally, $parentwork_composer would be relevant. Practically, I expect it to always be the $composer but for the sake of completeness, if it doesn't include a lot of work, I would take it as well. |
Another question: is there a way to use sort names for artists (and therefore composers) with beets? |
OK, thanks. But just to be clear, If so, I'll make this ticket into a request to get the work title field. Then, as a second stage, we can consider doing the "parent work" thing to get copies of the relevant fields reflecting the parent work. Yes, we do fetch |
I never tried it out, but from what I can read on the conversation, yes. It even uses the "arranger" tag, which can be helpful as well. As I said, I'm new to beets, I'm just importing my collection right now. |
OK, cool. Marked this as a feature request for that first stage. |
Thanks! |
Hi! I have seen that you added "composer" as a field, could it be possible to also make a field "composer_sort" (and "arranger_sort" by the way) or does this field contain it already? |
Hi, @dosoe—that sounds like a separate feature request. Maybe it deserves a separate GitHub thread? |
Hi!
gives the title of the work
gives the title of the work the initial one is part of Now however when I try to do the same to get the parent work of parent_work_1, I get nothing: What seems to be happening is that beets is going on the page of the recording and takes out all the information he can out of this. In this case (https://musicbrainz.org/recording/546c4659-96c0-46ee-9b31-cfe3e78a1c48 for testing) it is: the work and the parent_work_1 and other tags such as composer etc. Now I don't know where and how you use the album_url and track_url functions to get to the actual recording infos but you probably do. Right now I'm going up the ladder of parent works by hand but once I get this working to rather do a 'while' loop to climb up to the top of the ladder, but only once I manage to do it this way. Other question: How can I submit a merge (for adding 'arranger_sort' and lyricist_sort' tags) while continuing to advance on this 'work' stuff? I also have some issues with the 'arranger' and 'lyricist' tags exposed in #2333 |
Hmm… to summarize, it sounds like you're interested in how to query the MusicBrainz web service for a specific work ID? For that, you go through the client library and use, for example, get_work_by_id. In general, you might want to read a little bit about the MusicBrainz Web service. For example, here's the URL for the recording you mentioned with its work relations included: About the other question: to submit a new PR, the thing to do is to put your work in a branch and push it to your fork. Then you can open several PRs at once; one for each branch. |
I will read about the MB web service, it sounds like it could answer some of my questions (but not today). About the other question: So the idea is that I have more than one fork of beets on my repo, right? |
Sure, a Furthermore, it would be something of a problem if we needed to issue a series of new MusicBrainz API requests to get the work data. Is it possible to pull all the information out of the No, there's no need to fork the repo twice—you can just create different branches within one git repository. (The GitHub help pages can be useful for this.) |
But can't we make a WorkInfo object and just not put it into the library? Just use it as a temporary variable. |
Sure! But I'd argue that you'd probably be better of with just a plain |
Yes, I would be very satisfied with that. |
Ok thanks to get_work_by_id I did the necessary to fetch the work title, the work disambiguation, the parent work title, the parent work disambiguation, the parent work composer name and the parent work composer sort name. However, I already have a pull request (#2563) so if I just push it on my repo it will be added as a commit to this one. Additionally, I only implemented the fetching part (in beet.autotag.mb.py) and not all the stuff around.
instead of
I guess there also should a 'parent_lyricist' and 'parent_lyricist_sort' tag, but that is easy and quick to do. If the work is not part of a bigger one, the parent_work is the work itself (same for all the 'parent_' tags) I will need more time to sort out how to choose the performer correctly. This calls the musicbrainzngs.get_work_by_id function multiple times, so there might be an issue because we can only go on the server once a second. |
Hmm; that's interesting! I notice that this seems to have gotten quite a bit more complicated. It seems like it would be a worthy goal to see if this can be done in a more generic way: that is, maybe we can write one function to get all the information for the "parent work," and then a separate function that pulls out all the work-related information from any work? Then, we can just join "parent_" onto the front of all the stuff from the parent work in one fell swoop, rather than needing to duplicate logic for every field. |
Most of this code (the while loop) only aims to find the parent work
Am 25.05.2017 7:16 nachm. schrieb "Adrian Sampson" <notifications@github.com
…:
Hmm; that's interesting! I notice that this seems to have gotten quite a
bit more complicated. It seems like it would be a worthy goal to see if
this can be done in a more generic way: that is, maybe we can write one
function to get all the information for the "parent work," and then a
separate function that pulls out all the work-related information from
*any* work? Then, we can just join "parent_" onto the front of all the
stuff from the parent work in one fell swoop, rather than needing to
duplicate logic for every field.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2452 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AYyAOHpUpJP6zvpa6HL3_QeE7l89nYCkks5r9bdigaJpZM4MKK9X>
.
|
And then you get all the info about it once you have it
Am 25.05.2017 9:20 nachm. schrieb "Dorian Soergel" <soergeldorian@gmail.com
…:
Most of this code (the while loop) only aims to find the parent work
Am 25.05.2017 7:16 nachm. schrieb "Adrian Sampson" <
***@***.***>:
> Hmm; that's interesting! I notice that this seems to have gotten quite a
> bit more complicated. It seems like it would be a worthy goal to see if
> this can be done in a more generic way: that is, maybe we can write one
> function to get all the information for the "parent work," and then a
> separate function that pulls out all the work-related information from
> *any* work? Then, we can just join "parent_" onto the front of all the
> stuff from the parent work in one fell swoop, rather than needing to
> duplicate logic for every field.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#2452 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AYyAOHpUpJP6zvpa6HL3_QeE7l89nYCkks5r9bdigaJpZM4MKK9X>
> .
>
|
So basically what is happening is the following: Once we have the parent work, we take its name, composer, composer_sort, lyricist, etc. The disambiguation needs a try/except syntax because some works don't have a disambiguation. The same way, only works with a parent have a work with a 'direction' tag in their work-relationships. It may be coded clumsily, but it works. Now there are two issues: |
Yeah, making a plugin would be a great way to make the extra queries optional and encapsulate the new code! It's actually fairly straightforward: the beets plugin system has an "import stage" API, where you can add arbitrary code to run on music that's been imported. So an easy way to get started would be to make a plugin that just runs this same code in an import stage, making calls into the Let me know if I can help more with pointing the way! |
Yes, I would appreciate that if you could help me to set it up. |
Sure! Here's the place to start: http://docs.beets.io/en/v1.4.3/dev/plugins.html Feel free to post questions along the way if anything comes up. |
Ok, now I have a start file using https://beets.readthedocs.io/en/v1.4.3/dev/plugins.html#add-path-format-functions-and-fields and the keyfinder plugin as a template. However, I don't know how to add a new tag: on the keyfinder plugin they just have a tag mapping and write it directly to the file, but that doesn't work for me. Additionally, I don't know how to tell him to do it also when importing and updating. |
here an updated version. It works (when I ask him to print the data, it is correct) , I just don't get how to write the tags into the library. I made a branch for it, but I would like to commit this stuff without modifying my other pull request #2563 . |
Cool! It looks like you're already adding the relevant information to the Item objects and calling store(), so I think that should be enough? |
I've only read this thread, not examined the code. I'm encourage to see effort to handle well tagging by composer and work title. From my knowledge of MusicBrainz, three things to be careful of:
It might be helpful to find examples of each of these in MusicBrainz, and include them in your unit test cases. Good luck with this plug-in! |
Hi! Thanks for your input. First, keep in mind that I am writing this script to handle classical music, because that's what my music is mainly composed of and that's where the composer and the work are important entities. |
Is there a reason |
Hi!
I'm new to beets. I have a big collection of classical music that is in the MB database.
For classical music a straightforward way of ordering it is to order it first by composer, then by work and then by performer.
MusicBrainz has a relation "recording of" that relates a recording to a work. A work can have a relation "part of" that refers either to another work or to a catalogue. So the works are organised as a tree with the work-work relation "part of" or "part" as a link.
Could it be possible with beets to "climb up" the tree, so that I can create a folder with the name of the "parent work" that contains the recordings of parts of the work?
As an example, if we look at this recording of the Matthäus-Passion of Bach: https://musicbrainz.org/release/51d08afb-0d81-4617-8c33-979806910ddf
there every recording has a tag "recording of" followed by a work. This work is on his side part of the work "Matthäus-Passion, BWV 244: Teil ?" which is part of the work "Matthäus-Passion, BWV 244" which is part of the catalogue "Bach-Werke-Verzeichnis" with the number BWV 244.
Could it be possible to go up the ladder to the uppermost work "Matthäus-Passion, BWV 244" and optionally (not every composer has a complete catalogue, and not every work on MB is linked appropriately to the corresponding catalogue) to the catalog number?
this would give:
Music/Bach, Johann Sebastian/Matthäus-Passion, BWV 244/Performer/St. Matthew Passion
(I choose sort names for artists, else I get stuck with russian, japanese and other names that I can't read for Suzuki, Prokofiev etc.)
and here the next problems appear: who do we choose as the performer? An obvious choice would be the recording artist, but this has 2 problems: in many cases, the recording artist is just the composer because noone updated it. In other cases, as in this release, the recording artist changes in every track, because the choir for example doesn't sing in every track. A solution might be to just list all performers linked to recordings in this album that are linked to the work. This seems to be the best solution to me. However, this doesn't work if we have, for example, a "best of" of the best performances of a given work, but that is pretty rare (even if I have an example in my collection). Maybe there is a better solution.
Is there a way to implement this into beets?
Dorian
The text was updated successfully, but these errors were encountered: