aver que te parece esto
Código: Seleccionar todo
### CUENTAS #################################################
import re
conf_file = os.path.join(config.get_data_path(), 'pelisalacarta.conf')
f = open(conf_file, 'r')
data_conf_file = f.read()
f.close()
p = "\n(\w+[account|premium])\s=\s([^\n]+)\n"
p+= "(\w+user)\s=\s([^\n]+)\n"
p+= "(\w+password)\s=\s([^\n]+)"
cuentas = re.compile(p,re.DOTALL).findall(data_conf_file)
for chkd_key, chkd_value, user_key, user_value, pass_key, pass_value in cuentas:
nombre = re.sub(r'account|premium', '', chkd_key).capitalize()
Config = item
Config = Config.replace("{$title}","Usar "+nombre)
Config = Config.replace("{$control}","<input type='checkbox' id='"+chkd_key+"' " + checked_unchecked(chkd_value)+">")
itemlist_string = itemlist_string + Config
Config = item
Config = Config.replace("{$title}",nombre+" user")
Config = Config.replace("{$control}","<input type='text' id='"+user_key+"' value=" + user_value+">")
itemlist_string = itemlist_string + Config
Config = item
Config = Config.replace("{$title}",nombre+" password")
Config = Config.replace("{$control}","<input type='password' id='"+pass_key+"' value=" + pass_value+">")
itemlist_string = itemlist_string + Config
### CANALES PERSONALES ######################################
p = "\n(personalchannel.?)\s=\s([^\n]+)\n"
p+= "(personalchannelurl.?)\s=\s([^\n]+)\n"
p+= "(personalchannelname.?)\s=\s([^\n]+)\n"
p+= "(personalchannellogo.?)\s=\s([^\n]+)\n"
p+= "(personalchannelpage.?)\s=\s([^\n]+)"
canales_personales = re.compile(p,re.DOTALL).findall(data_conf_file)
n = 1
for chkd_key, chkd_value, url_key, url_value, name_key, name_value, logo_key, logo_value, page_key, page_value in canales_personales:
Config = item
Config = Config.replace("{$title}","Canal Personal "+str(n))
Config = Config.replace("{$control}","<input type='checkbox' id='"+chkd_key+"' " + checked_unchecked(chkd_value)+">")
itemlist_string = itemlist_string + Config
Config = item
Config = Config.replace("{$title}","Canal Personal "+str(n)+" Url")
Config = Config.replace("{$control}","<input type='text' id='"+url_key+"' value=" + url_value+">")
itemlist_string = itemlist_string + Config
Config = item
Config = Config.replace("{$title}","Canal Personal "+str(n)+" Nombre")
Config = Config.replace("{$control}","<input type='text' id='"+name_key+"' value=" + name_value+">")
itemlist_string = itemlist_string + Config
Config = item
Config = Config.replace("{$title}","Canal Personal "+str(n)+" Logo")
Config = Config.replace("{$control}","<input type='text' id='"+logo_key+"' value=" + logo_value+">")
itemlist_string = itemlist_string + Config
Config = item
Config = Config.replace("{$title}","Canal Personal "+str(n)+" Page")
Config = Config.replace("{$control}","<input type='text' id='"+page_key+"' value=" + page_key+">")
itemlist_string = itemlist_string + Config
n+= 1
#############################################################
Quizás algún valiente consigue reducirlo más pero así ya despeja bastante el launcher
