mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
add some error checking
This commit is contained in:
parent
83c438f8ff
commit
4f6e7c2233
1 changed files with 17 additions and 7 deletions
|
@ -45,7 +45,12 @@ class LibrarySync():
|
||||||
updateNeeded = False
|
updateNeeded = False
|
||||||
|
|
||||||
allMovies = list()
|
allMovies = list()
|
||||||
for item in self.getMovies(True):
|
movieData = self.getMovies(True)
|
||||||
|
|
||||||
|
if(movieData == None):
|
||||||
|
return
|
||||||
|
|
||||||
|
for item in movieData:
|
||||||
if not item.get('IsFolder'):
|
if not item.get('IsFolder'):
|
||||||
kodiItem = self.getKodiMovie(item["Id"])
|
kodiItem = self.getKodiMovie(item["Id"])
|
||||||
allMovies.append(item["Id"])
|
allMovies.append(item["Id"])
|
||||||
|
@ -77,7 +82,11 @@ class LibrarySync():
|
||||||
|
|
||||||
WINDOW.setProperty("librarysync", "busy")
|
WINDOW.setProperty("librarysync", "busy")
|
||||||
|
|
||||||
for item in self.getMovies(False):
|
movieData = self.getMovies(True)
|
||||||
|
if(movieData == None):
|
||||||
|
return
|
||||||
|
|
||||||
|
for item in movieData:
|
||||||
if not item.get('IsFolder'):
|
if not item.get('IsFolder'):
|
||||||
kodiItem = self.getKodiMovie(item["Id"])
|
kodiItem = self.getKodiMovie(item["Id"])
|
||||||
userData=API().getUserData(item)
|
userData=API().getUserData(item)
|
||||||
|
@ -102,7 +111,7 @@ class LibrarySync():
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/Items?&SortBy=SortName&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Ascending&IncludeItemTypes=Movie&format=json&ImageTypeLimit=1'
|
url = server + '/mediabrowser/Users/' + userid + '/Items?&SortBy=SortName&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Ascending&IncludeItemTypes=Movie&format=json&ImageTypeLimit=1'
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=True, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=True, popup=0)
|
||||||
if jsonData != None:
|
if jsonData != None and jsonData != "":
|
||||||
result = json.loads(jsonData)
|
result = json.loads(jsonData)
|
||||||
if(result.has_key('Items')):
|
if(result.has_key('Items')):
|
||||||
result = result['Items']
|
result = result['Items']
|
||||||
|
@ -184,10 +193,11 @@ class LibrarySync():
|
||||||
trailerUrl = None
|
trailerUrl = None
|
||||||
if MBitem.get("LocalTrailerCount") != None and MBitem.get("LocalTrailerCount") > 0:
|
if MBitem.get("LocalTrailerCount") != None and MBitem.get("LocalTrailerCount") > 0:
|
||||||
itemTrailerUrl = "http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + MBitem.get("Id") + "/LocalTrailers?format=json"
|
itemTrailerUrl = "http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + MBitem.get("Id") + "/LocalTrailers?format=json"
|
||||||
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=True, popup=0 )
|
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=True, popup=0 )
|
||||||
trailerItem = json.loads(jsonData)
|
if(jsonData != ""):
|
||||||
trailerUrl = "plugin://plugin.video.mb3sync/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
trailerItem = json.loads(jsonData)
|
||||||
self.updateProperty(KodiItem,"trailer",trailerUrl,"movie")
|
trailerUrl = "plugin://plugin.video.mb3sync/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
||||||
|
self.updateProperty(KodiItem,"trailer",trailerUrl,"movie")
|
||||||
|
|
||||||
#update strm file - TODO: only update strm when path has changed
|
#update strm file - TODO: only update strm when path has changed
|
||||||
self.createSTRM(MBitem["Id"])
|
self.createSTRM(MBitem["Id"])
|
||||||
|
|
Loading…
Reference in a new issue