mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-06-18 06:06:14 +00:00
speed improvement
moved all sleeps to the kodi api calls only
This commit is contained in:
parent
593d969669
commit
fe35d84e1e
3 changed files with 15 additions and 16 deletions
|
@ -15,9 +15,13 @@ dataPath = os.path.join(addondir,"library")
|
|||
movieLibrary = os.path.join(dataPath,'movies')
|
||||
tvLibrary = os.path.join(dataPath,'tvshows')
|
||||
|
||||
#sleepval is used to throttle the calls to the xbmc json API
|
||||
sleepVal = 15
|
||||
|
||||
class ReadKodiDB():
|
||||
def getKodiMovie(self, id):
|
||||
#returns a single movie from Kodi db selected on MB item ID
|
||||
xbmc.sleep(sleepVal)
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "writer", "playcount", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}')
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
movie = None
|
||||
|
@ -32,6 +36,7 @@ class ReadKodiDB():
|
|||
|
||||
def getKodiMovies(self,fullInfo = False):
|
||||
#returns all movies in Kodi db inserted by MB
|
||||
xbmc.sleep(sleepVal)
|
||||
if fullInfo:
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.mb3sync"}, "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "writer", "playcount", "tag", "file"] }, "id": "libMovies"}')
|
||||
else:
|
||||
|
@ -88,6 +93,7 @@ class ReadKodiDB():
|
|||
|
||||
def getKodiTvShows(self,fullInfo = False):
|
||||
#returns all tvshows in Kodi db inserted by MB
|
||||
xbmc.sleep(sleepVal)
|
||||
if fullInfo:
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.mb3sync"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "premiered", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||
else:
|
||||
|
@ -103,6 +109,7 @@ class ReadKodiDB():
|
|||
return tvshows
|
||||
|
||||
def getKodiTVShow(self, id):
|
||||
xbmc.sleep(sleepVal)
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "premiered", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
tvshow = None
|
||||
|
@ -114,6 +121,7 @@ class ReadKodiDB():
|
|||
return tvshow
|
||||
|
||||
def getKodiEpisodes(self, id,fullInfo = True):
|
||||
xbmc.sleep(sleepVal)
|
||||
episodes = None
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties": ["title", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
|
@ -136,6 +144,7 @@ class ReadKodiDB():
|
|||
return episodes
|
||||
|
||||
def getKodiEpisodeByMbItem(self, MBitem):
|
||||
xbmc.sleep(sleepVal)
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "is", "field": "title", "value": "' + MBitem.get("SeriesName").encode('utf-8') + '"} }, "id": "libTvShows"}')
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
episode = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue