more fancy solution for the episode adds where show doesn't exist yet

This commit is contained in:
Marcel van der Veldt 2015-05-12 21:27:27 +02:00
parent 025fd31da8
commit da4b99f989
2 changed files with 12 additions and 12 deletions

View file

@ -70,9 +70,8 @@ class LibrarySync():
cursor = connection.cursor() cursor = connection.cursor()
#Add the special emby table #Add the special emby table
if not startupDone: cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER)")
cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER)") connection.commit()
connection.commit()
# sync movies # sync movies
self.MoviesFullSync(connection,cursor,pDialog) self.MoviesFullSync(connection,cursor,pDialog)
@ -99,9 +98,8 @@ class LibrarySync():
cursor = connection.cursor() cursor = connection.cursor()
#Add the special emby table #Add the special emby table
if not startupDone: cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER)")
cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER)") connection.commit()
connection.commit()
self.MusicFullSync(connection,cursor,pDialog) self.MusicFullSync(connection,cursor,pDialog)
cursor.close() cursor.close()
@ -575,6 +573,12 @@ class LibrarySync():
if kodi_show_id: if kodi_show_id:
WriteKodiVideoDB().addOrUpdateEpisodeToKodiLibrary(MBitem["Id"], kodi_show_id, connection, cursor) WriteKodiVideoDB().addOrUpdateEpisodeToKodiLibrary(MBitem["Id"], kodi_show_id, connection, cursor)
else:
#tv show doesn't exist
#perform full tvshow sync instead so both the show and episodes get added
self.TvShowsFullSync(connection,cursor,None)
return
#### PROCESS MUSICVIDEOS #### #### PROCESS MUSICVIDEOS ####
allEmbyMusicvideos = ReadEmbyDB().getMusicVideos(itemList) allEmbyMusicvideos = ReadEmbyDB().getMusicVideos(itemList)

View file

@ -163,12 +163,8 @@ class WebSocketThread(threading.Thread):
self.logMsg("Message : WebSocket LibraryChanged : Items Updated : " + str(itemsUpdated), 0) self.logMsg("Message : WebSocket LibraryChanged : Items Updated : " + str(itemsUpdated), 0)
self.logMsg("Message : WebSocket LibraryChanged : Items Removed : " + str(itemsRemoved), 0) self.logMsg("Message : WebSocket LibraryChanged : Items Removed : " + str(itemsRemoved), 0)
if itemsAdded: self.remove_items(itemsRemoved)
self.logMsg("Message : Doing Full LibrarySync") self.update_items(itemsToUpdate)
LibrarySync().FullLibrarySync()
else:
self.remove_items(itemsRemoved)
self.update_items(itemsToUpdate)
elif messageType == "GeneralCommand": elif messageType == "GeneralCommand":