Closed jozefKruszynski closed 11 months ago
@jozefKruszynski Thanks for the PR. Can this be moved from draft or is more work needed on it?
I left it as a draft, as I was hoping for some feedback on the code. I'll remove the draft as, I guess you'll be checking the code anyway.
I'll fix the conflict later this evening, as I'm at work at the moment
@jozefKruszynski Looks like the typing additions I just merged resulted in new conflicts. Sorry!
Having a hard time getting my changes to work as they did previously. I think I'm losing my mind
Realised I had completely overcomplicated the whole thing. I have pushed a much simplified version
@jozefKruszynski
A sidenote, after looking more into the tidal2 plugin for KODI, I noticed that there are a few endpoints that use the V2 API
def get_followers(self, user_id, offset=0, limit=500):
return self._map_request_v2('profiles/%s/followers' % user_id, params={'deviceType': 'BROWSER'}, ret='userprofiles')
def get_following_users(self, user_id, offset=0, limit=500):
return self._map_request_v2('profiles/%s/following' % user_id, params={'includeOnly': 'USER', 'deviceType': 'BROWSER'}, ret='userprofiles')
def get_following_artists(self, user_id, offset=0, limit=500):
return self._map_request_v2('profiles/%s/following' % user_id, params={'includeOnly': 'ARTIST', 'deviceType': 'BROWSER'}, ret='artists')
def get_public_playlists(self, user_id, offset=0, limit=50):
return self._map_request_v2('user-playlists/%s/public' % user_id, params={'offset': offset, 'limit': limit}, ret='playlists')
Works as expected and tests pass. Merged!
@jozefKruszynski
A sidenote, after looking more into the tidal2 plugin for KODI, I noticed that there are a few endpoints that use the V2 API
def get_followers(self, user_id, offset=0, limit=500): return self._map_request_v2('profiles/%s/followers' % user_id, params={'deviceType': 'BROWSER'}, ret='userprofiles') def get_following_users(self, user_id, offset=0, limit=500): return self._map_request_v2('profiles/%s/following' % user_id, params={'includeOnly': 'USER', 'deviceType': 'BROWSER'}, ret='userprofiles') def get_following_artists(self, user_id, offset=0, limit=500): return self._map_request_v2('profiles/%s/following' % user_id, params={'includeOnly': 'ARTIST', 'deviceType': 'BROWSER'}, ret='artists') def get_public_playlists(self, user_id, offset=0, limit=50): return self._map_request_v2('user-playlists/%s/public' % user_id, params={'offset': offset, 'limit': limit}, ret='playlists')
I guess a robust V2 solution is not what I have produced at all. We can look into a proper implementation in the near future I hope. Work is a bitch at the moment
I ended up having to create a MixV2 class as the structure is different enough to warrant it, however, this structure is only used for this one v2 api endpoint, and tidal themselves in their web app use the v1 api for every other call related to mixes.
It's a rather odd situation as you need to use the v2 endpoint to return a list of something that you then actually only ever need the name and ID of really.
I'll push a draft PR to make what I'm talking about a bit more tangible.