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

Add join attribute to Artist class and #118

Merged
merged 3 commits into from
Sep 29, 2022
Merged

Add join attribute to Artist class and #118

merged 3 commits into from
Sep 29, 2022

Conversation

JOJ0
Copy link
Contributor

@JOJ0 JOJ0 commented Sep 26, 2022

document it via autodoc autoattribute (#:).

Also fixes/unclutters all the other (child)classes in models.py by adding empty autoattribute comments.

@JOJ0
Copy link
Contributor Author

JOJ0 commented Sep 26, 2022

Besides adding a new field to Artist objects, this PR should fix our cluttered Sphinx doc of models.py once and for all.

@prcutler suggestions for improving my wording of the new "join" attribute are very welcome :-)

@AnssiAhola In case you know by heart: See the FIXME in my commit. Could an Artist in the artists list of a Track object also contain the "join" information?

One issues with documenting via autoattribute (#: comments) I can't figure out or mabe it's even just not possible: How to put links to other objects within these comments. Eg. here (from my previous PR) I tried to mark that I'm talking about another object but it's not a link, just text: https://python3-discogs-client.readthedocs.io/en/latest/discogs_client.html#discogs_client.models.Release.artists

Copy link
Contributor

@prcutler prcutler left a comment

Choose a reason for hiding this comment

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

I think using join is fine - you could use combine, too. I would remove the quotes from join as its the right word.

I'm trying to re-write the second sentence. What does this refer to? The first result?

first of the artists does contain
    #: a keyword like 

@AnssiAhola
Copy link
Contributor

In case you know by heart: See the FIXME in my commit. Could an Artist in the artists list of a Track object also contain the "join" information?

Tried to look into this a bit and I don't think the artists field is ever populated. Only the credits/extraartists field is and that does seem to contain artists with the join field as well

@JOJ0
Copy link
Contributor Author

JOJ0 commented Sep 26, 2022

I'm trying to re-write the second sentence. What does this refer to? The first result?


first of the artists does contain

    #: a keyword like 

only the first Artist object in the artist list does contain the join keyword.

This is the release we are talking about: https://www.discogs.com/release/21846394-Vinylgroover-Feat-MC-Freestyle-Bassface

Here you see a json snippet, only the first artist has a populated "join" field/attribute/? (what's the term for that in original json speak? was it object? not sure, anyway, we should talk Python speak in our docs): beetbox/beets#4401 (comment)

So in case of an release that has 2 artists as in the example json abopve, this is a list containing 2 Artist objects: https://python3-discogs-client.readthedocs.io/en/latest/discogs_client.html#discogs_client.models.Release.artists
and only the first one will have the "join" attribute populated, on the other it will be None

@JOJ0
Copy link
Contributor Author

JOJ0 commented Sep 27, 2022

In case you know by heart: See the FIXME in my commit. Could an Artist in the artists list of a Track object also contain the "join" information?

Tried to look into this a bit and I don't think the artists field is ever populated. Only the credits/extraartists field is and that does seem to contain artists with the join field as well

Thanks for digging in Anssi!

I took the example from the beets issue again and had a look in the original api response, looks like that (really just 1 track on that record):

 "tracklist": [
    {"position": "1", "type_": "track", "title": "Bassface", "duration": "5:12"}
],
"extraartists": [
    {"name": "MC Freestyle", "anv": "", "join": "", "role": "Featuring", "tracks": "", "id": 336113, "resource_url": "https://api.discogs.com/artists/336113"}
],

So the track doesn't contain the field at all as you found out but extraartists does, in that case since the MC is not the "first artist" it doesn't have the "Feat" keyword but has a role of "Featuring", also interesting...

But I guess that's something to think about in another PR, now I'll concentrate on getting the Artist object documented correctly. Thanks again!

@JOJ0
Copy link
Contributor Author

JOJ0 commented Sep 27, 2022

@prcutler what you think about this slightly changed version:

    #: This attribute is only populated when an ``Artist`` object is requested
    #: via the ``artists`` list of a ``Release`` object, and if it is a
    #: multi-artist release. Usually only the first ``Artist`` object in the ``artists`` list does contain
    #: a keyword like  "And", "Feat", "Vs", or similar. This keyword could be used to combine artists
    #: together into a single string like eg. "DJ ABC Feat MC Z". Also check out the artists_sort attribute
    #: of a ``Release`` object.

@prcutler
Copy link
Contributor

I think that's a lot better! A couple small changes to make it easier to read and for translating (removing e.g.)

    #: This attribute is only populated when an ``Artist`` object is requested
    #: via the ``artists`` list of a ``Release`` object, and if it is a
    #: multi-artist release. Usually only the first ``Artist`` object in the ``artists`` list contains
    #: a keyword such as  "And", "Feat", "Vs", or similar. This keyword could be used to combine artists
    #: together into a single string, for example: "DJ ABC Feat MC Z". Also check out the artists_sort attribute
    #: of a ``Release`` object.

One question: Should artists_sort be wrapped in `` ?

Thanks!

document it via autodoc autoattribute (#:).

This commit also fixes/unclutters all the other (child)classes in models.py by
adding empty autoattribute comments.
@JOJ0 JOJ0 force-pushed the artist_join_unclutter branch from 4ce9791 to 7fead3d Compare September 29, 2022 06:40
@JOJ0
Copy link
Contributor Author

JOJ0 commented Sep 29, 2022

@prcutler fixed as suggested. Thanks a lot! :-) Please accept the change, I'll merge then. Thanks!

@prcutler prcutler self-requested a review September 29, 2022 10:55
@prcutler
Copy link
Contributor

Done! Looks good and thanks!

@JOJ0 JOJ0 merged commit c6111e3 into master Sep 29, 2022
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.

3 participants