mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
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)
|
||||
|
||||
def remove_items(self, itemsRemoved):
|
||||
connection = utils.KodiSQL()
|
||||
|
||||
#Process video library
|
||||
connection = utils.KodiSQL("video")
|
||||
cursor = connection.cursor()
|
||||
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)
|
||||
connection.commit()
|
||||
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):
|
||||
# doing adds and updates
|
||||
|
|
|
@ -384,18 +384,15 @@ class WriteKodiMusicDB():
|
|||
if result:
|
||||
kodi_id = result[0]
|
||||
media_type = result[1]
|
||||
if media_type == "movie":
|
||||
utils.logMsg("deleting movie from Kodi library --> ",id)
|
||||
cursor.execute("DELETE FROM movie WHERE idMovie = ?", (kodi_id,))
|
||||
if media_type == "episode":
|
||||
utils.logMsg("deleting episode from Kodi library --> ",id)
|
||||
cursor.execute("DELETE FROM episode WHERE idEpisode = ?", (kodi_id,))
|
||||
if media_type == "tvshow":
|
||||
utils.logMsg("deleting tvshow from Kodi library --> ",id)
|
||||
cursor.execute("DELETE FROM tvshow WHERE idShow = ?", (kodi_id,))
|
||||
if media_type == "musicvideo":
|
||||
utils.logMsg("deleting musicvideo from Kodi library --> ",id)
|
||||
cursor.execute("DELETE FROM musicvideo WHERE idMVideo = ?", (kodi_id,))
|
||||
if media_type == "artist":
|
||||
utils.logMsg("deleting artist from Kodi library --> ",id)
|
||||
cursor.execute("DELETE FROM artist WHERE idArtist = ?", (kodi_id,))
|
||||
if media_type == "song":
|
||||
utils.logMsg("deleting song from Kodi library --> ",id)
|
||||
cursor.execute("DELETE FROM song WHERE idSong = ?", (kodi_id,))
|
||||
if media_type == "album":
|
||||
utils.logMsg("deleting album from Kodi library --> ",id)
|
||||
cursor.execute("DELETE FROM album WHERE idAlbum = ?", (kodi_id,))
|
||||
|
||||
#delete the record in emby table
|
||||
cursor.execute("DELETE FROM emby WHERE emby_id = ?", (id,))
|
||||
|
|
Loading…
Reference in a new issue