discogs / discogs_client

DEPRECATED - Official Python Client for the Discogs API
http://www.discogs.com/developers
Other
479 stars 132 forks source link

incorrect tracklist for versions with more than one side CD #105

Closed ExperimentalHypothesis closed 4 years ago

ExperimentalHypothesis commented 4 years ago

let us say i want to get a tracklist of this version of a release - https://www.discogs.com/Edward-Ka-Spel-Dream-Logik-Part-Two/master/277838 - works fine because it has only one side

but

let us say i want to get a tracklist of this version of a release which is double side LTD - https://www.discogs.com/Edward-Ka-Spel-Dream-Logik-Part-Two/release/1425757

it returns a buggy list with two more strings which ARE NOT TRACKS but names of each side.

Kalli commented 4 years ago

Those tracks are headings and should be indicated as such in the api response if you take a look at the track data.

For instance this code:

release = discogs_client.release(1425757)
for track in release.tracklist:
    print(track.title, track.data.get('type_', None))

Should print something like:

(u'Dream Logik Part Two', u'heading')
(u'As A Bird / A Missing Piece', u'track')
(u'Darkness O', u'track')
(u'The Modest Ambitions Of Cedric The Centipede', u'track')
(u'Under The Junction', u'track')
(u'Going My Way?', u'track')
(u"New Fool's Moon / The Closet", u'track')
(u'My Wandering Star / As A Bird (Part 2)', u'track')
(u'Burning Church', u'heading')
(u'Burning Church (Version Hot)', u'track')

You should be able to filter out the kinds of tracks you are looking from based on the data attribute of each track in the tracklist. More info about track types: https://support.discogs.com/hc/en-us/articles/360005055373-Database-Guidelines-12-Tracklisting#Index_Tracks_And_Headings

ExperimentalHypothesis commented 4 years ago

ha, ok, thank u.

it makes sense now. surely i can filter.. i did not not know that it is possible to get this info.. the documentation doesnt say much about it..

On Tue, Mar 17, 2020 at 4:19 PM Karl Tryggvason notifications@github.com wrote:

Those tracks are headings and should be indicated as such in the api response if you take a look at the track data.

For instance this code:

release = discogsclient.release(1425757)for track in release.tracklist: print(track.title, track.data.get('type', None))

Should print something like:

(u'Dream Logik Part Two', u'heading') (u'As A Bird / A Missing Piece', u'track') (u'Darkness O', u'track') (u'The Modest Ambitions Of Cedric The Centipede', u'track') (u'Under The Junction', u'track') (u'Going My Way?', u'track') (u"New Fool's Moon / The Closet", u'track') (u'My Wandering Star / As A Bird (Part 2)', u'track') (u'Burning Church', u'heading') (u'Burning Church (Version Hot)', u'track')

You should be able to filter out the kinds of tracks you are looking from based on the data attribute of each track in the tracklist. More info about track types:

https://support.discogs.com/hc/en-us/articles/360005055373-Database-Guidelines-12-Tracklisting#Index_Tracks_And_Headings

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/discogs/discogs_client/issues/105#issuecomment-600128674, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKWNGUGMTOS3GP65KYLNMTLRH6IGPANCNFSM4LJK4PLA .

Kalli commented 4 years ago

No problem and you are right, it could probably be documented a bit better. Closing this issue since that seems like the proposed solution will do the job for you.

ExperimentalHypothesis commented 4 years ago

sure, sure, u can close

btw, there is another thing that is not clear to me:

get all versions on a release

releases = d.search("Dream Logik Part Two", type="release")

give me all titles

for i in releases: print(i.title) Edward Ka-Spel - Dream Logik Part Two Edward Ka-Spel - Dream Logik Part Two Edward Ka-Spel - Dream Logik Parts One - Three Edward Ka-Spel - Dream Logik Parts One - Three Edward Ka-Spel - Dream Logik Parts One - Three Edward Ka-Spel - Dream Logik X (A Small Voyage In Three Parts) Edward Ka-Spel - Dream Logik X (A Small Voyage In Three Parts) Edward Ka-Spel - Dream Logik Part Two Edward Ka-Spel - Dream Logik Part Two Various - Mutant Sounds For Mutant People

how is it possible it prints BOTH artist and title and NOT JUST title? it is misleading, isnt it?

On Tue, Mar 17, 2020 at 5:14 PM Karl Tryggvason notifications@github.com wrote:

Closed #105 https://github.com/discogs/discogs_client/issues/105.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/discogs/discogs_client/issues/105#event-3138036298, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKWNGUCOBXBYZU4S6Q23RVLRH6OXFANCNFSM4LJK4PLA .

Kalli commented 4 years ago

Yeah, that I can see how that could be confusing. Haven't dug into it but think it might be because the search returns different objects than the release itself (see https://github.com/discogs/discogs_client/blob/master/discogs_client/models.py#L421)