mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 17:56:11 +00:00
fixed some errors
This commit is contained in:
parent
61c6fedc19
commit
8c6b90923e
2 changed files with 63 additions and 49 deletions
|
@ -65,6 +65,7 @@ class LibrarySync():
|
|||
#sync Tvshows and episodes
|
||||
self.TvShowsFullSync(connection,cursor,pDialog)
|
||||
|
||||
|
||||
# set the install done setting
|
||||
if(syncInstallRunDone == False and completed):
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby') #force a new instance of the addon
|
||||
|
@ -115,7 +116,7 @@ class LibrarySync():
|
|||
if(pDialog != None):
|
||||
progressTitle = "Processing " + view.get('title') + " (" + str(count) + " of " + str(total) + ")"
|
||||
pDialog.update(0, "Emby for Kodi - Running Sync", progressTitle)
|
||||
count = 1
|
||||
count += 1
|
||||
|
||||
kodiMovie = None
|
||||
for kodimovie in allKodiMovies:
|
||||
|
@ -164,7 +165,7 @@ class LibrarySync():
|
|||
if(pDialog != None):
|
||||
progressTitle = "Processing " + view.get('title') + " (" + str(count) + " of " + str(total) + ")"
|
||||
pDialog.update(0, "Emby for Kodi - Running Sync", progressTitle)
|
||||
count = 1
|
||||
count += 1
|
||||
|
||||
#build a list with all Id's and get the existing entry (if exists) in Kodi DB
|
||||
kodiShow = None
|
||||
|
@ -241,6 +242,7 @@ class LibrarySync():
|
|||
connection = utils.KodiSQL()
|
||||
cursor = connection.cursor()
|
||||
|
||||
try:
|
||||
#### PROCESS MOVIES ####
|
||||
views = ReadEmbyDB().getCollections("movies")
|
||||
for view in views:
|
||||
|
@ -262,7 +264,7 @@ class LibrarySync():
|
|||
for item in itemList:
|
||||
|
||||
MBitem = ReadEmbyDB().getItem(item)
|
||||
|
||||
print MBitem
|
||||
if MBitem["Type"] == "Episode":
|
||||
|
||||
#get the tv show
|
||||
|
@ -272,12 +274,14 @@ class LibrarySync():
|
|||
kodi_show_id = result[0]
|
||||
else:
|
||||
kodi_show_id = None
|
||||
print "show id not found!"
|
||||
|
||||
if kodi_show_id:
|
||||
WriteKodiDB().addOrUpdateEpisodeToKodiLibrary(item["Id"], kodi_show_id, connection, cursor)
|
||||
|
||||
|
||||
finally:
|
||||
cursor.close()
|
||||
|
||||
#close the progress dialog
|
||||
if(pDialog != None):
|
||||
pDialog.close()
|
||||
|
||||
|
|
|
@ -148,6 +148,9 @@ class WriteKodiDB():
|
|||
|
||||
##### ADD THE MOVIE ############
|
||||
if movieid == None:
|
||||
|
||||
utils.logMsg("ADD movie to Kodi library","Id: %s - Title: %s" % (embyId, title))
|
||||
|
||||
#create the movie
|
||||
cursor.execute("select coalesce(max(idMovie),0) as movieid from movie")
|
||||
movieid = cursor.fetchone()[0]
|
||||
|
@ -167,6 +170,7 @@ class WriteKodiDB():
|
|||
|
||||
#### UPDATE THE MOVIE #####
|
||||
else:
|
||||
utils.logMsg("UPDATE movie to Kodi library","Id: %s - Title: %s" % (embyId, title))
|
||||
pathsql="update movie SET c00 = ?, c01 = ?, c02 = ?, c05 = ?, c06 = ?, c07 = ?, c09 = ?, c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?, c16 = ?, c18 = ?, c19 = ? WHERE idMovie = ?"
|
||||
cursor.execute(pathsql, (title, plot, shortplot, rating, writer, year, imdb, sorttitle, runtime, mpaa, genre, director, title, studio, trailerUrl, movieid))
|
||||
|
||||
|
@ -255,6 +259,8 @@ class WriteKodiDB():
|
|||
#### ADD THE TV SHOW TO KODI ##############
|
||||
if showid == None:
|
||||
|
||||
utils.logMsg("ADD tvshow to Kodi library","Id: %s - Title: %s" % (embyId, title))
|
||||
|
||||
#create the tv show path
|
||||
cursor.execute("select coalesce(max(idPath),0) as pathid from path")
|
||||
pathid = cursor.fetchone()[0]
|
||||
|
@ -293,6 +299,8 @@ class WriteKodiDB():
|
|||
|
||||
#### UPDATE THE TV SHOW #############
|
||||
else:
|
||||
utils.logMsg("UPDATE tvshow to Kodi library","Id: %s - Title: %s" % (embyId, title))
|
||||
|
||||
pathsql="UPDATE tvshow SET c00 = ?, c01 = ?, c04 = ?, c05 = ?, c08 = ?, c09 = ?, c13 = ?, c14 = ?, c15 = ? WHERE idShow = ?"
|
||||
cursor.execute(pathsql, (title, plot, rating, premieredate, title, genre, mpaa, studio, sorttitle, showid))
|
||||
|
||||
|
@ -496,7 +504,7 @@ class WriteKodiDB():
|
|||
|
||||
# ADD EPISODE TO KODI
|
||||
if episodeid == None:
|
||||
|
||||
utils.logMsg("ADD episode to Kodi library","Id: %s - Title: %s" % (embyId, title))
|
||||
#create the episode
|
||||
cursor.execute("select coalesce(max(idEpisode),0) as episodeid from episode")
|
||||
episodeid = cursor.fetchone()[0]
|
||||
|
@ -513,6 +521,8 @@ class WriteKodiDB():
|
|||
|
||||
# UPDATE THE EPISODE IN KODI (for now, we just send in all data)
|
||||
else:
|
||||
utils.logMsg("UPDATE episode to Kodi library","Id: %s - Title: %s" % (embyId, title))
|
||||
|
||||
pathsql = "UPDATE episode SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?, c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ? WHERE idEpisode = ?"
|
||||
cursor.execute(pathsql, (title, plot, rating, writer, premieredate, runtime, director, season, episode, title, "-1", "-1", episodeid))
|
||||
|
||||
|
|
Loading…
Reference in a new issue