Don't start service if scrobbling switched off

This commit is contained in:
warwickh 2021-09-10 09:24:48 +10:00
parent 8ca52e6cc8
commit f97b9e1de9
1 changed files with 20 additions and 18 deletions

View File

@ -69,15 +69,16 @@ def scrobble_track(track_id):
return False return False
if __name__ == '__main__': if __name__ == '__main__':
monitor = xbmc.Monitor() if(scrobbleEnabled):
xbmc.log("Subsonic service started", xbmc.LOGINFO) monitor = xbmc.Monitor()
popup("Subsonic service started") xbmc.log("Subsonic service started", xbmc.LOGINFO)
while not monitor.abortRequested(): popup("Subsonic service started")
if monitor.waitForAbort(10): while not monitor.abortRequested():
break if monitor.waitForAbort(10):
if (xbmc.getCondVisibility("Player.HasMedia")): break
try: if (xbmc.getCondVisibility("Player.HasMedia")):
if(scrobbleEnabled): try:
currentFileName = xbmc.getInfoLabel("Player.Filenameandpath") currentFileName = xbmc.getInfoLabel("Player.Filenameandpath")
currentFileProgress = xbmc.getInfoLabel("Player.Progress") currentFileProgress = xbmc.getInfoLabel("Player.Progress")
pattern = re.compile(r'plugin:\/\/plugin\.audio\.subsonic\/\?action=play_track&id=(.*?)&') pattern = re.compile(r'plugin:\/\/plugin\.audio\.subsonic\/\?action=play_track&id=(.*?)&')
@ -92,12 +93,13 @@ if __name__ == '__main__':
scrobbled = True scrobbled = True
else: else:
pass pass
except IndexError: except IndexError:
print ("Not a Subsonic track") print ("Not a Subsonic track")
scrobbled = True scrobbled = True
except Exception as e: except Exception as e:
xbmc.log("Subsonic service failed %e"%e, xbmc.LOGINFO) xbmc.log("Subsonic service failed %e"%e, xbmc.LOGINFO)
else: else:
pass pass
#xbmc.log("Playing stopped", xbmc.LOGINFO) #xbmc.log("Playing stopped", xbmc.LOGINFO)
else:
xbmc.log("Subsonic service not started due to settings", xbmc.LOGINFO)