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

Plugin addition - Submit Folksonomy Tags #349

Merged
merged 8 commits into from May 11, 2023

Conversation

Viktini
Copy link
Contributor

@Viktini Viktini commented Apr 5, 2023

You may know me as Victini on MusicBrainz or Flaky on Discord.

Put briefly, this plugin lets users submit tags from their files as MusicBrainz' folksonomy tags. I've gone into more detail here: https://community.metabrainz.org/t/submit-folksonomy-tags-plugin-for-submitting-tags-to-musicbrainz-via-picard/626105

The only major bug I have with the plugin is that submitting after logging in from Picard's "to do this you must login" popup gives me an Unauthorised error (any subsequent submits are fine and of course, logging on before submitting), but Aerozol suggested on Discord that I should submit this anyhow and fix it later.

@Viktini
Copy link
Contributor Author

Viktini commented Apr 5, 2023

Only major issue is the complexity now. I should be able to work on that next week, if that's alright?

@rdswift
Copy link
Contributor

rdswift commented Apr 5, 2023

Only major issue is the complexity now. I should be able to work on that next week, if that's alright?

That should be fine. I don't think there's any need to rush. The current working version is available from your repository if anybody wants to try it out, so I suggest that you take whatever time you need. For what it's worth, I still have a tendency to include everything in the same function / module / method myself. I think it's because I've done way too much "linear" programming in the past, and haven't totally embraced the concepts of OOP. 😁

One final thing, and this is really minor... I appreciate the credit that you've provided in the comments in your code, but I noticed that you referred to 'rswift' rather than 'rdswift'. Like I said, really minor. 😉

@Viktini
Copy link
Contributor Author

Viktini commented Apr 5, 2023

Alright, thank you! :)

I've tested the plugin on Arch Linux (Python 3.10.10) / Picard 2.8.5 and all seems to be working just fine now. The complexity of the main function should still be sorted in the near future, but if there's no other problems I think it can be merged.

Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for submitting this. Overall looks good to me and I had already tested your plugin a while back. Only one suggestion to use metadata.getall instead of splitting tag values.

The complexity of the main function should still be sorted in the near future, but if there's no other problems I think it can be merged.

Agreed. Factoring out some code into separate functions should do the trick, but I'm fine with merging this as is for now.

plugins/submit_folksonomy_tags/__init__.py Outdated Show resolved Hide resolved
plugins/submit_folksonomy_tags/__init__.py Show resolved Hide resolved
plugins/submit_folksonomy_tags/__init__.py Outdated Show resolved Hide resolved
uses `xml.sax.saxutils` instead of `html` to provide XML escaping, and move said escaping into the function for generating XMLs instead of handling tags. I've also used `.getall()` for grabbing MBIDs as phw suggested.
@Viktini Viktini requested a review from phw April 21, 2023 15:46
@phw phw merged commit c03c7f1 into metabrainz:2.0 May 11, 2023
5 of 6 checks passed
@Viktini
Copy link
Contributor Author

Viktini commented Jun 21, 2023

I've started work on refactoring, and thus far I've managed to split the submission handler into different functions in a class. I'm using Radon as a way to check if I'm on the right track, will that pose an issue with Codacy?

FWIW, the initial functions I have have a complexity of 13 at the highest (Radon also says B-grade) right now.

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.

None yet

3 participants