mirror of
https://github.com/gordielachance/plugin.audio.subsonic
synced 2025-02-11 17:20:43 +01:00
Some error fixes
This commit is contained in:
parent
8c4f31db05
commit
2335973433
11
service.py
11
service.py
@ -18,6 +18,11 @@ connection = None
|
|||||||
scrobbleEnabled = Addon().get_setting('scrobble')
|
scrobbleEnabled = Addon().get_setting('scrobble')
|
||||||
scrobbled = False
|
scrobbled = False
|
||||||
|
|
||||||
|
def popup(text, time=5000, image=None):
|
||||||
|
title = plugin.addon.getAddonInfo('name')
|
||||||
|
icon = plugin.addon.getAddonInfo('icon')
|
||||||
|
xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (title, text,
|
||||||
|
time, icon))
|
||||||
def get_connection():
|
def get_connection():
|
||||||
global connection
|
global connection
|
||||||
|
|
||||||
@ -53,13 +58,15 @@ def scrobble_track(track_id):
|
|||||||
res = connection.scrobble(track_id)
|
res = connection.scrobble(track_id)
|
||||||
#xbmc.log("response %s"%(res), xbmc.LOGINFO)
|
#xbmc.log("response %s"%(res), xbmc.LOGINFO)
|
||||||
if res['status'] == 'ok':
|
if res['status'] == 'ok':
|
||||||
|
popup('Scrobbled track')
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
popup('Scrobble failed')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
monitor = xbmc.Monitor()
|
monitor = xbmc.Monitor()
|
||||||
|
xbmc.log("Service started", xbmc.LOGINFO)
|
||||||
while not monitor.abortRequested():
|
while not monitor.abortRequested():
|
||||||
if monitor.waitForAbort(10):
|
if monitor.waitForAbort(10):
|
||||||
break
|
break
|
||||||
@ -80,6 +87,8 @@ if __name__ == '__main__':
|
|||||||
scrobbled = True
|
scrobbled = True
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
except IndexError:
|
||||||
|
print ("Not a Subsonic track")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
xbmc.log("Script failed %e"%e, xbmc.LOGINFO)
|
xbmc.log("Script failed %e"%e, xbmc.LOGINFO)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user