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
1 changed files with 9 additions and 12 deletions

View File

@ -28,9 +28,6 @@ class Kodi_Monitor( xbmc.Monitor ):
className = self.__class__.__name__
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
#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):
@ -40,15 +37,15 @@ class Kodi_Monitor( xbmc.Monitor ):
#player started playing an item -
if ("Playlist.OnAdd" in method or "Player.OnPlay" in method):
if utils.settings('useDirectPaths')=='true' or utils.settings('enableMusicSync') == "true":
jsondata = json.loads(data)
if jsondata != None:
if jsondata:
if jsondata.has_key("item"):
if jsondata.get("item").has_key("id") and jsondata.get("item").has_key("type"):
id = jsondata.get("item").get("id")
type = jsondata.get("item").get("type")
if utils.settings('useDirectPaths')=='true' or (type == "song" and utils.settings('enableMusicSync') == "true"):
if type == "song":
connection = utils.KodiSQL('music')
cursor = connection.cursor()