support deletions for musiclibrary sync
This commit is contained in:
parent
a12f6093dd
commit
507dd340cd
2 changed files with 24 additions and 14 deletions
|
@ -180,13 +180,26 @@ class WebSocketThread(threading.Thread):
|
||||||
self.update_items(itemsToUpdate)
|
self.update_items(itemsToUpdate)
|
||||||
|
|
||||||
def remove_items(self, itemsRemoved):
|
def remove_items(self, itemsRemoved):
|
||||||
connection = utils.KodiSQL()
|
|
||||||
|
#Process video library
|
||||||
|
connection = utils.KodiSQL("video")
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
for item in itemsRemoved:
|
for item in itemsRemoved:
|
||||||
self.logMsg("Message : Doing LibraryChanged : Items Removed : Calling deleteEpisodeFromKodiLibraryByMbId: " + item, 0)
|
self.logMsg("Message : Doing LibraryChanged : Items Removed : Calling deleteItemFromKodiLibrary: " + item, 0)
|
||||||
WriteKodiVideoDB().deleteItemFromKodiLibrary(item, connection, cursor)
|
WriteKodiVideoDB().deleteItemFromKodiLibrary(item, connection, cursor)
|
||||||
connection.commit()
|
connection.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
|
#Process music library
|
||||||
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
if addon.getSetting("enableMusicSync") == "true":
|
||||||
|
connection = utils.KodiSQL("music")
|
||||||
|
cursor = connection.cursor()
|
||||||
|
for item in itemsRemoved:
|
||||||
|
self.logMsg("Message : Doing LibraryChanged : Items Removed : Calling deleteItemFromKodiLibrary (musiclibrary): " + item, 0)
|
||||||
|
WriteKodiMusicDB().deleteItemFromKodiLibrary(item, connection, cursor)
|
||||||
|
connection.commit()
|
||||||
|
cursor.close()
|
||||||
|
|
||||||
def update_items(self, itemsToUpdate):
|
def update_items(self, itemsToUpdate):
|
||||||
# doing adds and updates
|
# doing adds and updates
|
||||||
|
|
|
@ -384,18 +384,15 @@ class WriteKodiMusicDB():
|
||||||
if result:
|
if result:
|
||||||
kodi_id = result[0]
|
kodi_id = result[0]
|
||||||
media_type = result[1]
|
media_type = result[1]
|
||||||
if media_type == "movie":
|
if media_type == "artist":
|
||||||
utils.logMsg("deleting movie from Kodi library --> ",id)
|
utils.logMsg("deleting artist from Kodi library --> ",id)
|
||||||
cursor.execute("DELETE FROM movie WHERE idMovie = ?", (kodi_id,))
|
cursor.execute("DELETE FROM artist WHERE idArtist = ?", (kodi_id,))
|
||||||
if media_type == "episode":
|
if media_type == "song":
|
||||||
utils.logMsg("deleting episode from Kodi library --> ",id)
|
utils.logMsg("deleting song from Kodi library --> ",id)
|
||||||
cursor.execute("DELETE FROM episode WHERE idEpisode = ?", (kodi_id,))
|
cursor.execute("DELETE FROM song WHERE idSong = ?", (kodi_id,))
|
||||||
if media_type == "tvshow":
|
if media_type == "album":
|
||||||
utils.logMsg("deleting tvshow from Kodi library --> ",id)
|
utils.logMsg("deleting album from Kodi library --> ",id)
|
||||||
cursor.execute("DELETE FROM tvshow WHERE idShow = ?", (kodi_id,))
|
cursor.execute("DELETE FROM album WHERE idAlbum = ?", (kodi_id,))
|
||||||
if media_type == "musicvideo":
|
|
||||||
utils.logMsg("deleting musicvideo from Kodi library --> ",id)
|
|
||||||
cursor.execute("DELETE FROM musicvideo WHERE idMVideo = ?", (kodi_id,))
|
|
||||||
|
|
||||||
#delete the record in emby table
|
#delete the record in emby table
|
||||||
cursor.execute("DELETE FROM emby WHERE emby_id = ?", (id,))
|
cursor.execute("DELETE FROM emby WHERE emby_id = ?", (id,))
|
||||||
|
|
Loading…
Reference in a new issue