Fix kodi exception

For music report playback, verify that the type we are about to process
is actually a song, otherwise we get a lot of exceptions that file is
not playing.
This commit is contained in:
angelblue05 2015-10-22 19:46:29 -05:00
parent 56ef721836
commit 540745e24a

View file

@ -28,9 +28,6 @@ class Kodi_Monitor( xbmc.Monitor ):
className = self.__class__.__name__ className = self.__class__.__name__
utils.logMsg("%s %s" % ("EMBY", className), msg, int(lvl)) utils.logMsg("%s %s" % ("EMBY", className), msg, int(lvl))
def onDatabaseUpdated(self, database):
pass
#this library monitor is used to detect a watchedstate change by the user through the library #this library monitor is used to detect a watchedstate change by the user through the library
#as well as detect when a library item has been deleted to pass the delete to the Emby server #as well as detect when a library item has been deleted to pass the delete to the Emby server
def onNotification (self, sender, method, data): def onNotification (self, sender, method, data):
@ -40,15 +37,15 @@ class Kodi_Monitor( xbmc.Monitor ):
#player started playing an item - #player started playing an item -
if ("Playlist.OnAdd" in method or "Player.OnPlay" in method): if ("Playlist.OnAdd" in method or "Player.OnPlay" in method):
if utils.settings('useDirectPaths')=='true' or utils.settings('enableMusicSync') == "true":
jsondata = json.loads(data) jsondata = json.loads(data)
if jsondata != None: if jsondata:
if jsondata.has_key("item"): if jsondata.has_key("item"):
if jsondata.get("item").has_key("id") and jsondata.get("item").has_key("type"): if jsondata.get("item").has_key("id") and jsondata.get("item").has_key("type"):
id = jsondata.get("item").get("id") id = jsondata.get("item").get("id")
type = jsondata.get("item").get("type") type = jsondata.get("item").get("type")
if utils.settings('useDirectPaths')=='true' or (type == "song" and utils.settings('enableMusicSync') == "true"):
if type == "song": if type == "song":
connection = utils.KodiSQL('music') connection = utils.KodiSQL('music')
cursor = connection.cursor() cursor = connection.cursor()