def remove_texture(textureid): json_request = get_base_json_request('Textures.RemoveTexture') json_request['params']['textureid'] = textureid json_result = pykodi.execute_jsonrpc(json_request) if not check_json_result(json_result, 'OK', json_request): log(json_result)
def set_item_details(dbid, mediatype, **details): assert mediatype in typemap mapped = typemap[mediatype] basestr = 'VideoLibrary.Set{0}Details' if mediatype not in mediatypes.audiotypes else 'AudioLibrary.Set{0}Details' json_request = get_base_json_request(basestr.format(mapped[0])) json_request['params'] = details json_request['params'][mediatype + 'id'] = dbid json_result = pykodi.execute_jsonrpc(json_request) if not check_json_result(json_result, 'OK', json_request): log(json_result)
def _inner_get_seasons(tvshow_id=-1): json_request = get_base_json_request('VideoLibrary.GetSeasons') if tvshow_id != -1: json_request['params']['tvshowid'] = tvshow_id json_request['params']['properties'] = typemap[mediatypes.SEASON][1] json_result = pykodi.execute_jsonrpc(json_request) if check_json_result(json_result, 'seasons', json_request): return json_result['result']['seasons'] else: return []
def get_textures(url=None): json_request = get_base_json_request('Textures.GetTextures') json_request['params']['properties'] = ['url'] if url is not None: json_request['params']['filter'] = { 'field': 'url', 'operator': 'is', 'value': url } json_result = pykodi.execute_jsonrpc(json_request) if check_json_result(json_result, 'textures', json_request): return json_result['result']['textures'] else: return []
def _inner_get_item_list(mediatype, extraparams=None, overrideprops=None): assert mediatype in typemap mapped = typemap[mediatype] basestr = 'VideoLibrary.Get{0}s' if mediatype not in mediatypes.audiotypes else 'AudioLibrary.Get{0}s' json_request = get_base_json_request(basestr.format(mapped[0])) json_request['params']['sort'] = { 'method': 'sorttitle', 'order': 'ascending' } json_request['params'][ 'properties'] = mapped[1] if overrideprops is None else overrideprops if extraparams: json_request['params'].update(extraparams) json_result = pykodi.execute_jsonrpc(json_request) return json_request, json_result
def get_item_details(dbid, mediatype): assert mediatype in typemap mapped = typemap[mediatype] basestr = 'VideoLibrary.Get{0}Details' if mediatype not in mediatypes.audiotypes else 'AudioLibrary.Get{0}Details' json_request = get_base_json_request(basestr.format(mapped[0])) json_request['params'][mediatype + 'id'] = dbid json_request['params']['properties'] = mapped[1] if mapped[2]: json_request['params'].update(mapped[2]) json_result = pykodi.execute_jsonrpc(json_request) result_key = mediatype + 'details' if check_json_result(json_result, result_key, json_request): result = json_result['result'][result_key] if _needupgrade(mediatype): _upgradeitem(result, mediatype) return result
def _build_imagecachebase(self): result = pykodi.execute_jsonrpc({ "jsonrpc": "2.0", "id": 1, "method": "Settings.GetSettings", "params": { "filter": { "category": "control", "section": "services" } } }) port = 80 username = '' password = '' secure = False server_enabled = True if result.get('result', {}).get('settings'): for setting in result['result']['settings']: if setting[ 'id'] == 'services.webserver' and not setting['value']: server_enabled = False break if setting['id'] == 'services.webserverusername': username = setting['value'] elif setting['id'] == 'services.webserverport': port = setting['value'] elif setting['id'] == 'services.webserverpassword': password = setting['value'] elif setting['id'] == 'services.webserverssl' and setting[ 'value']: secure = True username = '******'.format( username, password) if username and password else '' else: server_enabled = False if server_enabled: protocol = 'https' if secure else 'http' self.imagecachebase = '{0}://{1}localhost:{2}/image/'.format( protocol, username, port) else: self.imagecachebase = None log(L(REMOTE_CONTROL_REQUIRED), xbmc.LOGWARNING)
def get_tvshows(moreprops=False, includeprops=True): json_request = get_base_json_request('VideoLibrary.GetTVShows') if includeprops: json_request['params']['properties'] = typemap[mediatypes.TVSHOW][1] + ['year', 'plot'] \ if moreprops else typemap[mediatypes.TVSHOW][1] json_request['params']['sort'] = { 'method': 'sorttitle', 'order': 'ascending' } json_result = pykodi.execute_jsonrpc(json_request) if check_json_result(json_result, 'tvshows', json_request): result = json_result['result']['tvshows'] if _needupgrade(mediatypes.TVSHOW): for tvshow in result: _upgradeitem(tvshow, mediatypes.TVSHOW) return result else: return []
def get_settingvalue(setting): json_request = get_base_json_request('Settings.GetSettingValue') json_request['params']['setting'] = setting json_result = pykodi.execute_jsonrpc(json_request) if check_json_result(json_result, None, json_request): return json_result['result']['value']
def get_application_properties(properties): json_request = get_base_json_request('Application.GetProperties') json_request['params']['properties'] = properties json_result = pykodi.execute_jsonrpc(json_request) if check_json_result(json_result, None, json_request): return json_result['result']