OK Good to know, thanks. I have made a new ticket for the Wikidata UI here:
The next version of the wikidata.py plugin is out here:
If anyone wants to help test it out, just post back here with feedback. This version does some structural cleanup beyond the original version which was just mainly to get it working. This makes sure that all the data structures are cleaned up after each run, plus other stuff. Hopefully it will prove to be rock solid stable no matter how often its used or how long Picard runs. I had wanted to do this work in a separate ticket, but they wanted to get it into this same PR. Anyway, I am also testing & its working good so far. Once this is done, hopefully I can move on to the UI ticket.
I’m still using Picard 2.0.4, I haven’t ventured into the Dev version yet.
I didn’t clear the cache before I tested. I tried Soundtracks, compilations, and some music with non Latin characters. A portion of my test cases found nothing, and I verified that there were no genres associated with the wikidata entries.
I can find no problems.
@Pha3drus Thanks for your help testing. Update is the PR is merged, but the new code is still not available to the Picard app. It will show up on the next Picard update which is 2.1.
There was one issue I found in my testing which is when - in certain cases when the app can’t get a valid result from the MB API - it may populate the genre list with a subset of genres which it would. It’s pretty transparent to the end user, unless you are doing tracks which already have run through, in which case you might see a dropped genre. I may open a new ticket for this & for another potential cleanup improvement.
But first I will take a go a the UI here next - it should be pretty straightforward.
Thanks to @zas the website is updated now and with it the plugin list. You should be able to get the fixed plugin via the plugin update in Picard’s options
Confirmed. I just went in to the plugin options with my 2.04 Picard and saw a new button to upgrade the wikidata plugin from 1.1 to 1.2. Then I tested it & the log showed it was indeed updated. Thanks @Zas for accelerating this for us!
Update on the wikidata-genre UI work. I just submitted a new PR: https://github.com/metabrainz/picard-plugins/pull/194
If anyone wants to help test, just download these 3 files & place them in a folder called “wikidata” in your plugin folder, and remove all wikidata.zip and / or wikidata.py files from the plugin folder. On windows that destination folder would be like so:
If anyone has input on what you think default delimiter should be let me know. I don’t know if a change would be allowed or a good idea, but I noted Kodi uses " / " and many others use "; " or “;”. There is no standard, unfortunately. But usually better platforms like Kodi let you adjust the delimiter and if the default is changed, then it will mean updating the entire library for folks who already have been using "; ". So, for now I left it the same.
Very nice. I’m playing in Picard ver. dev3 right now, and it looks like it’s working. I have a couple of ideas / questions about the UI.
- Leave the Delimiter alone, or use whatever Picard uses. Having a different delimiter for one of the tags can cause some unexpected behavior in the media manager.
- A little bit of clarification on the “Use Work genres, when applicable” would be appreciated. I’m guessing this is “when present.” (Nit-picky, I know.)
The first run through picked up the Artist Genre with no problem. I enabled/disabled options, and now I can’t get the Artist genres to show up at all. I restarted Picard, and cleared the cache to no avail. Bug in Picard, or the link to Wikidata? Picard shows the plugin version for wikidata-genre as 1.3. Using “Open plugin folder” goes to the correct place, and WIndows does not report that the script files have changed. No evidence that the script is at fault.
And now, as I’ve been refreshing, trying different options, and comparing to what I find in “Lookup in Browser,” I’m all confused. It seems like it’s pulling genres from random places, I can’t figure out where the genres are coming from. I’m going to set this aside for a bit and approach it with fresh eyes again later.
Nothing is too nit-picky Thanks for the help testing. This will probably need to cook some so we can isolate any reproducible problems…
1.3 is the new version, yes. Regarding the Artist genre stopping showing up… I wonder if there is some inconsistency in the load /save (from / to) the config. If you switch back to wikidata 1.2 or less, does it resume using artist genre?
On the delimiters, I have noted your vote. I have a feeling that will be the prevailing preference too. But, of course prevailing or easy isn’t always the best for the long run, so I will keep the question open til we get more feedback.
On the work genres, I was thinking also to clarify that, but didn’t want to get too wordy. My idea is to make people aware that it is another genre source type, and that it isn’t used as often as the others. Honestly, I don’t really know how often, but I think its used more in conjunction with classical music or with larger album sets. Input welcome here.
I went through all the options and came up with these results in genres. I did this testing with this Release group; 884e595a-34a1-3931-a504-4a1cf2be75ab. (Fifty Gates Of Wisdom: Yemenite Songs. Ofra Haza). Wikidata link from following Picard “Lookup in browser,” and following “Wikidata” link on right side of the page. ().
The list of Genres found in Picard are in Quotes. I used Parentheses to separate what seems like the source of the genres listed in the description, and the Quoted text. Seems like something is pointing somewhere unintended.
- If I select only “Use Release Group genres,” I get the expected genre.
- If I select Artist Genres only, with “Use Artist genres only if no Release Group genres exist” unchecked, I get this list. It appears to be (Wikidata album genre), (Wikidata Artist genre in reverse order from wikidata page), (Repeat of Wikidata Artist genre in reverse order from wikidata page.)
(Folk Music;) (Folk Pop; Mizrahi Music; Pop-Folk; World Music;) (Folk Pop; Mizrahi Music; Pop-Folk; World Music; Pop Music)
- If I select “Use Artist genres,” and “Use Artist genres only if …” checked I get this list. It appears to be (Wikidata Artist genre in reverse order from wikidata page)
(Folk Pop; Mizrahi Music; Pop-Folk; World Music)
- If I select only “Use Work genres, when applicable,” I get the expected genre.
- If I select only “Use Release Group genres,” and “Use Artist genres,” with “Use Artist genres only if…,” I get only the Release Group genres.
- If I select only “Use Release Group genres,” and “Use Artist genres,” with “Use Artist genres only if…,” and “Use Work genres.” I get these results. Looks like the same as “Artist Genres” only. (Wikidata album genre), (Wikidata Artist genre in reverse order from wikidata page), (Repeat of Wikidata Artist genre in reverse order from wikidata page.)
(Folk Music;) (Folk Pop; Mizrahi Music; Pop-Folk; World Music;) (Folk Pop; Mizrahi Music; Pop-Folk; World Music; Pop Music)
I’m not even going to hazard a guess. I’ll just report what happened.
@zas This here is about Wikidata plugin, that should not be affected by this
@Pha3drus Just to make sure, the reported results are with the Wikidata genres plugin only, right? If not it makes most sense to disable Picard’s own genre feature and any other genre plugin (e.g. last.fm) so it does not interfere with the results here
“Use genres from MusicBrainz” under Metadata / Genres was and is not checked. I am not using the lastFM plugin. I ran through the plugins available in the dialog box, to recheck that I didn’t have anything that could cause issues, and noticed the “Sort Multi-Value Tags.” That one is also not enabled. Nothing in my Tagger script references genre. I don’t use a Naming script, and I never saved any of the tags during testing.
I can take a minute to go through the options with everything disabled, including scripting, if you think it would change anything. I didn’t strip it all down, because I didn’t see any settings that would interfere with the wikidata script.
Thanks again for taking the time to help test!
How do you mean? Do you mean quotes are showing inside of Picard in the genre field?
Note that since the 1.2 release, this plugin will sort genres alphabetically. This change was made due to the fact that they otherwise were in random order & would cause false positives for a change when it was just the order that was changing. So, the ordering you are seeing for artist genre here is by design.
From your description I assume the work genre here is the same as the release group genre which is “Folk Music”. So it looks like you are saying you are getting artist genre in certain cases when you don’t expect it - perhaps even duplicates - and then in case 2, you also got the release group genre when you shouldn’t have.
It would be strange to get duplicates because they are all done in the plugin as a Python “Set” construct which doesn’t allow duplicates. But, they are ultimately stored as a list which does allow duplicates, so if its appended to multiple times, that could explain it. I haven’t seen this in my testing, but with your information I will look out for this more carefully to see if I can reproduce it.
If you can post logs somewhere that may help too. If you do, make sure the debug level is set to DEBUG. Doing one case at a time with one log is the cleanest approach.
The list of genres in quotes was to explain how my post was structured. I added the parenthesis and quotes to make my report a bit clearer.
Makes sense, and explains the ordering.
The MusicBrainz Release shows a genre of “none.” The MusicBrainz Release Groups shows “club.” Wikidata for the release shows “folk music” as the only genre. The genre tags are consistent across all tracks on the album.
Case 2 gave me the initial “folk music” genre, and then the artist genres twice.
From what I see comparing the results to what the website shows, it looks like it’s creating the list twice, and returning them both.
I will certainly do this. I will re-create my initial tests, and find somewhere to post the logs with a link. (Debug gets pretty big.) I’ll also run this against some other albums and see what happens.
OK thanks. Might just hold off on further testing for now. I found 2 issues which I think may be causing some problems. Must have been the cold meds I was on on that first push. But one issue I have a fix for already, the other I am still trying to find the best approach. So hope to have a new commit to test soon.
EDIT: New commit is up. Only the
__init__.py file changes & its available here:
That fixed the duplication when only “use Artist Genre” is selected.
I’ll assume you don’t need the debug logs with this fix. I’ll run through some other albums and see what happens.
EDIT: I got ahead of myself.
I was all set to run and play, but I tried using all options, and I only get the genre from the Wkidata album. I also notice that the first track is getting an additional genre, and I can’t quite figure out the source. I’m guessing that since I’m including “work” genres, I’m just missing something. I’ll poke at it a little bit so I understand.
If your case had no work genre, then this would be the expected result. If you did have a work genre (which was different from the release group genre) then this would be an issue. I haven’t tested a lot of work genres yet myself.
Once this is working right, another idea I had was to make it possible to be able to exempt certain artists from pulling their genres. This because I noticed in many cases, the artist genres are quite appropriate & helpful, but for certain artists - they just cover a lot more genres, which may not match a track in question. This way, one could keep the artist genres coming in for most cases and leave out just the undesirables. Could make a text field akin to the “Ignore these genres” field for this, perhaps.
But yeah for any new or unresolved issues just let me know. Thanks for the continued support.
Next commit is up now… this adds to the last commit the ability to exclude certain artists from the artist genre -pull
I have tested excluding artist and it seems to work fine.
Keep up the good work.