don?t crash on stored playlists
This commit is contained in:
parent
c4feb11d0d
commit
5384548dc1
1 changed files with 12 additions and 9 deletions
21
mcg.py
21
mcg.py
|
|
@ -267,15 +267,18 @@ class MCGClient(MCGBase, mpd.MPDClient):
|
||||||
album = None
|
album = None
|
||||||
pos = None
|
pos = None
|
||||||
if song:
|
if song:
|
||||||
hash = MCGAlbum.hash(song['album'], song['date'])
|
try:
|
||||||
if hash in self._albums:
|
hash = MCGAlbum.hash(song['album'], song['date'])
|
||||||
album = self._albums[hash]
|
if hash in self._albums:
|
||||||
pos = song['track']
|
album = self._albums[hash]
|
||||||
if type(pos) is list:
|
pos = song['track']
|
||||||
pos = pos[0]
|
if type(pos) is list:
|
||||||
if '/' in pos:
|
pos = pos[0]
|
||||||
pos = pos[0: pos.index('/')]
|
if '/' in pos:
|
||||||
pos = int(pos) - 1
|
pos = pos[0: pos.index('/')]
|
||||||
|
pos = int(pos) - 1
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
self._state = state
|
self._state = state
|
||||||
self._callback(MCGClient.SIGNAL_STATUS, state, album, pos, volume, error)
|
self._callback(MCGClient.SIGNAL_STATUS, state, album, pos, volume, error)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue