mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
fixed empty results in getKodiTvshow and GetKodiMovie
filter in kodi api call doesn't accept all fields as searchparameter so walk through the results instead
This commit is contained in:
parent
526e079f44
commit
a796ced05c
2 changed files with 16 additions and 5 deletions
|
@ -20,10 +20,11 @@ musicvideoLibrary = os.path.join(dataPath,'musicvideos')
|
||||||
sleepVal = 15
|
sleepVal = 15
|
||||||
|
|
||||||
class ReadKodiDB():
|
class ReadKodiDB():
|
||||||
|
|
||||||
def getKodiMovie(self, id):
|
def getKodiMovie(self, id):
|
||||||
#returns a single movie from Kodi db selected on MB item ID
|
#returns a single movie from Kodi db selected on MB item ID
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "imdbnumber ", "value": "' + id + '"}, "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "lastplayed", "writer", "playcount", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "lastplayed", "writer", "playcount", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
movie = None
|
movie = None
|
||||||
|
|
||||||
|
@ -32,7 +33,10 @@ class ReadKodiDB():
|
||||||
if(result.has_key('movies')):
|
if(result.has_key('movies')):
|
||||||
movies = result['movies']
|
movies = result['movies']
|
||||||
movie = movies[0]
|
movie = movies[0]
|
||||||
|
for item in movies:
|
||||||
|
if item["imdbnumber"] == id:
|
||||||
|
movie = item
|
||||||
|
break
|
||||||
return movie
|
return movie
|
||||||
|
|
||||||
def getEmbyIdByKodiId(self, kodiid, type):
|
def getEmbyIdByKodiId(self, kodiid, type):
|
||||||
|
@ -149,14 +153,17 @@ class ReadKodiDB():
|
||||||
|
|
||||||
def getKodiTVShow(self, id):
|
def getKodiTVShow(self, id):
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "is", "field": "imdbnumber", "value": "' + id + '"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "lastplayed", "premiered", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "lastplayed", "premiered", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
tvshow = None
|
tvshow = None
|
||||||
if(jsonobject.has_key('result')):
|
if(jsonobject.has_key('result')):
|
||||||
result = jsonobject['result']
|
result = jsonobject['result']
|
||||||
if(result.has_key('tvshows')):
|
if(result.has_key('tvshows')):
|
||||||
tvshows = result['tvshows']
|
tvshows = result['tvshows']
|
||||||
tvshow = tvshows[0]
|
for show in tvshows:
|
||||||
|
if show["imdbnumber"] == id:
|
||||||
|
tvshow = show
|
||||||
|
break
|
||||||
return tvshow
|
return tvshow
|
||||||
|
|
||||||
def getKodiEpisodes(self, KodiTvShowId, fullInfo = True, returnmap = True):
|
def getKodiEpisodes(self, KodiTvShowId, fullInfo = True, returnmap = True):
|
||||||
|
|
|
@ -770,6 +770,10 @@ class WriteKodiDB():
|
||||||
xbmcvfs.delete(nfofile)
|
xbmcvfs.delete(nfofile)
|
||||||
while WINDOW.getProperty("suspendDeletes") == "True":
|
while WINDOW.getProperty("suspendDeletes") == "True":
|
||||||
xbmc.sleep(100)
|
xbmc.sleep(100)
|
||||||
|
utils.logMsg("episode deleted succesfully!",episodeid)
|
||||||
|
else:
|
||||||
|
utils.logMsg("episode not found in kodi DB",episodeid)
|
||||||
|
|
||||||
|
|
||||||
def addTVShowToKodiLibrary( self, item ):
|
def addTVShowToKodiLibrary( self, item ):
|
||||||
itemPath = os.path.join(tvLibrary,item["Id"])
|
itemPath = os.path.join(tvLibrary,item["Id"])
|
||||||
|
|
Loading…
Reference in a new issue