tamland / python-tidal

Python API for TIDAL music streaming service
GNU Lesser General Public License v3.0
413 stars 110 forks source link

KeyError: 'gender' ? #170

Closed 9acca9 closed 1 year ago

9acca9 commented 1 year ago

all was working fine. I change my suscription to Tidal hi-fi plus, restart the mopidy server, accept the new link for auth, and now im getting this error:

Aug 02 15:35:02 raspberrypi mopidy[1187]: INFO     [TidalBackend-4] mopidy_tidal.backend Visit link.tidal.com/GXAQT to log in, the code will expire in 300 seconds
Aug 02 15:35:54 raspberrypi mopidy[989]: ERROR    [TidalBackend-4] pykka Unhandled exception in TidalBackend (urn:uuid:79e4bc84-cfc0-4544-9345-170a123c9f1d):
Aug 02 15:35:54 raspberrypi mopidy[989]: Traceback (most recent call last):
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 186, in _actor_loop
Aug 02 15:35:54 raspberrypi mopidy[989]:     self.on_start()
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/mopidy_tidal/backend.py", line 83, in on_start
Aug 02 15:35:54 raspberrypi mopidy[989]:     self.oauth_login_new_session(oauth_file)
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/mopidy_tidal/backend.py", line 29, in oauth_login_new_session
Aug 02 15:35:54 raspberrypi mopidy[989]:     self._session.login_oauth_simple(function=logger.info)
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/tidalapi/session.py", line 323, in login_oauth_simple
Aug 02 15:35:54 raspberrypi mopidy[989]:     future.result()
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/lib/python3.9/concurrent/futures/_base.py", line 440, in result
Aug 02 15:35:54 raspberrypi mopidy[989]:     return self.__get_result()
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result
Aug 02 15:35:54 raspberrypi mopidy[989]:     raise self._exception
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
Aug 02 15:35:54 raspberrypi mopidy[989]:     result = self.fn(*self.args, **self.kwargs)
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/tidalapi/session.py", line 364, in _process_link_login
Aug 02 15:35:54 raspberrypi mopidy[989]:     self.user = tidalapi.User(self, user_id=json['userId']).factory()
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/tidalapi/user.py", line 48, in factory
Aug 02 15:35:54 raspberrypi mopidy[989]:     return self.request.map_request('users/%s' % self.id, parse=self.parse)
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/tidalapi/request.py", line 118, in map_request
Aug 02 15:35:54 raspberrypi mopidy[989]:     return self.map_json(json_obj, parse=parse)
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/tidalapi/request.py", line 125, in map_json
Aug 02 15:35:54 raspberrypi mopidy[989]:     return parse(json_obj)
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/tidalapi/user.py", line 65, in parse
Aug 02 15:35:54 raspberrypi mopidy[989]:     return user.parse(json_obj)
Aug 02 15:35:54 raspberrypi mopidy[989]:   File "/usr/local/lib/python3.9/dist-packages/tidalapi/user.py", line 110, in parse
Aug 02 15:35:54 raspberrypi mopidy[989]:     self.gender = json_obj['gender']
Aug 02 15:35:54 raspberrypi mopidy[989]: KeyError: 'gender'

if i restart again the mopidy server, i again have to go to a new link for auth. What i can do? Thanks.

tehkillerbee commented 1 year ago

Are you sure you are using the correct version of tidalapi? This issue should already be fixed

https://github.com/tamland/python-tidal/issues/160#issuecomment-1637194045

9acca9 commented 1 year ago

...ouch, thanks! by the way, Tidal is delivering FLAC at hires now. Is necessary to make changes in tidalapi to take that into advantage? (i dont speak english)

tehkillerbee commented 1 year ago

Yes, we are already aware that Tidal is available in HIRES. Support is currently being added, although I have currently not got a Hifi Plus subscription to test with.

Please refer to https://github.com/tamland/python-tidal/issues/172 for more details about this issue.

Marking this issue as fixed.