alastair / python-musicbrainzngs

Python bindings for Musicbrainz' NGS webservice
http://python-musicbrainzngs.readthedocs.io/
Other
274 stars 105 forks source link

Tag voting #240

Open alastair opened 6 years ago

alastair commented 6 years ago

We should add the ability to vote for tags as well as the currently behaviour of just replacing all tags. This means that users can add new tags without first having to retrieve all of their existing tags.

As per https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#tags

Our tag functionality includes the ability to upvote and downvote tags. This terminology can be confusing. Whenever you tag something, you are in fact "upvoting" it (which will add 1 to the vote count for the tag). Downvoting is the inverse operation, and will subtract 1 from the tag's vote count. Tags that you downvote will be hidden from the UI for you (and if their total vote count drops to 0 or below, they'll be hidden for everyone). The "user-tag" elements can include a "vote" attribute that specifies what action you want to take:

<user-tag vote="upvote"><name>noise</name></user-tag>
<user-tag vote="downvote"><name>pop</name></user-tag>
<user-tag vote="withdraw"><name>rock</name></user-tag>

The "withdraw" vote will remove any upvote or downvote that you previously added (as if you had never voted).

If you do not supply any "vote" attributes in your request (as in the example above), then the list of tags you submit will be treated as upvotes and will completely replace all existing upvoted tags you have on that entity. (So, tags that are not included in the request will be withdrawn, if they were previously upvoted. Downvoted tags are left in place.) This is a legacy behavior that we maintain from before we had tag voting. Including any "vote" attribute in the request will cause it to only apply those votes that you specified.

gorgobacka commented 6 years ago

I already started to implement this and a PR is on the way.