Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in album track listing #64

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

mikey-austin
Copy link
Contributor

Trying to list the tracks in an album borks with this stack trace:

   ERROR    [HttpServer] mopidy_iris.handlers local variable 'data' referenced before assignment
   ERROR    [YTMusicBackend-3 (_actor_loop)] mopidy_ytmusic YTMusic failed getting tracks for album "xxx"
   Traceback (most recent call last):
     File "/usr/local/lib/python3.10/dist-packages/mopidy_ytmusic/library.py", line 437, in lookup
       tracks = self.albumToTracks(res, bId)
     File "/usr/local/lib/python3.10/dist-packages/mopidy_ytmusic/library.py", line 904, in albumToTracks
       songartists = [Artist(name=song["artists"])]
     File "/usr/lib/python3/dist-packages/mopidy/models/immutable.py", line 159, in __call__
       instance = super().__call__(*args, **kwargs)
     File "/usr/lib/python3/dist-packages/mopidy/models/immutable.py", line 35, in __init__
         self._set_field(key, value)
     File "/usr/lib/python3/dist-packages/mopidy/models/immutable.py", line 188, in _set_field
       object.__setattr__(self, name, value)
     File "/usr/lib/python3/dist-packages/mopidy/models/fields.py", line 50, in __set__
       value = self.validate(value)
     File "/usr/lib/python3/dist-packages/mopidy/models/fields.py", line 34, in validate
       raise TypeError(
     TypeError: Expected name to be a <class 'str'>, not [{'name': 'blah', 'id': None}]

This was an apparent typo since the type validation clearly expects a
string and not the full Artist object.

   ERROR    [HttpServer] mopidy_iris.handlers local variable 'data' referenced before assignment
   ERROR    [YTMusicBackend-3 (_actor_loop)] mopidy_ytmusic YTMusic failed getting tracks for album "xxx"
   Traceback (most recent call last):
     File "/usr/local/lib/python3.10/dist-packages/mopidy_ytmusic/library.py", line 437, in lookup
       tracks = self.albumToTracks(res, bId)
     File "/usr/local/lib/python3.10/dist-packages/mopidy_ytmusic/library.py", line 904, in albumToTracks
       songartists = [Artist(name=song["artists"])]
     File "/usr/lib/python3/dist-packages/mopidy/models/immutable.py", line 159, in __call__
       instance = super().__call__(*args, **kwargs)
     File "/usr/lib/python3/dist-packages/mopidy/models/immutable.py", line 35, in __init__
         self._set_field(key, value)
     File "/usr/lib/python3/dist-packages/mopidy/models/immutable.py", line 188, in _set_field
       object.__setattr__(self, name, value)
     File "/usr/lib/python3/dist-packages/mopidy/models/fields.py", line 50, in __set__
       value = self.validate(value)
     File "/usr/lib/python3/dist-packages/mopidy/models/fields.py", line 34, in validate
       raise TypeError(
     TypeError: Expected name to be a <class 'str'>, not [{'name': 'blah', 'id': None}]

This was an apparent typo since the type validation clearly expects a
string and not the full Artist object.
@mikey-austin mikey-austin changed the title #66 - Fix bug in album track listing #63 - Fix bug in album track listing Aug 14, 2022
@mikey-austin
Copy link
Contributor Author

Fixes #63

@mikey-austin mikey-austin changed the title #63 - Fix bug in album track listing Fix bug in album track listing Aug 14, 2022
@mikey-austin
Copy link
Contributor Author

Fixes #39

@rebernet
Copy link

Thanks for the fix. Finally I am able to load the tracks of an album (built and installed from your branch). Please merge.

@GhoulBoii
Copy link

@impliedchaos Sorry for the ping but can this be merged? This fixes #39, #38 and #63. It also removes the need of pr's #62 and #55 i think.

@impliedchaos
Copy link
Collaborator

No worries on the ping, apparently I needed it. I'll get this merged and push out a new bugfix release ASAP.

@impliedchaos impliedchaos merged commit 6d18d66 into OzymandiasTheGreat:master Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants