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

Don't use inconsistent `albumId` or `artistId` #233

merged 6 commits into from Mar 10, 2020
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -373,6 +373,8 @@ def sorter(track):
return sorted(tracks, key=sorter)

def refresh(self, uri=None):"Refreshing library")

self.tracks = {}
self.albums = {}
self.artists = {}
@@ -407,6 +409,13 @@ def refresh(self, uri=None):
for artist in album.artists:
self.artists[artist.uri] = artist
"Loaded "
f"{len(self.artists)} artists, "
f"{len(self.albums)} albums, "
f"{len(self.tracks)} tracks from Google Play Music"

def search(self, query=None, uris=None, exact=False):
if exact:
return self._find_exact(query=query, uris=uris)
@@ -585,9 +594,7 @@ def _to_mopidy_album(self, song):
artist = self._to_mopidy_album_artist(song)
date = str(song.get("year", 0))

album_id = song.get("albumId")
if album_id is None:
album_id = create_id( + name + date)
album_id = create_id(f"{}|{name}|{date}")

uri = "gmusic:album:" + album_id
return Album(
@@ -601,11 +608,7 @@ def _to_mopidy_album(self, song):

def _to_mopidy_artist(self, song):
name = song.get("artist", "")
artist_id = song.get("artistId")
if artist_id is not None:
artist_id = artist_id[0]
artist_id = create_id(name)
artist_id = create_id(name)
uri = "gmusic:artist:" + artist_id
return Artist(uri=uri, name=name)

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.