def update_addons(quiet=True): from distutils.version import LooseVersion if not quiet: kodi.open_busy_dialog() sources = DB.query("SELECT addon_id, source FROM install_history") update_count = 0 for source in sources: addon_id = source[0] source = json.loads(source[1]) if kodi.get_condition_visiblity("System.HasAddon(%s)" % addon_id): if source['type'] == SOURCES.ZIP: url, filename, full_name, version = github_api.find_zip( source['user'], addon_id) if LooseVersion(version) > LooseVersion(source['version']): GitHub_Installer(addon_id, url, full_name, kodi.vfs.join("special://home", "addons"), False, quiet) update_count += 1 elif source['type'] == SOURCES.REPO: full_name = sources['user'] + '/' + sources['repo'] xml_str = github_api.find_xml(full_name) xml = BeautifulSoup(xml_str) addon = xml.find('addon') if LooseVersion(addon['version']) > LooseVersion( source['version']): GitHub_Installer(addon_id, source['url'], full_name, kodi.vfs.join("special://home", "addons"), True, quiet) update_count += 1 if not quiet: kodi.close_busy_dialog() if update_count > 0: kodi.notify("Update complete", 'Some addons may require restarting kodi.') else: kodi.notify("Update complete", 'No updates found.')
def update_addons(quiet=True): from distutils.version import LooseVersion if not quiet: kodi.open_busy_dialog() sources = DB.query("SELECT addon_id, source FROM install_history") update_count = 0 for source in sources: addon_id = source[0] source = json.loads(source[1]) if kodi.get_condition_visiblity("System.HasAddon(%s)" % addon_id): if source['type'] == SOURCES.ZIP: url, filename, full_name, version = github_api.find_zip(source['user'], addon_id) if LooseVersion(version) > LooseVersion(source['version']): GitHub_Installer(addon_id, url, full_name, kodi.vfs.join("special://home", "addons"), False, quiet) update_count += 1 elif source['type'] == SOURCES.REPO: full_name = sources['user'] + '/' + sources['repo'] xml_str = github_api.find_xml(full_name) xml = BeautifulSoup(xml_str) addon = xml.find('addon') if LooseVersion(addon['version']) > LooseVersion(source['version']): GitHub_Installer(addon_id, source['url'], full_name, kodi.vfs.join("special://home", "addons"), True, quiet) update_count += 1 if not quiet: kodi.close_busy_dialog() if update_count > 0: kodi.notify("Update complete",'Some addons may require restarting kodi.') else: kodi.notify("Update complete",'No updates found.')
def feed_count(): from libs.database import DB try: count = DB.query("SELECT count(1) FROM feed_subscriptions")[0][0] except: count = 0 return count
def feed_count(): from libs.database import DB try: count = DB.query("SELECT count(1) FROM feed_subscriptions")[0][0] except: count = 0 return count
def _get_cached_response(url, cache_limit=0): if cache_limit == 0: return False, False, False else: cache_limit = float(cache_limit) * 3600 result = False SQL = "SELECT results, current_page, total_pages FROM cached_requests WHERE age < ? AND url=?" cache = DB.query(SQL, [cache_limit, url], force_double_array=False) if cache: kodi.log('Returning cached response') result = json.loads(cache[0]) return result, int(cache[1]), int(cache[2]) else: return False, False, False
def _get_cached_response(url, cache_limit=0): if cache_limit == 0: return False, False, False else: cache_limit = float(cache_limit) * 3600 result = False SQL = "SELECT results, current_page, total_pages FROM cached_requests WHERE age < ? AND url=?" cache = DB.query(SQL, [cache_limit, url], force_double_array=False) if cache: kodi.log('Returning cached response') result = json.loads(cache[0]) return result, int(cache[1]), int(cache[2]) else: return False, False, False
def install_feed(): if not kodi.dialog_confirm('Install Feed?', "Click YES to proceed."): return from libs.database import DB from libs import github xml = github.install_feed(kodi.arg('url')) try: for f in xml.findAll('feeds'): name = f.find('name').text url = f.find('url').text DB.execute("INSERT INTO feed_subscriptions(name, url) VALUES(?,?)", [name, url]) DB.commit() count = DB.query("SELECT count(1) FROM feed_subscriptions") kodi.set_setting('installed_feeds', str(count[0][0])) kodi.notify("Install Complete",'Feed Installed') except: kodi.notify("Install failed",'Invalid Format.')
def install_feed(): from libs.database import DB from libs import github if kodi.mode == 'install_feed': url = kodi.arg('url') xml = github.install_feed(url) else: url = kodi.dialog_file_browser('Select a feed file', mask='.zip') if not github.re_feed.search(url): return xml = github.install_feed(url, True) if not kodi.dialog_confirm('Install Feed?', "Click YES to proceed."): return try: for f in xml.findAll('feeds'): name = f.find('name').text url = f.find('url').text DB.execute("INSERT INTO feed_subscriptions(name, url) VALUES(?,?)", [name, url]) DB.commit() count = DB.query("SELECT count(1) FROM feed_subscriptions") kodi.set_setting('installed_feeds', str(count[0][0])) kodi.notify("Install Complete",'Feed Installed') except: kodi.notify("Install failed",'Invalid Format.')
def install_feed(): from libs.database import DB from libs import github if kodi.mode == 'install_feed': url = kodi.arg('url') xml = github.install_feed(url) else: url = kodi.dialog_file_browser('Select a feed file', mask='.zip') if not github.re_feed.search(url): return xml = github.install_feed(url, True) if not kodi.dialog_confirm('Install Feed?', "Click YES to proceed."): return try: for f in xml.findAll('feeds'): name = f.find('name').text url = f.find('url').text DB.execute("INSERT INTO feed_subscriptions(name, url) VALUES(?,?)", [name, url]) DB.commit() count = DB.query("SELECT count(1) FROM feed_subscriptions") kodi.set_setting('installed_feeds', str(count[0][0])) kodi.notify("Install Complete",'Feed Installed') except: kodi.notify("Install failed",'Invalid Format.')