Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.11 KB | None | 0 0
  1. def menu():
  2. addDir("[B]"+'Filmes'+"[/B]",baseurl,3,art + 'fllmes2.png',art + 'cinema2.jpg','')
  3. addDirf("[B]"+'Series'+"[/B]",baseseries,100,art +'series-tv.jpg')
  4. addDir("[B]"+'Animes'+"[/B]",'-',2,art+'animes.png',art+'fanart_animes.jpg','')
  5. addDir("[B]"+'Desenhos'+"[/B]",basedes,100,art+'kids.png',art+'desenhos-animados.jpg','')
  6. addDir("[B]"+'Lançamentos'+"[/B]",baseurl,11,art+'filmes.png',art+'filmes3.png','')
  7. addDir("[B]"+'Pesquisar Filmes'+"[/B]",'-',9,art + 'pesquisa.png',art +'Filmes-1.jpg','')
  8. addDir("[B]"+'Pesquisar Séries, Animes ou Desenhos'+"[/B]",'-',20,art + 'pesquisa.png',art+'procserandes.jpg','')
  9. xbmc.executebuiltin('Container.SetViewMode(51)')
  10.  
  11. def todas_categorias(url):
  12. link = abrir_url(url)
  13. match=re.compile('<li class="topcat"><a href="(.*?)" class="topcat">(.*?)</a>').findall(link)
  14. for url,name in match:
  15. if 'Dublado' in name:
  16. addDir('[COLOR white]'"[B]"+"Filmes "+ name.encode('utf-8')+"s"+"[/B]"'[/COLOR]',url,10,art + 'fllmes2.png',art + 'cinema2.jpg','')
  17. if 'Legendado' in name and 'Animes' not in name:
  18. addDir('[COLOR white]'"[B]"+"Filmes "+ name.encode('utf-8')+"s"+"[/B]"'[/COLOR]',url,21,art + 'fllmes2.png',art + 'cinema2.jpg','')
  19. if 'Nacional' in name:
  20. addDir('[COLOR white]'"[B]"+"Filmes Nacionais"+"[/B]"'[/COLOR]',url,22,art + 'fllmes2.png',art + 'cinema2.jpg','')
  21. xbmc.executebuiltin('Container.SetViewMode(51)')
  22. def catego_lanc(url):
  23. codigo_fonte = abrir_url(url)
  24. texto = re.findall('<li class="topcat selectedcat"><a href="http://www.redecanais.com/browse-filmes-videos-1-date.html"(.*?)</ul>',codigo_fonte,re.DOTALL)[0]
  25. match = re.compile('<li class=""><a href="(.*?)" class="">(.*?)</a> </li>').findall(texto)
  26. for url,name in match:
  27. if '2015' in name:
  28. addDir('[COLOR white]'"[B]"+clearname(name)+"[/B]"'[/COLOR]',url,4,art + 'fllmes2.png',art + 'cinema2.jpg','')
  29. if '2016' in name:
  30. addDir('[COLOR white]'"[B]"+clearname(name)+"[/B]"'[/COLOR]',url,4,art + 'fllmes2.png',art + 'cinema2.jpg','')
  31. xbmc.executebuiltin('Container.SetViewMode(51)')
  32.  
  33. def categ_lanc2(url):
  34. codigo_fonte = abrir_url(url)
  35. texto = re.findall('<li class="topcat"><a href="http://www.redecanais.com/browse-filmes-dublado-videos-1-date.html"(.*?)</ul>',codigo_fonte,re.DOTALL)[0]
  36. match = re.compile('<li class=""><a href="(.*?)" class="">(.*?)</a>').findall(texto)
  37. for url,name in match:
  38. if 'Legendado' not in url and 'Animes' not in url:
  39. addDir('[COLOR white]'"[B]"+clearname(name)+"[/B]"'[/COLOR]',url,4,art + 'fllmes2.png',art + 'cinema2.jpg','')
  40. xbmc.executebuiltin('Container.SetViewMode(51)')
  41. def categ_dub(url):
  42. codigo_fonte = abrir_url(url)
  43. texto = re.findall('<li class="topcat"><a href="http://www.redecanais.com/browse-filmes-dublado-videos-1-date.html"(.*?)</ul>',codigo_fonte,re.DOTALL)[0]
  44. match = re.compile('<li class=""><a href="(.*?)" class="">(.*?)</a>').findall(texto)
  45. for url,name in match:
  46. addDir('[COLOR white]'"[B]"+clearname(name)+"[/B]"'[/COLOR]',url,4,art + 'fllmes2.png',art + 'cinema2.jpg','')
  47. xbmc.executebuiltin('Container.SetViewMode(51)')
  48. def categ_leg(url):
  49. codigo_fonte = abrir_url(url)
  50. texto = re.findall('<li class="topcat"><a href="http://www.redecanais.com/browse-filmes-legendado-videos-1-date.html"(.*?)</ul>',codigo_fonte,re.DOTALL)[0]
  51. match = re.compile('<li class=""><a href="(.*?)" class="">(.*?)</a>').findall(texto)
  52. for url,name in match:
  53. addDir('[COLOR white]'"[B]"+clearname(name)+"[/B]"'[/COLOR]',url,4,art + 'fllmes2.png',art + 'cinema2.jpg','')
  54. xbmc.executebuiltin('Container.SetViewMode(51)')
  55. def categ_nac(url):
  56. codigo_fonte = abrir_url(url)
  57. texto = re.findall('<li class="topcat"><a href="http://www.redecanais.com/browse-filmes-nacional-videos-1-date.html"(.*?)</ul>',codigo_fonte,re.DOTALL)[0]
  58. match = re.compile('<li class=""><a href="(.*?)" class="">(.*?)</a>').findall(texto)
  59. for url,name in match:
  60. addDir('[COLOR white]'"[B]"+clearname(name)+"[/B]"'[/COLOR]',url,4,art + 'fllmes2.png',art + 'cinema2.jpg','')
  61. xbmc.executebuiltin('Container.SetViewMode(51)')
  62. def cat_animes(url):
  63. addDir("[B]"+'Animes Dublados'+"[/B]",baseanindub,15,art+'animes.png',art+'fanart_animes.jpg','')
  64. addDir("[B]"+'Animes Legendados'+"[/B]",baseaninleg,15,art+'animes.png',art+'fanart_animes.jpg','')
  65. def listar_filmes(url):
  66. link = abrir_url(url)
  67. match=re.compile('<a href="(.*?)" class="pm-thumb-fix pm-thumb-145"><span class="pm-thumb-fix-clip"><img src="(.*?)" alt="(.*?)" ').findall(link)
  68. for url,iconimage,name in match:
  69. addDirf(clearname(name),url,103,iconimage,False)
  70. xbmc.executebuiltin('Container.SetViewMode(500)')
  71. try:
  72. match=re.compile('<a href="(.*?)">(.*?)</a>').findall(link)
  73. for url,prox in match:
  74. if "&raquo;" in prox:
  75. addDir('[COLOR maroon][B]Next Page>>> [/B][/COLOR]',url,4,art+'Next_256.png','','')
  76. except:
  77. pass
  78.  
  79. ########################################series filipe#######################################
  80. def listarseries(url):
  81. html = abrir_url(url)
  82. itens = re.compile(r'<br />(.+?)</a>').findall(html)
  83. for item in itens:
  84. name = re.compile(r' (.+?)- <').findall(item)[0]
  85. if 'span' in name:
  86. name = re.compile(r'<br /> (.+?)- <').findall(item)[0]
  87. url = re.compile(r'href="(.+?)"').findall(item)[0]
  88. addDirf(clearname(name),'http://www.redecanais.com'+url,101,'-')
  89. def clearname(name):
  90. name = name.replace('&acirc;','â').replace('&eacute;','é').replace('&Uacute;','Ú').replace('&amp;','&').replace('&oacute;','ó').replace('&iacute;','í').replace('&atilde;','ã').replace('&rsquo;','’').replace('&aacute;','á').replace('&ccedil;','ç').replace('&ecirc;','ê').replace('&otilde;','õ').replace('&nbsp;','').replace('&Eacute;','É')
  91. return name
  92.  
  93. def listartemporadas(url):
  94. html = abrir_url(url)
  95. #img = re.compile(r'alt="(.+?)" /><br /> <strong>').findall(html)[0]
  96. if not re.compile(r'font-size: x-large;(.+?)Temporada').findall(html):
  97. return listarepisodios2('name',url,'img')
  98. itens = re.compile(r'font-size: x-large;(.+?Temporada)<').findall(html)
  99.  
  100. for item in itens:
  101. name = re.compile(r'">(.+?Temporada)').findall(item)[0]
  102. if 'strong' in name:
  103. name = re.compile(r'strong>(.+?Temporada)').findall(item)[0]
  104. addDirf(name.replace('&ordf;','ª'),url,102,'img')
  105.  
  106. def listarepisodios(name,url,iconimage):
  107. idd = re.compile(r'(.+?)ª Temporada').findall(name)[0]
  108. html = abrir_url(url)
  109. try:
  110. busc = idd+'&ordf; Temporada(.+?)<span'
  111. ht2 = re.compile(busc).findall(html)[0]
  112. except:
  113. busc = idd+'&ordf; Temporada(.+?)</p>'
  114. ht2 = re.compile(busc).findall(html)[0]
  115. itens = re.compile(r'(Epi.+?</a>.+?</a>)').findall(ht2)
  116. for item in itens:
  117. name = re.compile(r'(Epi.+?-)').findall(item)[0].replace('Epis&oacute;dio','Episódio').replace('-','')
  118. epis = re.compile(r'<a (href=.+?)</a>').findall(item)
  119. for episodio in epis:
  120. if 'Dublado' in episodio:
  121. name = name+' - Dublado'
  122. url = re.compile(r'href="(.+?)"').findall(episodio)[0]
  123. #print name
  124. #print url
  125. addDirf(name,url,103,iconimage,False)
  126. if 'Legendado' in episodio:
  127. name = name+' - Legendado'
  128. url = re.compile(r'href="(.+?)"').findall(episodio)[0]
  129. #print name
  130. #print url
  131. addDirf(name.replace(' - Dublado',''),url,103,iconimage,False)
  132. if 'Assistir' in episodio:
  133. name = name
  134. url = re.compile(r'href="(.+?)"').findall(episodio)[0]
  135. #print name
  136. #print url
  137. addDirf(name,url,103,iconimage,False)
  138.  
  139. def listarepisodios2(name,url,iconimage):
  140. html = abrir_url(url)
  141. itens = re.compile(r'<strong>(.+?)<br />').findall(html)
  142. for item in itens:
  143. try:
  144. name = re.compile(r'(Epis.+?)- </strong>').findall(item)[0].replace('Epis&oacute;dio','Episódio')
  145. except:
  146. name = re.compile(r'(Epis.+?) -&nbsp; - <a').findall(item)[0].replace('Epis&oacute;dio','Episódio')
  147. epis = re.compile(r'<a href=(.+?)</strong>').findall(item)
  148. print epis
  149. for episodio in epis:
  150. if 'Dublado' in episodio:
  151. name = name+' - Dublado'
  152. url = re.compile(r'"(.+?)"').findall(episodio)[0]
  153. addDirf(name,url,103,iconimage,False)
  154. if 'Legendado' in episodio:
  155. name = name+' - Legendado'
  156. url = re.compile(r'"(.+?)"').findall(episodio)[0].replace(' - Dublado','')
  157. addDirf(name,url,103,iconimage,False)
  158. if 'Assistir' in episodio:
  159. name = name
  160. url = re.compile(r'"(.+?)"').findall(episodio)[0]
  161. addDirf(name,url,103,iconimage,False)
  162.  
  163. def resolverredecanais(url):
  164. if not 'http://' in url:
  165. url = 'http://www.redecanais.com'+url
  166. xbmc.log(url)
  167. link = abrir_url(url)
  168. match=re.compile('<iframe name="Player" ="" src="(.*?)"').findall(link)[0]
  169. req = urllib2.Request(match)
  170. req.add_header('User-Agent', 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36')
  171. response = urllib2.urlopen(req)
  172. link=response.read()
  173. response.close()
  174. url = re.compile(r'file: "(.+?)"').findall(link)[0]
  175. return url
  176.  
  177. def player_rede_de_canais(name,url,iconimage):
  178. try:
  179. caixastatus = xbmcgui.DialogProgress()
  180. caixastatus.create(addon_name, 'Procurando e Resolvendo o Link..','Por Favor Aguarde...')
  181. pg=10
  182. caixastatus.update(pg)
  183. playlist = xbmc.PlayList(0)
  184. playlist.clear()
  185. link = resolverredecanais(url)
  186. listitem = xbmcgui.ListItem(name,thumbnailImage=iconimage)
  187. listitem.setInfo("Video", {"Title":name})
  188. listitem.setProperty('mimetype', 'video/mp4')
  189. playlist.add(link,listitem)
  190. pg=100
  191. caixastatus.update(pg)
  192. caixastatus.close()
  193. xbmcPlayer = xbmc.Player(xbmc.PLAYER_CORE_AUTO)
  194. xbmcPlayer.play(playlist)
  195. sys.exit(0)
  196. except:
  197. pass
  198. ######################################################################################################################################################
  199. def listar_animes(url):
  200. link = abrir_url(url)
  201. match=re.compile('<a href="(.*?)" class="pm-thumb-fix pm-thumb-145"><span class="pm-thumb-fix-clip"><img src="(.*?)" alt="(.*?)" ').findall(link)
  202. for url,img,name in match:
  203. addDir(name,url,16,img,img,'')
  204. xbmc.executebuiltin('Container.SetViewMode(500)')
  205. try:
  206. match=re.compile('<a href="(.*?)">(.*?)</a>').findall(link)
  207. for url,prox in match:
  208. if "&raquo;" in prox:
  209. addDir('[COLOR maroon][B]Next Page>>> [/B][/COLOR]',url,15,art+'Next_256.png','','')
  210. except:
  211. pass
  212. def listar_episodios_animes(url,iconimage):
  213. link = abrir_url(url)
  214. fanart=re.compile('<p itemprop="description"><p><img src="(.*?)" alt=').findall(link)
  215. for img in fanart:
  216. fig=img
  217. if 'hackgu-returner' in url:
  218. match=re.compile('<strong>(.*?)-.*?<a href="(.*?)" target=.*?><strong>Assistir</strong>').findall(link)
  219. elif 'dog-days-legendado' in url:
  220. match=re.compile('<strong>(.*?)- <strong><a href="(.*?)" target="_blank">Assistir</a>').findall(link)
  221. elif 'avatar-a-lenda-de-korra' in url:
  222. match=re.compile('<strong>(.*?) - <strong><a href="(.*?)" rel="nofollow" target="_blank">Assistir</a></strong><br />').findall(link)
  223. elif 'itsuka-tenma-no-kuro-usagi' in url:
  224. match=re.compile('<strong><a href="(.*?)".*?<strong>(.*?)</strong>').findall(link)
  225. for url,name in match:
  226. addDirf(clearname(name),url,103,img,False)
  227. xbmc.executebuiltin('Container.SetViewMode(51)')
  228. else:
  229. match=re.compile('<strong>(.*?)- <a href="(.*?)".*? target=.*?><strong>Assistir</strong></a><br />').findall(link)
  230. for name,url in match:
  231. if 'avatar-a-lenda-de-korra' not in url:
  232. url=base1+url
  233. name=name.replace('Epis&oacute;dio','Episodio').replace('</strong>','').replace('&atilde;','ã').replace('&eacute;','é').replace('&ccedil;','ç').replace('&aacute;','á').replace('&Eacute;','É').replace('&ocirc;','ô').replace('&oacute;','ó').replace('&acirc;','â').replace('&iacute;','í').replace('&Uacute;','Ú').replace('&uacute;','ú').replace('</span><br /> <strong>',' ').replace('&ecirc;','ê')
  234. if '<span style="font' not in name and 'avatar-a-lenda-de-korra' not in url:
  235. addDirf(clearname(name),url,103,img,False)
  236. xbmc.executebuiltin('Container.SetViewMode(51)')
  237. else:
  238. addDirf(clearname(name),url,103,img,False)
  239. xbmc.executebuiltin('Container.SetViewMode(51)')
  240. try:
  241. match=re.compile('<a href="(.*?)">(.*?)</a>').findall(link)
  242. for url,prox in match:
  243. if "&raquo;" in prox:
  244. addDir('[COLOR maroon][B]Next Page>>> [/B][/COLOR]',url,16,art+'Next_256.png','','')
  245. except:
  246. pass
  247. def listar_desenhos(url):
  248. html = gethtml(url)
  249. soup = html.find("ul",{"class":"cat_desenhos"})
  250. categorias = soup.findAll("li")
  251. for categoria in categorias:
  252. titulo = categoria.a.text
  253. url = categoria.a["href"]
  254. if 'Pantera' in titulo:
  255. addDir("[B]"+titulo.encode('utf-8')+"[/B]",url,19,art+'kids.png',art+'vintage2.png','')
  256. elif 'Hora da Aventura - Dublado' in titulo:
  257. addDir("[B]"+titulo.encode('utf-8')+"[/B]",url,19,art+'kids.png',art+'vintage2.png','')
  258. elif 'Avengers Assemble' in titulo:
  259. addDir("[B]"+titulo.encode('utf-8')+"[/B]",url,19,art+'kids.png',art+'vintage2.png','')
  260. elif 'Family Guy' in titulo:
  261. addDir("[B]"+titulo.encode('utf-8')+"[/B]",url,19,art+'kids.png',art+'vintage2.png','')
  262. elif 'Liga da Justi' in titulo:
  263. addDir("[B]"+titulo.encode('utf-8')+"[/B]",url,19,art+'kids.png',art+'vintage2.png','')
  264. else:
  265. addDir("[B]"+titulo.encode('utf-8')+"[/B]",url,18,art+'kids.png',art+'vintage2.png','')
  266. xbmcplugin.setContent(int(sys.argv[1]), 'movies')
  267. xbmc.executebuiltin('Container.SetViewMode(502)')
  268. def listar_desenhos2(url):
  269. link = abrir_url(url)
  270. match=re.compile('<a href="(.*?)" class="pm-thumb-fix pm-thumb-145"><span class="pm-thumb-fix-clip"><img src="(.*?)" alt="(.*?)" ').findall(link)
  271. for url,img,name in match:
  272. if 'A Pequena Sereia (Dublado)' in name:
  273. addDirf(name,url,103,art+'A Pequena Sereia Filme1.jpg',False)
  274. else:
  275. addDirf(name,url,103,img,False)
  276. xbmc.executebuiltin('Container.SetViewMode(502)')
  277. try:
  278. match=re.compile('<a href="(.*?)">(.*?)</a>').findall(link)
  279. for url,prox in match:
  280. if "&raquo;" in prox:
  281. addDir('[COLOR maroon][B]Next Page>>> [/B][/COLOR]',url,18,art+'Next_256.png','','')
  282. except:
  283. pass
  284. def listar_desenhos3(url):
  285. link = abrir_url(url)
  286. fanart=re.compile('<p><img src="(.*?)" alt=.*?/><br />').findall(link)
  287. for img in fanart:
  288. fig=img
  289. fanart2=re.compile('<p><img class="decoded" src="(.*?)" alt=').findall(link)
  290. for img2 in fanart2:
  291. fig2=img2
  292. if 'pantera-cor-de-rosa' in url:
  293. match=re.compile('<strong>(.*?)- <strong><a href="(.*?)" target="_blank">Assistir</a></strong><br />').findall(link)
  294. elif 'hora-de-aventura' in url:
  295. match=re.compile('<strong>(.*?) - <a href="(.*?)" target="_blank">Assistir</a></strong><br />').findall(link)
  296. else:
  297. match=re.compile('<strong>(.*?)- <a href="(.*?)".*? target=.*?><strong>Assistir</strong></a><br />').findall(link)
  298. for name,url in match:
  299. if 'http://' not in url:
  300. url=base1+url
  301. name=name.replace('Epis&oacute;dio','Episodio').replace('</strong>','').replace('&atilde;','ã').replace('&eacute;','é').replace('&ccedil;','ç').replace('&aacute;','á').replace('&Eacute;','É').replace('&ocirc;','ô').replace('&oacute;','ó').replace('&acirc;','â').replace('&iacute;','í').replace('&Uacute;','Ú').replace('&uacute;','ú').replace('</span><br /> <strong>',' ').replace('&ldquo;P&rdquo;','"P"').replace('&ecirc;','ê').replace('<strong>','').replace('&ordf;',' - ').replace('&ccedil;&otilde;','çõ').replace('<span style="font-size: x-large;">','').replace('</span>','').replace('<br />',' ')
  302. if '<span style="font' not in name and 'hora-de-aventura' not in url and 'musicvideo' not in url and 'liga-da-justica' not in url:
  303. if 'http://' not in url:
  304. url=base1+url
  305. addDirf(name,url,103,img,False)
  306. xbmc.executebuiltin('Container.SetViewMode(51)')
  307. elif 'hora-de-aventura' in url:
  308. addDirf(name,url,103,fig2,False)
  309. xbmc.executebuiltin('Container.SetViewMode(51)')
  310. elif 'musicvideo' in url and 'liga-da-justica' in url:
  311. addDirf(name,url,103,'',False)
  312. xbmc.executebuiltin('Container.SetViewMode(51)')
  313. else:
  314. addDirf(name,url,103,fig2,False)
  315. xbmc.executebuiltin('Container.SetViewMode(51)')
  316. try:
  317. match=re.compile('<a href="(.*?)">(.*?)</a>').findall(link)
  318. for url,prox in match:
  319. if "&raquo;" in prox:
  320. addDir('[COLOR maroon][B]Next Page>>> [/B][/COLOR]',url,16,art+'Next_256.png','','')
  321. except:
  322. pass
  323. def pegar_link(url):
  324. link = abrir_url(url)
  325. match=re.compile('<iframe name="Player" ="" src="(.*?)"').findall(link)
  326. for url in match:
  327. url=url.replace('serverf2','serverfdowns2')
  328. # addDir(url,url,1,'','','')file: "(.*?)",
  329. link = abrir_url(url)
  330. match1=re.compile('<a href="(.*?)" >').findall(link)
  331. for url1 in match1:
  332. if 'mp4' in url1:
  333. url1=url1.replace('?download','')
  334. print url1
  335. url = urlresolver.resolve(url1)
  336. url = urlresolver.resolve(url1)
  337. pg = 0
  338. caixastatus = xbmcgui.DialogProgress()
  339. caixastatus.create(addon_name, 'Procurando e Resolvendo o Link..','Por Favor Aguarde...')
  340. caixastatus.update(pg)
  341. playvideo(url)
  342. def pesquisa_series():
  343. keyb = xbmc.Keyboard('', 'Digite a Série, Anime ou Desenho Desejado...')
  344. keyb.doModal()
  345. if (keyb.isConfirmed()):
  346. search = keyb.getText()
  347. parametro_pesquisa=urllib.quote(search)
  348. url = 'http://www.redecanais.com/search.php?keywords='+parametro_pesquisa+'/'
  349. listar_series2(url)
  350. return
  351. def pesquisa():
  352. keyb = xbmc.Keyboard('', 'Digite o Filme Desejado...')
  353. keyb.doModal()
  354. if (keyb.isConfirmed()):
  355. search = keyb.getText()
  356. parametro_pesquisa=urllib.quote(search)
  357. url = 'http://www.redecanais.com/search.php?keywords='+parametro_pesquisa+'/'
  358. listar_filmes(url)
  359. return
  360. ##############################################################################################################
  361. ## FUNÇÕES ##
  362. ##############################################################################################################
  363. ##############################################################################################################
  364. def playvideo(url):
  365. pl=xbmc.PlayList(1)
  366. pl.clear()
  367. listitem = xbmcgui.ListItem(path=url, thumbnailImage=iconimage)
  368. xbmc.PlayList(1).add(url, listitem)
  369. xbmc.Player().play(pl)
  370. sys.exit(0)
  371. def RESOLVE(url):
  372. print url
  373. arquivo = url
  374. url1 = urlresolver.resolve(url)
  375. if url1:
  376. try:
  377. liz = xbmcgui.ListItem(path=url, thumbnailImage=iconimage)
  378. liz.setInfo(type="Video", infoLabels={ "Title": name })
  379. liz.setProperty("IsPlayable","true")
  380. liz.setPath(url1)
  381. xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
  382. except: pass
  383. else:
  384. liz = xbmcgui.ListItem(path=url, thumbnailImage=iconimage)
  385. liz.setInfo(type="Video", infoLabels={ "Title": name })
  386. liz.setProperty("IsPlayable","true")
  387. liz.setPath(url)
  388. xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
  389. def get_params():
  390. param=[]
  391. paramstring=sys.argv[2]
  392. if len(paramstring)>=2:
  393. params=sys.argv[2]
  394. cleanedparams=params.replace('?','')
  395. if (params[len(params)-1]=='/'):
  396. params=params[0:len(params)-2]
  397. pairsofparams=cleanedparams.split('&')
  398. param={}
  399. for i in range(len(pairsofparams)):
  400. splitparams={}
  401. splitparams=pairsofparams[i].split('=')
  402. if (len(splitparams))==2:
  403. param[splitparams[0]]=splitparams[1]
  404. return param
  405. def addDir(name,url,mode,iconimage,fanart,description):
  406. u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)+"&description="+urllib.quote_plus(description)
  407. ok=True
  408. liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
  409. liz.setInfo( type="Video", infoLabels={ "Title": name,"Plot":description} )
  410. liz.setProperty('fanart_image', fanart)
  411. if mode==1 or mode==8:
  412. liz.setProperty("IsPlayable","true")
  413. ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=False)
  414. else:
  415. ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
  416. return ok
  417. def addDirf(name,url,mode,iconimage,pasta=True,total=1,plot=''):
  418. u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
  419. ok=True
  420. liz=xbmcgui.ListItem(name, iconImage="iconimage", thumbnailImage=iconimage)
  421. liz.setProperty('fanart_image', iconimage)
  422. liz.setInfo( type="video", infoLabels={ "title": name, "plot": plot } )
  423. ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=pasta,totalItems=total)
  424. return ok
  425.  
  426. def gethtml(url):
  427. req = urllib2.Request(url)
  428. req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
  429. response = urllib2.urlopen(req)
  430. link = response.read()
  431. soup = BeautifulSoup(link)
  432. return soup
  433. def abrir_url(url):
  434. req = urllib2.Request(url)
  435. req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
  436. response = urllib2.urlopen(req)
  437. link=response.read()
  438. response.close()
  439. return link
  440. params=get_params()
  441. url=None
  442. name=None
  443. mode=None
  444. iconimage=None
  445. description=None
  446. site=None
  447. try:
  448. url=urllib.unquote_plus(params["url"])
  449. except:
  450. pass
  451. try:
  452. name=urllib.unquote_plus(params["name"])
  453. except:
  454. pass
  455. try:
  456. iconimage=urllib.unquote_plus(params["iconimage"])
  457. except:
  458. pass
  459. try:
  460. mode=int(params["mode"])
  461. except:
  462. pass
  463. try:
  464. description=urllib.unquote_plus(params["description"])
  465. except:
  466. pass
  467. if mode==None or url==None or len(url)<1:
  468. print ""
  469. menu()
  470. elif mode==1:RESOLVE(url)
  471. elif mode==2:cat_animes(url)
  472. elif mode==3:todas_categorias(url)
  473. elif mode==4:listar_filmes(url)
  474. elif mode==5:listar_links(url)
  475. elif mode==7:pegar_link(url)
  476. elif mode==8:playvideo(url)
  477. elif mode==9:pesquisa()
  478. elif mode==10:categ_dub(url)
  479. elif mode==11:catego_lanc(url)
  480. elif mode==15:listar_animes(url)
  481. elif mode==16:listar_episodios_animes(url,iconimage)
  482. elif mode==17:listar_desenhos(url)
  483. elif mode==18:listar_desenhos2(url)
  484. elif mode==19:listar_desenhos3(url)
  485. elif mode==20:pesquisa_series()
  486. elif mode==21:categ_leg(url)
  487. elif mode==22:categ_nac(url)
  488. elif mode==23:categ_lanc2(url)
  489.  
  490. elif mode ==100:
  491. listarseries(url)
  492. elif mode==101:
  493. listartemporadas(url)
  494. elif mode==102:
  495. listarepisodios(name,url,iconimage)
  496. elif mode==103:
  497. player_rede_de_canais(name,url,iconimage)
  498. xbmcplugin.endOfDirectory(int(sys.argv[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement