From d70becaabf6dfc050e1e5afc6db0e268bd410c44 Mon Sep 17 00:00:00 2001 From: primaeval Date: Fri, 6 Jan 2017 21:16:45 +0100 Subject: [PATCH] ask for country --- main.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index cfd86c8..c84f217 100644 --- a/main.py +++ b/main.py @@ -1320,24 +1320,37 @@ def import_config(): site = f[:-4] if site in ini_country: log('[script.webgrab] duplicate ini found: %s' % site) - ini_country[site] = country + ini_country[site].append(country) + else: + ini_country[site] = [country] + f = xbmcvfs.File(config_file,"rb") data = f.read() match = re.findall(r'(.*?)',data) + ids = [] + sites = {} for m in match: attributes = m[0] name = m[1] site = re.search('site="(.*?)"',attributes).group(1) site_id = re.search('site_id="(.*?)"',attributes).group(1) xmltv_id = re.search('xmltv_id="(.*?)"',attributes).group(1) - country = ini_country.get(site,'') - if not country: - #TODO ask - log('[script.webgrab] country not found: %s' % country) - continue - id = "%s|%s|%s|%s|%s" % (country,name,site,site_id,xmltv_id) - channels[id] = -1 - + id = "%s|%s|%s|%s" % (name,site,site_id,xmltv_id) + ids.append(id) + sites[site] = site + for site in sites: + countries = ini_country[site] + if len(countries) > 1: + save = d.select('Choose Country',countries) + if save == -1: + ini_country[site] = [countries[0]] #maybe + else: + ini_country[site] = [countries[save]] + for id in ids: + site = id.split('|')[1] + country = ini_country[site][0] + new_id = "%s|%s" % (country,id) + channels[new_id] = -1 @plugin.route('/') def index():