-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add feature to vote on tags (#240) #241
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1259,8 +1259,10 @@ def submit_tags(**kwargs): | |
"""Submit user tags. | ||
Takes parameters named e.g. 'artist_tags', 'recording_tags', etc., | ||
and of the form: | ||
{entity_id1: {tag1: vote, ...}, ...} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The documentation should be updated to say what the value of "vote" can be - "upvote", "downvote", or "withdraw". I wonder if it also makes sense to support alternate values for for this? Integers? 1, 0, -1? Booleans? True, False, None? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your comments. I will try to update this branch soon. And I need to check, if the code still works after all those years. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I improved the documentation now. Is it better now? For the time being, I would stick with the official values for a vote ("upvote", "downvote", "withdraw"). At the moment, I'm not convinced to include a logic to convert boolean of interger values to this specific strings. |
||
If you don't want to vote, you can use a list of tags instead: | ||
{entity_id1: [tag1, ...], ...} | ||
If you only have one tag for an entity you can use a string instead | ||
If you only have one tag for an entity, you can use a string instead | ||
of a list. | ||
|
||
The user's tags for each entity will be set to that list, adding or | ||
|
@@ -1269,7 +1271,7 @@ def submit_tags(**kwargs): | |
""" | ||
for k, v in kwargs.items(): | ||
for id, tags in v.items(): | ||
kwargs[k][id] = tags if isinstance(tags, list) else [tags] | ||
kwargs[k][id] = tags if isinstance(tags, (list, dict)) else [tags] | ||
|
||
query = mbxml.make_tag_request(**kwargs) | ||
return _do_mb_post("tag", query) | ||
|
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.
we should raise an error if the
vote
parameter isn't a valid valueThere 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.
I implemented a ValueError