forked from platypush/platypush
Made the mpd backend a bit more resiliant
This commit is contained in:
parent
6150e07fc9
commit
c1b05226a9
3 changed files with 13 additions and 5 deletions
|
@ -230,6 +230,10 @@ $(document).ready(function() {
|
|||
};
|
||||
|
||||
var updatePlaylist = function(tracks) {
|
||||
if (tracks == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $playlistContent = $('#playlist-content');
|
||||
$playlistContent.find('.playlist-track').remove();
|
||||
|
||||
|
|
|
@ -66,10 +66,11 @@ class MusicMpdBackend(Backend):
|
|||
state = status['state'].lower()
|
||||
playlist = status['playlist']
|
||||
success = True
|
||||
except StopIteration:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.logger.debug(e)
|
||||
if not state: state = last_state
|
||||
if not playlist: playlist = last_playlist
|
||||
if not track: track = last_track
|
||||
finally:
|
||||
time.sleep(self.poll_seconds)
|
||||
|
||||
|
@ -83,8 +84,11 @@ class MusicMpdBackend(Backend):
|
|||
|
||||
if playlist != last_playlist:
|
||||
if last_playlist:
|
||||
changes = plugin.plchanges(last_playlist).output
|
||||
self.bus.post(PlaylistChangeEvent(changes=changes))
|
||||
# XXX plchanges can become heavy with big playlists,
|
||||
# PlaylistChangeEvent temporarily disabled
|
||||
# changes = plugin.plchanges(last_playlist).output
|
||||
# self.bus.post(PlaylistChangeEvent(changes=changes))
|
||||
self.bus.post(PlaylistChangeEvent())
|
||||
last_playlist = playlist
|
||||
|
||||
if state == 'play' and track != last_track:
|
||||
|
|
|
@ -93,7 +93,7 @@ class PlaylistChangeEvent(MusicEvent):
|
|||
Event fired upon playlist change
|
||||
"""
|
||||
|
||||
def __init__(self, changes, status=None, track=None, *args, **kwargs):
|
||||
def __init__(self, changes=None, status=None, track=None, *args, **kwargs):
|
||||
"""
|
||||
:param changes: List with the tracks being added or removed
|
||||
:type changes: list
|
||||
|
|
Loading…
Reference in a new issue