joalla/discogs_client

Add community related details to Release

Closed this issue · 1 comments

Discussed in #101

Originally posted by amoe June 9, 2022
Hi, great work on the client.

How could I retrieve the average rating?

For instance, this page shows the rating: https://www.discogs.com/master/1837544-Netsky-Second-Nature
Which is 4.6 as of this writing.

I'm also interested in how to fetch the number of users who have a master or release in their collection, does the API make this data available?

Following data is present in GET Release API point

"community": {
    "contributors": [
        {
            "resource_url": "https://api.discogs.com/users/memory",
            "username": "memory"
        },
        {
            "resource_url": "https://api.discogs.com/users/_80_",
            "username": "_80_"
        }
    ],
    "data_quality": "Correct",
    "have": 252,
    "rating": {
        "average": 3.42,
        "count": 45
    },
    "status": "Accepted",
    "submitter": {
        "resource_url": "https://api.discogs.com/users/memory",
        "username": "memory"
    },
    "want": 42
}

I think at least have, want and rating fields should be available through properties in Release object
Example.

>>> print(release.want)
>>> 42
>>> print(release.have)
>>> 252
>>> print(release.rating)
>>> <Rating avg 3.42>

Couldn't find a way to get this information for Master releases so this would be for releases only

@JOJ0

I'm thinking community should be an ObjectField in Release and then have everything under that.

community = release.community_details
num_of_wants = community.want
num_of_haves = community.have

rating = community.rating
num_of_ratings = rating.count
avg_rating = rating.average

Maybe we could then add rest of the fields as well, like submitter and contributors.
Not sure if data_quality or status are necessary but why not?

What do you think?