Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- #------------------------------------------------------------
- # streamondemand.- XBMC Plugin
- # Canale Video Corsi Programmazione
- # Creato dall'utente costaplus
- # http://www.mimediacenter.info/foro/viewforum.php?f=36.
- #------------------------------------------------------------
- import os
- import re
- import urllib2
- import urlparse
- import xbmc
- import xbmcgui
- from core import config
- from core import logger
- from core import scrapertools
- from core.item import Item
- #from servers import servertools
- from lib import transmissionrpc
- __channel__ = "tntvillage"
- __category__ = "D"
- __type__ = "generic"
- __title__ = "tntvillage (IT)"
- __language__ = "IT"
- DEBUG = config.get_setting("debug")
- tutti = "http://www.tntvillage.scambioetico.org/rss.php?c=4&p=900"
- def isGeneric():
- return True
- def mainlist(item):
- logger.info("streamondemand.tntvillage mainlist")
- itemlist = []
- itemlist.append(Item(channel=__channel__, title="[COLOR azure]TnTVillage - Film[/COLOR]", action="elenca",url=tutti,thumbnail="http://forum.tntvillage.scambioetico.org/style_images/mkportal-636/tntlogo2012.png"))
- #itemlist.append(Item(channel=__channel__, title="[COLOR orange]Elenco Torrent attivi n: %s[/COLOR]" % conta(), action="elenca_torrent", url="", thumbnail="https://raymii.org/s/inc/img/transmission.png"))
- itemlist.append(Item(channel=__channel__, title="[COLOR azure]cerca ...[/COLOR]", action="search", url=tutti,thumbnail="http://forum.tntvillage.scambioetico.org/style_images/mkportal-636/tntlogo2012.png"))
- #itemlist.append(Item(channel=__channel__, title="[COLOR orange]Elenco Torrent attivi n: %s[/COLOR]",action="elenca_torrent", url="", thumbnail="https://raymii.org/s/inc/img/transmission.png"))
- return itemlist
- def elenca(item):
- itemlist = []
- data = scrapertools.cache_page(item.url,timeout=10)
- patron = '<item>\s*<title>(.*?)</title>\s*<link>(.*?)</link>'
- matches = re.compile(patron, re.DOTALL).findall(data)
- scrapertools.printMatches(matches)
- #a =scrapertools.find_single_match("<enclosure>")
- #xbmc.log(a)
- # scrapedTorrent
- for scrapedtitle,scraperurl in matches:
- xbmc.log(scrapedtitle)
- scrapedthumbnail=""
- scrapedplot =""
- scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle)
- itemlist.append(Item(channel=__channel__,action="", fulltitle=scrapedtitle,show=scrapedtitle,title=scrapedtitle, url=scraperurl, thumbnail="", plot="", folder=True))
- try:
- plot, fanart, poster, extrameta = info(title)
- itemlist.append(Item(channel=__channel__, action="play", fulltitle=scrapedtitle, show=scrapedtitle,
- title="[COLOR darkkhaki].torrent [/COLOR]""[COLOR azure]" + scrapedtitle + "[/COLOR]",
- url=scraperurl, thumbnail=poster, plot=str(plot), extrameta=extrameta,
- fanart=fanart if fanart != "" else poster, folder=True))
- except:
- itemlist.append(Item(channel=__channel__, action="play", fulltitle=scrapedtitle, show=scrapedtitle,
- title="[COLOR darkkhaki].torrent [/COLOR]""[COLOR azure]" + scrapedtitle + "[/COLOR]",
- url=scraperurl, thumbnail=scrapedthumbnail, plot=scrapedplot, folder=True))
- return itemlist
- def search(item,text):
- logger.info("streamondemand.tntvillage cerca")
- itemlist = []
- item.url= "%s&f=%s" % (item.url,text +str("%"))
- xbmc.log(item.url)
- return elenca(item)
- def rss(item):
- logger.info("streamondemand.tntvillage rss")
- itemlist = []
- numero=xbmcgui.Dialog().numeric(0, 'quantità ?','10')
- pagina = item.url % numero
- data = scrapertools.cache_page(pagina)
- patron = '<enclosure url="(.*?)"'
- matches = re.compile(patron, re.DOTALL).findall(data)
- scrapertools.printMatches(matches)
- #scrapedTorrent
- for scrapedtitle in matches:
- xbmc.log(scrapedtitle)
- scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle)
- itemlist.append(Item(channel=__channel__,
- action="scarica",
- fulltitle=scrapedtitle,
- show=scrapedtitle,
- title=scrapedtitle,
- url=scrapedtitle,
- thumbnail="",
- plot="",
- folder=True))
- return itemlist
- def info(title):
- logger.info("streamondemand.tntvillate info")
- try:
- from core.tmdb import Tmdb
- oTmdb = Tmdb(texto_buscado=title, tipo="movie", include_adult="false", idioma_busqueda="it")
- if oTmdb.total_results > 0:
- extrameta = {"Year": oTmdb.result["release_date"][:4],
- "Genre": ", ".join(oTmdb.result["genres"]),
- "Rating": float(oTmdb.result["vote_average"])}
- fanart = oTmdb.get_backdrop()
- poster = oTmdb.get_poster()
- plot = oTmdb.get_sinopsis()
- return plot, fanart, poster, extrameta
- except:
- pass
Advertisement
Add Comment
Please, Sign In to add comment