simon-weber / gmusicapi

An unofficial client library for Google Music.
https://unofficial-google-music-api.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.48k stars 257 forks source link

Support creating instant mixes #45

Open ghost opened 12 years ago

ghost commented 12 years ago

Hi, Is it possible to add functionality for getting the Instant Mixes that Google throws together? I don't mind writing it myself, but I was just wondering if you knew the particular call of the top of your head or something.

Charles

simon-weber commented 12 years ago

Off the top of my head, I think it's just a single call. I don't remember what exactly, though. Pull requests are always welcome!

danielmj commented 11 years ago

I too would love this call if you can find it! This is the one piece that im missing.

simon-weber commented 11 years ago

Sure thing; I'll look into it.

simon-weber commented 11 years ago

Sorry for the delay!

The call is made to services/getmixentries and looks like:

[["<newstyle session id>",1],[[["<song id>",null,1,[],[]]]]]

the response is totally gross, and seems to include song dictionary information, eg:

[[0]
,[[[["<requested song id>",["","",,,,,,,,,,,,0,,,,,,,,1,0,-1,0,0]
,1,[]
,[]
]
,[["55e3f0ab-5bac-33c4-8b97-e249cc34f68c","Empty","//lh4.googleusercontent.com/K010mLNMkp5O_nPFYFlOfZ4vj5qTbK-WgpqVdxchGM58xDrMNl2KV0MMZhzzVA","Anathema","Alternative 4","","empty","anathema","alternative 4","","","Metal","metal",178984,3,14,1,1,1998,0,,,0,0,1361551889038581,1361999919506480,,,"Tzdwbkhcuvxx4kiiwrpsbcftctm",6,"",,,"A2bajq3munahcdk3imjx3ozow64",256,1361551927496000]
,["00816850-42dc-32ca-b1d2-e628f246edb6","Destiny","//lh4.googleusercontent.com/K010mLNMkp5O_nPFYFlOfZ4vj5qTbK-WgpqVdxchGM58xDrMNl2KV0MMZhzzVA","Anathema","Alternative 4","","destiny","anathema","alternative 4","","","Metal","metal",131950,10,14,1,1,1998,0,,,0,0,1361550760940101,1361678466297239,,,"Tvnrtx54rw62ttivl6wwchg2p2y",6,"",,,"A2bajq3munahcdk3imjx3ozow64",321,1361550760939000]
,["45f4551a-151d-311d-8ef8-4a118c7c26ec","Shroud of False","//lh3.googleusercontent.com/ybp5z7Ij3QK4keTXpT-wqeV17yBdCZHDFwhuP-zGTERyxamga3Z911qcFzsp","Anathema","Alternative 4","Anathema","shroud of false","anathema","alternative 4","anathema","","Metal","metal",96803,1,14,1,1,1998,0,,,0,0,1361574609659231,1361678822612695,,,"Tiv7yqfjda6at7gwn3rvd2rxzpy",2,"",,,"A2bajq3munahcdk3imjx3ozow64",256,1361574665145000]
]
]
]
]
]

I've seen a lot of requests/responses that look like this recently. It seems like a trend away from user-readable json objects and towards structs; this could makes things a lot more annoying for us.

I'll probably expose this with something like api.get_related_songs(song_id) and return a list of song ids.

danielmj commented 11 years ago

Thanks Simon! Your awesome! I am anxious to see the implementation! Confused however, what is "newstyle session id"? Will this be included in the doumentation somewhere?

simon-weber commented 11 years ago

It pops up in most of the calls now, but doesn't seem to be required (yet).

I haven't figured out how it's generated, but it doesn't seem to come from the server.

askvictor commented 10 years ago

Correct me if I'm wrong, but a quick test seemed to show that create_station creates an instant mix based on the seed track/album/artist. I just tried it without and AA subscription and it returned songs only in my library.

simon-weber commented 10 years ago

Oh, cool; thanks for bringing it to my attention.

As a heads up, I don't have a lot of time this week, but I can probably dig into this over the weekend.

simon-weber commented 10 years ago

Whew, this is an old issue! This will be handled by #263 when it lands.