Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
Fixed translation of album artist.
Browse files Browse the repository at this point in the history
  • Loading branch information
hechtus committed Oct 11, 2013
1 parent 98173b5 commit 3c2c665
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions mopidy_gmusic/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,26 +174,37 @@ def _to_mopidy_track(self, song):
return track

def _to_mopidy_album(self, song):
artist = song.get('albumArtist', '')
if artist.strip() == '':
artist = song['artist']
name = song['album']
artist = self._to_mopidy_album_artist(song)
date = unicode(song.get('year', 0))
uri = 'gmusic:album:' + self._create_id(artist + song['album'] + date)
uri = 'gmusic:album:' + self._create_id(artist.name + name + date)
album = Album(
uri=uri,
name=song['album'],
artists=[self._to_mopidy_artist(song)],
name=name,
artists=[artist],
num_tracks=song.get('totalTrackCount', 1),
num_discs=song.get('totalDiscCount', song.get('discNumber', 1)),
date=date)
self.albums[uri] = album
return album

def _to_mopidy_artist(self, song):
uri = 'gmusic:artist:' + self._create_id(song['artist'])
name = song['artist']
uri = 'gmusic:artist:' + self._create_id(name)
artist = Artist(
uri=uri,
name=name)
self.artists[uri] = artist
return artist

def _to_mopidy_album_artist(self, song):
name = song.get('albumArtist', '')
if name.strip() == '':
name = song['artist']
uri = 'gmusic:artist:' + self._create_id(name)
artist = Artist(
uri=uri,
name=song['artist'])
name=name)
self.artists[uri] = artist
return artist

Expand Down

0 comments on commit 3c2c665

Please sign in to comment.