gmusicapi
gmusicapi copied to clipboard
Support random mixes without creating a radio station
This implements random mixes for artists, albums, tracks, and genres. It is also possible to retreive artist-only mixes which is identified by a special seedType. Artist-related mixes use the seedType 3, whereas artist-only mixes use seedType 7.
During the development of this I identifed the seedTypes as follows: 1: My Music Track Related Mix 2: All Access Track Related Mix 3: Artist Related Mix 4: Album Related Mix 5: Genre Mix 6: I'm feeling lucky radio 7: Artist-only Mix
It seems that there is also seedType 8, but I don't know what this is.
Splitting up all kinds of mixes into separate client methods seemed to be more intuitive than using just one. What do you think?
Nice!
At first I was thinking we should match create_station's params, but since artist ids can be provided for more than one mix type it gets kind of messy.
Are all of these seeds valid for creating stations as well? If so, I'd prefer to have create_station and eg create_mix to take similar arguments.
I was also thinking of using just a single method for creating mixes using the same parameters as create_station(). But as I'm having two options for greating an artist mix (artist-only and artist-related) I run out of ideas.
Yes, you can use all these seeds for station creation as well. You can even use this artist-only seedType:7 together with an artist ID.
Hm. This might be a bit too c-influenced, but we could push the configuration into an object that encapsulates all these restrictions. eg:
conf = MixConfig(album='an-id) # ok
conf = MixConfig(artist='an-id', disallow_related=True) # ok, artist-exclusive. default would be artist-related
conf = MixConfig(artist='an-id', album='another-id') # raises an exception
...
mc.create_station(conf) # or mc.create_mix(conf)
We could also just throw all of this logic into the call itself, but I think it's probably smart to decouple it -- that'll make things more flexible to handle new seedtypes in the future.