def __init__(self): """ Initialise object """ auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_tokens_path()) self._api = ContentApi(auth, cache_path=kodiutils.get_cache_path()) # Workaround for Raspberry Pi 3 and older kodiutils.set_global_setting('videoplayer.useomxplayer', True)
def __init__(self): """ Initialise object """ self._auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_tokens_path()) self._api = ContentApi(self._auth, cache_path=kodiutils.get_cache_path())
def _remove_expired_metadata(keep_expired=None): """ Clear the cache """ path = kodiutils.get_cache_path() if not os.path.exists(path): return now = time() for filename in os.listdir(path): fullpath = path + filename if keep_expired and os.stat(fullpath).st_mtime + keep_expired > now: continue os.unlink(fullpath)
def clean(): """ Clear metadata (called from settings) """ cache_path = kodiutils.get_cache_path() _, files = kodiutils.listdir(cache_path) for filename in files: if not kodiutils.delete(os.path.join(cache_path, filename)): return kodiutils.ok_dialog(message=kodiutils.localize( 30721)) # Clearing local metadata failed kodiutils.set_setting('metadata_last_updated', '0') return kodiutils.ok_dialog( message=kodiutils.localize(30714)) # Local metadata is cleared
def __init__(self): """ Initialise object """ self._api = ContentApi(cache_path=kodiutils.get_cache_path())
def __init__(self): """ Initialise object """ self._api = ContentApi(None, cache_path=kodiutils.get_cache_path()) self._session = requests.session()