forked from platypush/platypush
Keep reloading the MPD plugin in the MPD backend if the plugin crashed or keeps being null
This commit is contained in:
parent
2186336bbc
commit
15a233a927
1 changed files with 8 additions and 1 deletions
|
@ -27,9 +27,16 @@ class MusicMpdBackend(Backend):
|
||||||
last_state = None
|
last_state = None
|
||||||
last_track = None
|
last_track = None
|
||||||
last_playlist = None
|
last_playlist = None
|
||||||
|
plugin = None
|
||||||
|
|
||||||
while not self.should_stop():
|
while not self.should_stop():
|
||||||
|
while not plugin:
|
||||||
plugin = get_plugin('music.mpd')
|
plugin = get_plugin('music.mpd')
|
||||||
|
if not plugin:
|
||||||
|
logging.info('Reloading crashed MPD plugin')
|
||||||
|
plugin = get_plugin('music.mpd', reload=True)
|
||||||
|
time.sleep(self.poll_seconds)
|
||||||
|
|
||||||
status = plugin.status().output
|
status = plugin.status().output
|
||||||
track = plugin.currentsong().output
|
track = plugin.currentsong().output
|
||||||
state = status['state'].lower()
|
state = status['state'].lower()
|
||||||
|
|
Loading…
Reference in a new issue