def load_showlist(favored = 0): if not os.path.exists(_database.DBFILE): _database.create_db() refresh_db() elif not favored: refresh = False command = 'select distinct mode from shows order by mode' modes = _database.execute_command(command, fetchall = True) mode_list = [element[0] for element in modes] for network in get_networks(): if _addoncompat.get_setting(network.SITE) == 'true' and network.SITE not in mode_list: refresh = True if refresh: refresh_db() _database.check_db_version() command = 'select series_title, mode, submode, url, favor, hide from shows order by series_title' shows = _database.execute_command(command, fetchall = True) for series_title, mode, sitemode, url, favor, hide in shows: if _addoncompat.get_setting(mode) == False: continue elif hide is 1: continue elif favored and not favor: continue add_show(series_title, mode, sitemode, url, favor = favor, hide = hide)
def get_show_data(series_title, mode = '', sitemode = '', url = ''): series_title = replace_signs(smart_unicode(series_title)) if not os.path.exists(_database.DBFILE): _database.create_db() _database.check_db_version() showdata = get_serie(series_title, mode, sitemode, url, forceRefresh = False) return showdata
def load_showlist(favored = 0): if not os.path.exists(_database.DBFILE): _database.create_db() refresh_db() elif not favored: refresh = False command = 'select distinct mode from shows order by mode' modes = _database.execute_command(command, fetchall = True) mode_list = [element[0] for element in modes] for network in get_networks(): if _addoncompat.get_setting(network.SITE) == 'true' and network.SITE not in mode_list: refresh = True if refresh: refresh_db() _database.check_db_version() command = 'select series_title, mode, submode, url, favor, hide from shows order by series_title' shows = _database.execute_command(command, fetchall = True) for series_title, mode, sitemode, url, favor, hide in shows: if _addoncompat.get_setting(mode) != 'true': continue elif hide is 1: continue elif favored and not favor: continue add_show(series_title, mode, sitemode, url, favor = favor, hide = hide)
def load_showlist(favored = 0): if not os.path.exists(_database.DBFILE): _database.create_db() refresh_db() elif not favored: refresh = False command = 'select distinct mode from shows order by mode' modes = _database.execute_command(command, fetchall = True) mode_list = [element[0] for element in modes] for network in get_networks(): if _addoncompat.get_setting(network.SITE) == 'true' and network.SITE not in mode_list: refresh = True if refresh: refresh_db() _database.check_db_version() command = "select * from shows where url <> '' and hide <> 1 and favor = ? order by series_title" shows = _database.execute_command(command, fetchall = True, values = [favored]) for show in shows: add_show( masterList = True, showdata = show)
def refresh_db(): if not os.path.isfile(_database.DBFILE): print "Creating db" _database.create_db() networks = get_networks() dialog = xbmcgui.DialogProgress() dialog.create(smart_utf8(xbmcaddon.Addon(id = ADDONID).getLocalizedString(39016))) total_stations = len(networks) current = 0 increment = 100.0 / total_stations all_shows = [] for network in networks: network_name = network.NAME if _addoncompat.get_setting(network.SITE) == 'true': percent = int(increment * current) dialog.update(percent, smart_utf8(xbmcaddon.Addon(id = ADDONID).getLocalizedString(39017)) + network.NAME, smart_utf8(xbmcaddon.Addon(id = ADDONID).getLocalizedString(39018))) showdata = network.masterlist() for show in showdata: series_title, mode, submode, url = show all_shows.append((smart_unicode(series_title.lower().strip()), smart_unicode(mode), smart_unicode(submode))) total_shows = len(showdata) current_show = 0 for show in showdata: percent = int((increment * current) + (float(current_show) / total_shows) * increment) dialog.update(percent, smart_utf8(xbmcaddon.Addon(id = ADDONID).getLocalizedString(39017)) + network.NAME, smart_utf8(xbmcaddon.Addon(id = ADDONID).getLocalizedString(39005)) + show[0]) get_serie(show[0], show[1], show[2], show[3], forceRefresh = False) current_show += 1 if (dialog.iscanceled()): return False current += 1 command = 'select tvdb_series_title , series_title, mode, submode, url from shows order by series_title' shows = _database.execute_command(command, fetchall = True) for show in shows: tvdb_series_title, series_title, mode, submode, url = show if ((smart_unicode(series_title.lower().strip()),smart_unicode(mode), smart_unicode(submode)) not in all_shows and (smart_unicode(tvdb_series_title.lower().strip()),smart_unicode(mode), smart_unicode(submode)) not in all_shows): command = 'delete from shows where series_title = ? and mode = ? and submode = ? and url = ?;' values = (series_title, mode, submode, url) print "Deleting - " + series_title + " " + mode + " " + submode + " " + url _database.execute_command(command, values, fetchone = True, commit = True)