')
except:
plot = item.plot
plot = plot.replace(plot, "[COLOR bisque][B]" + plot + "[/B][/COLOR]")
plot = plot.replace("", "")
plot = plot.replace("", "")
plot = plot.replace("
", "")
plot = plot.replace("“", "")
plot = plot.replace("", "")
plot = plot.replace("", "")
plot = plot.replace(" ", "")
plot = scrapertools.decodeHtmlentities(plot)
plot = plot.replace(""", "")
except:
title = "[COLOR red][B]LO SENTIMOS...[/B][/COLOR]"
plot = "Esta serie no tiene informacion..."
plot = plot.replace(plot, "[COLOR yellow][B]" + plot + "[/B][/COLOR]")
photo = "http://s6.postimg.org/nm3gk1xox/noinfosup2.png"
foto = "http://s6.postimg.org/ub7pb76c1/noinfo.png"
info = ""
quit = "Pulsa" + " [COLOR blue][B]INTRO [/B][/COLOR]" + "para quitar"
try:
scrapedinfo = scrapertools.get_match(data, '(.*?)Título Original:')
infoformat = re.compile('(.*?:).*?(.*?)
', re.DOTALL).findall(scrapedinfo)
for info, info2 in infoformat:
scrapedinfo = scrapedinfo.replace(info2, "[COLOR bisque]" + info2 + "[/COLOR]")
scrapedinfo = scrapedinfo.replace(info, "[COLOR aqua][B]" + info + "[/B][/COLOR]")
info = scrapedinfo
info = re.sub(
r'|||| title=".*?"|alt=".*?"|>#2015||||||"|
|>,',
'', info)
info = info.replace("", " ")
info = info.replace("#", ",")
info = info.replace(">", "")
except:
info = "[COLOR skyblue][B]Sin informacion adicional...[/B][/COLOR]"
if "_serie_de_tv" in item.url:
foto = item.show.split("|")[2]
else:
foto = item.category
if item.show == item.thumbnail:
foto = "http://s6.postimg.org/mh3umjzkh/bityouthnofanventanuco.jpg"
photo = item.extra
quit = "Pulsa" + " [COLOR blue][B]INTRO [/B][/COLOR]" + "para quitar"
if "_serie_de_tv" in item.url:
NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml")
REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml")
APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml")
urllib.urlretrieve("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/noback.xml",
NOBACKDESTFILE)
urllib.urlretrieve(
"https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bityouth/remotenoback.xml",
REMOTENOBACKDESTFILE)
urllib.urlretrieve("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/appnoback.xml",
APPNOBACKDESTFILE)
xbmc.executebuiltin('Action(reloadkeymaps)')
ventana2 = TextBox1(title=title, plot=plot, info=info, thumbnail=photo, fanart=foto, quit=quit)
ventana2.doModal()
ACTION_GESTURE_SWIPE_LEFT = 511
ACTION_SELECT_ITEM = 7
class TextBox1(xbmcgui.WindowDialog):
""" Create a skinned textbox window """
def __init__(self, *args, **kwargs):
self.getTitle = kwargs.get('title')
self.getPlot = kwargs.get('plot')
self.getInfo = kwargs.get('info')
self.getThumbnail = kwargs.get('thumbnail')
self.getFanart = kwargs.get('fanart')
self.getQuit = kwargs.get('quit')
self.background = xbmcgui.ControlImage(70, 20, 1150, 630,
'http://s6.postimg.org/58jknrvtd/backgroundventana5.png')
self.title = xbmcgui.ControlTextBox(140, 60, 1130, 50)
self.quit = xbmcgui.ControlTextBox(145, 90, 1030, 45)
self.plot = xbmcgui.ControlTextBox(120, 150, 1056, 140)
self.info = xbmcgui.ControlFadeLabel(120, 310, 1056, 100)
self.thumbnail = xbmcgui.ControlImage(813, 43, 390, 100, self.getThumbnail)
self.fanart = xbmcgui.ControlImage(120, 365, 1060, 250, self.getFanart)
self.addControl(self.background)
self.addControl(self.title)
self.addControl(self.quit)
self.addControl(self.plot)
self.addControl(self.thumbnail)
self.addControl(self.fanart)
self.addControl(self.info)
self.title.setText(self.getTitle)
self.quit.setText(self.getQuit)
try:
self.plot.autoScroll(7000, 6000, 30000)
except:
print "Actualice a la ultima version de kodi para mejor info"
import xbmc
xbmc.executebuiltin(
'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000,"https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/kodi-icon.png")')
self.plot.setText(self.getPlot)
self.info.addLabel(self.getInfo)
def get(self):
self.show()
def onAction(self, action):
if action == ACTION_SELECT_ITEM or action == ACTION_GESTURE_SWIPE_LEFT:
import os
import xbmc
APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml")
NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml")
REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml")
APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml")
TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py")
try:
os.remove(NOBACKDESTFILE)
os.remove(REMOTENOBACKDESTFILE)
os.remove(APPNOBACKDESTFILE)
if os.path.exists(TESTPYDESTFILE):
urllib.urlretrieve(
"https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bityouth/customapp.xml",
APPCOMMANDDESTFILE)
xbmc.executebuiltin('Action(reloadkeymaps)')
except:
xbmc.executebuiltin('Action(reloadkeymaps)')
self.close()
def info_capitulos(item):
logger.info()
import xbmc
APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml")
try:
os.remove(APPCOMMANDDESTFILE)
except:
pass
item.category = item.show.split("|")[0]
item.thumbnail = item.show.split("|")[1]
url = "http://thetvdb.com/api/1D62F2F90030C444/series/" + item.show.split("|")[0] + "/default/" + \
item.extra.split("|")[0] + "/" + item.extra.split("|")[2] + "/es.xml"
data = scrapertools.cache_page(url)
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
patron = '.*?([^<]+).*?'
patron += '(.*?).*?'
matches = re.compile(patron, re.DOTALL).findall(data)
if len(matches) == 0:
title = "[COLOR red][B]LO SENTIMOS...[/B][/COLOR]"
plot = "Este capitulo no tiene informacion..."
plot = plot.replace(plot, "[COLOR yellow][B]" + plot + "[/B][/COLOR]")
foto = "http://s6.postimg.org/nm3gk1xox/noinfosup2.png"
image = "http://s6.postimg.org/ub7pb76c1/noinfo.png"
quit = "Pulsa" + " [COLOR greenyellow][B]INTRO [/B][/COLOR]" + "para quitar"
else:
for name_epi, info in matches:
if "episodes" in data:
foto = scrapertools.get_match(data, '.*?(.*?)')
fanart = "http://thetvdb.com/banners/" + foto
else:
fanart = item.show.split("|")[1]
plot = info
plot = plot.replace(plot, "[COLOR burlywood][B]" + plot + "[/B][/COLOR]")
title = name_epi.upper()
title = title.replace(title, "[COLOR skyblue][B]" + title + "[/B][/COLOR]")
image = fanart
foto = item.show.split("|")[1]
if not ".png" in item.show.split("|")[1]:
foto = "http://s6.postimg.org/rv2mu3pap/bityouthsinopsis2.png"
quit = "Pulsa" + " [COLOR greenyellow][B]INTRO [/B][/COLOR]" + "para quitar"
NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml")
REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml")
APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml")
TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py")
urllib.urlretrieve("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/noback.xml",
NOBACKDESTFILE)
urllib.urlretrieve(
"https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bityouth/remotenoback.xml",
REMOTENOBACKDESTFILE)
urllib.urlretrieve(
"https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/appnoback.xml",
APPNOBACKDESTFILE)
xbmc.executebuiltin('Action(reloadkeymaps)')
ventana = TextBox2(title=title, plot=plot, thumbnail=image, fanart=foto, quit=quit)
ventana.doModal()
ACTION_GESTURE_SWIPE_LEFT = 511
ACTION_SELECT_ITEM = 7
class TextBox2(xbmcgui.WindowDialog):
""" Create a skinned textbox window """
def __init__(self, *args, **kwargs):
self.getTitle = kwargs.get('title')
self.getPlot = kwargs.get('plot')
self.getThumbnail = kwargs.get('thumbnail')
self.getFanart = kwargs.get('fanart')
self.getQuit = kwargs.get('quit')
self.background = xbmcgui.ControlImage(70, 20, 1150, 630, 'http://s6.postimg.org/n3ph1uxn5/ventana.png')
self.title = xbmcgui.ControlTextBox(120, 60, 430, 50)
self.quit = xbmcgui.ControlTextBox(145, 90, 1030, 45)
self.plot = xbmcgui.ControlTextBox(120, 150, 1056, 100)
self.thumbnail = xbmcgui.ControlImage(120, 300, 1056, 300, self.getThumbnail)
self.fanart = xbmcgui.ControlImage(780, 43, 390, 100, self.getFanart)
self.addControl(self.background)
self.addControl(self.title)
self.addControl(self.quit)
self.addControl(self.plot)
self.addControl(self.thumbnail)
self.addControl(self.fanart)
self.title.setText(self.getTitle)
self.quit.setText(self.getQuit)
try:
self.plot.autoScroll(7000, 6000, 30000)
except:
print "Actualice a la ultima version de kodi para mejor info"
import xbmc
xbmc.executebuiltin(
'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000,"https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/kodi-icon.png")')
self.plot.setText(self.getPlot)
def get(self):
self.show()
def onAction(self, action):
if action == ACTION_SELECT_ITEM or action == ACTION_GESTURE_SWIPE_LEFT:
import os
import xbmc
APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml")
NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml")
REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml")
APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml")
TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py")
try:
os.remove(NOBACKDESTFILE)
os.remove(REMOTENOBACKDESTFILE)
os.remove(APPNOBACKDESTFILE)
if os.path.exists(TESTPYDESTFILE):
urllib.urlretrieve(
"https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bityouth/customapp.xml",
APPCOMMANDDESTFILE)
xbmc.executebuiltin('Action(reloadkeymaps)')
except:
xbmc.executebuiltin('Action(reloadkeymaps)')
self.close()
def translate(to_translate, to_langage="auto", langage="auto"):
###Traducción atraves de Google
'''Return the translation using google translate
you must shortcut the langage you define (French = fr, English = en, Spanish = es, etc...)
if you don't define anything it will detect it or use english by default
Example:
print(translate("salut tu vas bien?", "en"))
hello you alright?'''
agents = {
'User-Agent': "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"}
before_trans = 'class="t0">'
link = "http://translate.google.com/m?hl=%s&sl=%s&q=%s" % (to_langage, langage, to_translate.replace(" ", "+"))
request = urllib2.Request(link, headers=agents)
page = urllib2.urlopen(request).read()
result = page[page.find(before_trans) + len(before_trans):]
result = result.split("<")[0]
return result
if __name__ == '__main__':
to_translate = 'Hola como estas?'
print("%s >> %s" % (to_translate, translate(to_translate)))
print("%s >> %s" % (to_translate, translate(to_translate, 'fr')))
# should print Hola como estas >> Hello how are you
# and Hola como estas? >> Bonjour comment allez-vous?