diff --git a/plugin.video.alfa/channels/altadefinizione01.json b/plugin.video.alfa/channels/altadefinizione01.json new file mode 100644 index 00000000..8f1a1c74 --- /dev/null +++ b/plugin.video.alfa/channels/altadefinizione01.json @@ -0,0 +1,61 @@ +{ + "id": "altadefinizione01", + "name": "Altadefinizione01", + "language": ["ita"], + "active": true, + "adult": false, + "thumbnail": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/altadefinizione01.png", + "banner": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/altadefinizione01.png", + "categories": [ + "movie", + "top channels" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": false, + "visible": false + }, + + { + "id": "include_in_newest_film", + "type": "bool", + "label": "Includi in novità - Film", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "comprueba_enlaces", + "type": "bool", + "label": "Verifica se i link esistono", + "default": false, + "enabled": true, + "visible": true + }, + { + "id": "comprueba_enlaces_num", + "type": "list", + "label": "Numero de link da verificare", + "default": 1, + "enabled": true, + "visible": "eq(-1,true)", + "lvalues": [ "5", "10", "15", "20" ] + }, + { + "id": "filter_languages", + "type": "list", + "label": "Mostra link in lingua...", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": [ + "Non filtrare", + "IT" + ] + } + ] +} diff --git a/plugin.video.alfa/channels/altadefinizione01.py b/plugin.video.alfa/channels/altadefinizione01.py new file mode 100644 index 00000000..36b914ab --- /dev/null +++ b/plugin.video.alfa/channels/altadefinizione01.py @@ -0,0 +1,375 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# *AddonNamer* - XBMC Plugin +# Canale per altadefinizione01 +# ------------------------------------------------------------ +import re +import urlparse + +from channels import autoplay +from channels import filtertools +from core import scrapertools, servertools, httptools, tmdb, scrapertoolsV2 +from core.item import Item +from platformcode import logger, config + +#URL che reindirizza sempre al dominio corrente +host = "https://altadefinizione01.to" + +IDIOMAS = {'Italiano': 'IT'} +list_language = IDIOMAS.values() +list_servers = ['openload', 'streamango', 'rapidvideo', 'streamcherry', 'megadrive'] +list_quality = ['default'] + +__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'altadefinizione01') +__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'altadefinizione01') + +headers = None +blacklist_categorie = ['Altadefinizione01', 'Altadefinizione.to'] + + +def mainlist(item): + logger.info("kod.altadefinizione01 mainlist") + + autoplay.init(item.channel, list_servers, list_quality) + + itemlist = [Item(channel=item.channel, + title="[COLOR azure]In sala[/COLOR]", + action="sala", + url="%s/page/1/" % host, + thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), + Item(channel=item.channel, + title="[COLOR azure]Ultimi film inseriti[/COLOR]", + action="peliculas", + url="%s/page/1/" % host, + thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), + Item(channel=item.channel, + title="[COLOR azure]Sub ITA[/COLOR]", + action="subIta", + url="%s/sub-ita/" % host, + thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), + Item(channel=item.channel, + title="[COLOR azure]Categorie film[/COLOR]", + action="categorias", + url=host, + thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), + Item(channel=item.channel, + title="[COLOR yellow]Cerca...[/COLOR]", + action="search", + extra="movie", + thumbnail="http://dc467.4shared.com/img/fEbJqOum/s7/13feaf0c8c0/Search")] + + autoplay.show_option(item.channel, itemlist) + + return itemlist + + +def newest(categoria): + logger.info("kod.altadefinizione01 newest" + categoria) + itemlist = [] + item = Item() + try: + if categoria == "film": + item.url = host + item.action = "peliculas" + itemlist = peliculas(item) + + if itemlist[-1].action == "peliculas": + itemlist.pop() + + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + logger.error("{0}".format(line)) + return [] + + return itemlist + + +def createItem(data, item, itemlist, scrapedurl, scrapedtitle, scrapedthumbnail, scrapedquality, subDiv, subText): + info = scrapertoolsV2.find_multiple_matches(data, '([0-9]+)+<\/span>.*?(.*?)<\/span>.*?

(.*?)<\/p>.*?') + infoLabels = {} + for infoLabels['year'], duration, scrapedplot, checkUrl in info: + if checkUrl == scrapedurl: + break + + infoLabels['duration'] = int(duration.replace(' min', '')) * 60 # calcolo la durata in secondi + scrapedthumbnail = host + scrapedthumbnail + scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle) + fulltitle = scrapedtitle + if subDiv: + fulltitle += ' (' + subText + ')' + fulltitle += ' [' + scrapedquality.strip() + ']' + + itemlist.append( + Item(channel=item.channel, + action="findvideos", + text_color="azure", + contentType="movie", + contentTitle=scrapedtitle, + contentQuality=scrapedquality.strip(), + plot=scrapedplot, + title=fulltitle, + url=scrapedurl, + infoLabels=infoLabels, + thumbnail=scrapedthumbnail)) + + +def sala(item): + logger.info("kod.altadefinizione01 peliculas") + itemlist = [] + + # Carica la pagina + data = httptools.downloadpage(item.url, headers=headers).data + + # The categories are the options for the combo + patron = '

.*?
.*?(.*?)<\/div>.(
(.*?)<\/div>|())' + matches = scrapertoolsV2.find_multiple_matches(data, patron) + + for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedquality, subDiv, subText, empty in matches: + createItem(data, item, itemlist, scrapedurl, scrapedtitle, scrapedthumbnail, scrapedquality, subDiv, subText) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + return itemlist + + +def subIta(item): + logger.info("kod.altadefinizione01 subita") + return peliculas(item, sub=True) + + +def peliculas(item, sub=False): + logger.info("kod.altadefinizione01 peliculas") + itemlist = [] + + # Carica la pagina + data = httptools.downloadpage(item.url, headers=headers).data + + # The categories are the options for the combo + patron = '
(.*?)<\/a>.*?(.*?)<\/div>.(
(.*?)<\/div>|())' + matches = scrapertoolsV2.find_multiple_matches(data, patron) + + for scrapedurl, scrapedtitle, scrapedthumbnail, scrapedquality, subDiv, subText, empty in matches: + if sub or not subDiv: + createItem(data, item, itemlist, scrapedurl, scrapedtitle, scrapedthumbnail, scrapedquality, subDiv, subText) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + # Paginazione + patronvideos = '[^<]+[^<]+' + matches = re.compile(patronvideos, re.DOTALL).findall(data) + + if len(matches) > 0: + scrapedurl = urlparse.urljoin(item.url, matches[0]) + action = "peliculas" if not sub else "subIta" + itemlist.append( + Item(channel=item.channel, + action=action, + title="[COLOR lightgreen]" + config.get_localized_string(30992) + "[/COLOR]", + url=scrapedurl, + thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png", + folder=True)) + + return itemlist + + +def categorias(item): + logger.info("kod.altadefinizione01 categorias") + itemlist = [] + + # data = scrapertools.cache_page(item.url) + data = httptools.downloadpage(item.url, headers=headers).data + + # Narrow search by selecting only the combo + bloque = scrapertools.get_match(data, '
    (.*?)
') + + # The categories are the options for the combo + patron = '
  • (.*?)
  • ' + matches = re.compile(patron, re.DOTALL).findall(bloque) + + for scrapedurl, scrapedtitle in matches: + if not scrapedtitle in blacklist_categorie: + scrapedurl = host + scrapedurl + itemlist.append( + Item(channel=item.channel, + action="subIta", + title="[COLOR azure]" + scrapedtitle + "[/COLOR]", + url=scrapedurl, + thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png", + folder=True)) + + return itemlist + + +def search(item, texto): + logger.info("[altadefinizione01.py] " + item.url + " search " + texto) + item.url = "%s/index.php?do=search&story=%s&subaction=search" % ( + host, texto) + try: + if item.extra == "movie": + return subIta(item) + if item.extra == "tvshow": + return peliculas_tv(item) + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + logger.error("%s" % line) + return [] + + +def findvideos(item): + logger.info("[altadefinizione01.py] findvideos") + + # Carica la pagina + if item.contentType == "episode": + data = item.url + else: + data = httptools.downloadpage(item.url, headers=headers).data + + itemlist = servertools.find_video_items(data=data) + + for videoitem in itemlist: + videoitem.title = "".join([item.title, '[COLOR green][B]' + videoitem.title + '[/B][/COLOR]']) + videoitem.fulltitle = item.fulltitle + videoitem.show = item.show + videoitem.thumbnail = item.thumbnail + videoitem.channel = item.channel + videoitem.contentType = item.contentType + videoitem.language = IDIOMAS['Italiano'] + + # Requerido para Filtrar enlaces + + if __comprueba_enlaces__: + itemlist = servertools.check_list_links(itemlist, __comprueba_enlaces_num__) + + # Requerido para FilterTools + + itemlist = filtertools.get_links(itemlist, item, list_language) + + # Requerido para AutoPlay + + autoplay.start(itemlist, item) + + if item.contentType != 'episode': + if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'findvideos': + itemlist.append( + Item(channel=item.channel, title='[COLOR yellow][B]Aggiungi alla videoteca[/B][/COLOR]', url=item.url, + action="add_pelicula_to_library", extra="findvideos", contentTitle=item.contentTitle)) + + return itemlist + + +""" def peliculas_tv(item): + logger.info("kod.altadefinizionezone peliculas") + itemlist = [] + + # Carica la pagina + data = httptools.downloadpage(item.url, headers=headers).data + patron = '
    (.*?)
    ' + data = scrapertools.find_single_match(data, patron) + + # Estrae i contenuti + patron = '

    (.*?)

    ' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedtitle in matches: + scrapedplot = "" + scrapedthumbnail = "" + scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle) + itemlist.append( + Item(channel=item.channel, + action="seasons", + fulltitle=scrapedtitle, + contentType='tv', + contentTitle=scrapedtitle, + show=scrapedtitle, + title="[COLOR azure]" + scrapedtitle + "[/COLOR]", + url=scrapedurl, + thumbnail=scrapedthumbnail, + plot=scrapedplot, + folder=True)) + + tmdb.set_infoLabels(itemlist) + + # Paginazione + patronvideos = '.*?.*?href="(.*?)">' + matches = re.compile(patronvideos, re.DOTALL).findall(data) + + if matches: + scrapedurl = urlparse.urljoin(item.url, matches[0]) + itemlist.append( + Item(channel=item.channel, + action="peliculas_tv", + title="[COLOR lightgreen]" + config.get_localized_string(30992) + "[/COLOR]", + url=scrapedurl, + thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png", + folder=True)) + + return itemlist + + +def seasons(item): + itemlist = [] + + data = httptools.downloadpage(item.url, headers=headers).data + patron = '
  • (.*?)
  • ' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedseason in matches: + scrapedurl = item.url + scrapedurl + scrapedtitle = item.title + + itemlist.append( + Item(channel=item.channel, + action="episodios", + fulltitle=scrapedtitle, + show=scrapedtitle, + title="[COLOR azure]" + scrapedtitle + "[/COLOR]" + " " + "Stagione " + scrapedseason, + url=scrapedurl, + thumbnail=item.scrapedthumbnail, + plot=item.scrapedplot, + folder=True)) + + return itemlist + + +def episodios(item): + itemlist = [] + + data = httptools.downloadpage(item.url, headers=headers).data + patron = 'class="tab-pane fade" id="%s">(.*?)class="tab-pane fade"' % item.url.split('#')[1] + bloque = scrapertools.find_single_match(data, patron) + patron = 'class="text-muted">.*?<[^>]+>(.*?)<[^>]+>[^>]+>[^>][^>]+>[^<]+') + if next_page != "": + itemlist.append( + Item(channel=item.channel, + action="fichas", + title="[COLOR lightgreen]" + config.get_localized_string(30992) + "[/COLOR]", + url=next_page, + thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png")) + + return itemlist + +def fichas_src(item): + logger.info("[altadefinizioneclick.py] fichas") + + itemlist = [] + + # Carica la pagina + data = httptools.downloadpage(item.url, headers=headers).data + + patron = '\s*]+>[^<]+<[^>]+>\s*(.*?)<' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedthumbnail, scrapedtitle in matches: + + title = scrapertools.decodeHtmlentities(scrapedtitle) + clean_title = re.sub(r'\(\d+\.?\d*\)', '', title).strip() + + # ------------------------------------------------ + scrapedthumbnail = httptools.get_url_headers(scrapedthumbnail) + # ------------------------------------------------ + + itemlist.append( + Item(channel=item.channel, + action="findvideos", + contentType="movie", + contentTitle=clean_title, + title="[COLOR azure]" + title + "[/COLOR]", + url=scrapedurl, + thumbnail=scrapedthumbnail, + fulltitle=title, + show=title)) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + # Pagination + next_page = scrapertools.find_single_match(data, '.*?[^<]+(.*?)' + data = httptools.downloadpage(item.url, headers=headers).data + elenco = scrapertools.find_single_match(data, patron, 0) + + patron = '(.*?)' + elenco_link = scrapertools.find_multiple_matches(elenco, patron) + + for scrapedurl, scrapedtitle in elenco_link: + data = httptools.downloadpage(scrapedurl, headers=headers).data + if 'protectlink' in data: + urls = scrapertools.find_multiple_matches(data, r'') + data = httptools.downloadpage(url, headers=headers).data + blocco = scrapertools.find_single_match(data, r'

    STAGIONE

    \s*
      (.*?)
    ') + seasons = re.findall(r']*>([^<]+)', blocco, re.DOTALL) + + for scrapedurl, season in seasons: + itemlist.append( + Item(channel=item.channel, + action="episodes", + contentType=item.contentType, + title="Stagione: %s" % season, + text_color="azure", + url="https://hdpass.net/%s" % scrapedurl, + thumbnail=item.thumbnail, + fulltitle=item.fulltitle, + show=item.show)) + + return itemlist + + +def episodes(item): + logger.info("[italiafilmvideohd.py] episodes") + itemlist = [] + + data = httptools.downloadpage(item.url, headers=headers).data + blocco = scrapertools.find_single_match(data, r'
    (.*?)
    ') + episodes = re.findall(r']*>([^<]+)', blocco, re.DOTALL) + + for scrapedurl, episode in episodes: + itemlist.append( + Item(channel=item.channel, + action="findvid_series", + contentType=item.contentType, + title="Episodio: %s" % episode, + text_color="azure", + url="https://hdpass.net/%s" % scrapedurl, + thumbnail=item.thumbnail, + fulltitle=item.fulltitle, + show=item.show)) + + return itemlist + + +def findvideos(item): + logger.info("[italiafilmvideohd.py] findvideos") + + itemlist = [] + + # Carica la pagina + data = httptools.downloadpage(item.url, headers=headers).data + + patron = r'
    ', data, re.DOTALL) + + if urls: + for url in urls: + url, c = unshortenit.unshorten(url) + data += url + '\n' + + itemlist += servertools.find_video_items(data=data) + + for videoitem in itemlist: + videoitem.title = "[[COLOR green][B]%s[/B][/COLOR]] %s" % (videoitem.title.capitalize(), item.title) + videoitem.fulltitle = item.fulltitle + videoitem.show = item.show + videoitem.thumbnail = item.thumbnail + videoitem.channel = item.channel + videoitem.contentType = item.contentType + videoitem.language = IDIOMAS['Italiano'] + + # Requerido para Filtrar enlaces + + if __comprueba_enlaces__: + itemlist = servertools.check_list_links(itemlist, __comprueba_enlaces_num__) + + # Requerido para FilterTools + + itemlist = filtertools.get_links(itemlist, item, list_language) + + # Requerido para AutoPlay + + autoplay.start(itemlist, item) + + + + if item.contentType != 'episode': + if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'findvideos': + itemlist.append( + Item(channel=item.channel, title='[COLOR yellow][B]Aggiungi alla videoteca[/B][/COLOR]', url=item.url, + action="add_pelicula_to_library", extra="findvideos", contentTitle=item.contentTitle)) + + return itemlist diff --git a/plugin.video.alfa/channels/programmazione.json b/plugin.video.alfa/channels/programmazione.json new file mode 100644 index 00000000..d6a78d98 --- /dev/null +++ b/plugin.video.alfa/channels/programmazione.json @@ -0,0 +1,25 @@ +{ + "id": "programmazione", + "name": "Programmazione", + "language": ["it"], + "active": true, + "adult": false, + "language": "it", + "thumbnail": "http://www.smartworld.it/wp-content/uploads/2015/02/codice-code-programmazione-fhd-720x480.png", + "banner": "http://www.smartworld.it/wp-content/uploads/2015/02/codice-code-programmazione-fhd-720x480.png", + "version": "7", + "date": "26/05/2017", + "changes": "re-added", + "categories": ["documentary"], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": false, + "visible": false + } + ] +} + diff --git a/plugin.video.alfa/channels/programmazione.py b/plugin.video.alfa/channels/programmazione.py new file mode 100644 index 00000000..739f3657 --- /dev/null +++ b/plugin.video.alfa/channels/programmazione.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Kodi on Demand - Kodi Addon +# Canale Video Corsi Programmazione +# Creato da iSOD +# https://alfa-addon.com/categories/kod-addon.50/. +# ------------------------------------------------------------ +import re + +from core import httptools, scrapertools +from platformcode import logger, config +from core.item import Item + + + +site = "https://www.youtube.com" + + +def mainlist(item): + logger.info("kod.programmazione mainlist") + itemlist = [] + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Html 5[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL7A4A3449C649048F", thumbnail="http://i.ytimg.com/vi/TyCvfNt20nM/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Css[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PLD74C5E763D39793D", thumbnail="http://i.ytimg.com/vi/hd8k82aG_O4/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Javascript[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL1A447BA7F7F9EB9E", thumbnail="http:////i.ytimg.com/vi/eXlzdxyThLM/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso PHP[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL0qAPtx8YtJc664i2Cv0X0ibM9b1YqRyd", thumbnail="http://i.ytimg.com/vi/0nA1gPWdBWw/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso PHP Mysql[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL101314D973955661", thumbnail="http://i.ytimg.com/vi/QIxmITjITY8/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Jquery[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PLC959BB22285B353F", thumbnail="http://i.ytimg.com/vi/mxl2IcNdbrk/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Java da Zero[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL0qAPtx8YtJe2dpE7di4aPJwrQuRD6IDD", thumbnail="http://i.ytimg.com/vi/7PGPLqFpDMc/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Java 2 OOP[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL0qAPtx8YtJee1dk24wX-68yHTnMfzdX5", thumbnail="http://i.ytimg.com/vi/h6VoxIAUZoo/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Java Interfaccia Grafica[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL0qAPtx8YtJfRML8EDs7v9nwjdOt6dvaf", thumbnail="http://i.ytimg.com/vi/fS7OxhbIlw4/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Java Android[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL0qAPtx8YtJeqmBWbE1Rbac2QWHoPCjR2", thumbnail="http://i.ytimg.com/vi/GINLfdq-elE/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Progettazione DB[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL0qAPtx8YtJcJPSV4sOfhLtPbtQ-yycFH", thumbnail="http://i.ytimg.com/vi/FnkL4YdWAwE/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso SQL[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PLE555DB6188C967AC", thumbnail="http://i.ytimg.com/vi/jM55Fb9YTfE/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Python[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PLC64779F4E2E7EB10", thumbnail="http://i.ytimg.com/vi/_iX9CSX09Z8/mqdefault.jpg")) + itemlist.append( Item(channel=item.channel, title="[COLOR azure]Corso Unit 3D[/COLOR]", action="corsi", url="https://www.youtube.com/playlist?list=PL0qAPtx8YtJcbl6ZHwtFIkFxWY-adCeS7", thumbnail="http://i.ytimg.com/vi/QiFBrHp3IGk/mqdefault.jpg")) + + return itemlist + + +def corsi(item): + logger.info("kod.programmazione peliculas") + itemlist = [] + + # scarrico il canale + html = httptools.downloadpage(item.url).data + + # Estraggo l'elenco dei video e titoli + patron = ']+>(.*?)' + trovati = re.compile(patron, re.DOTALL).findall(html) + scrapertools.printMatches(trovati) + max = len(trovati) + min = 0 + + # ciclo sull'elenco trovato + for VideoUrl, VideoTitolo in trovati: + # Decodifico Html + titolo = scrapertools.decodeHtmlentities(VideoTitolo) + # contatore + min += 1 + # aggiungo alla lista + itemlist.append( + Item(channel=item.channel, + action="findvideos", + fulltitle=titolo, + show=titolo, + title="[COLOR azure]" + item.title + " - " + str(min) + "x" + str(max) + "[/COLOR]", + url=site + VideoUrl, + thumbnail=item.thumbnail, + plot=titolo, + folder=True)) + + return itemlist diff --git a/plugin.video.alfa/channels/ricettevideo.json b/plugin.video.alfa/channels/ricettevideo.json new file mode 100644 index 00000000..ea51d155 --- /dev/null +++ b/plugin.video.alfa/channels/ricettevideo.json @@ -0,0 +1,23 @@ +{ + "id": "ricettevideo", + "name": "Ricette Video", + "language": ["it"], + "active": true, + "adult": false, + "thumbnail": "http://ricettevideo.net/wp-content/uploads/2013/08/Ricette-Video-Logo.png", + "banner": "http://ricettevideo.net/wp-content/uploads/2013/08/Ricette-Video-Logo.png", + "categories": [ + "documentary" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": false, + "visible": false + } + ] +} + diff --git a/plugin.video.alfa/channels/ricettevideo.py b/plugin.video.alfa/channels/ricettevideo.py new file mode 100644 index 00000000..19589dfd --- /dev/null +++ b/plugin.video.alfa/channels/ricettevideo.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Kodi on Demand - Kodi Addon +# Canale ricettevideo +# https://alfa-addon.com/categories/kod-addon.50/ +# ------------------------------------------------------------ +import re, urlparse + +from core import httptools, scrapertools +from platformcode import logger, config +from core.item import Item + + + +host = "http://ricettevideo.net" + + +def mainlist(item): + logger.info("kod.ricettevideo mainlist") + itemlist = [Item(channel=item.channel, title="[COLOR azure]Videoricette[/COLOR]", action="peliculas", + url=host, + thumbnail="http://www.brinkmanscountrycorner.com/images/Recipies.png")] + + return itemlist + + +def peliculas(item): + logger.info("kod.ricettevideo peliculas") + itemlist = [] + + # Carica la pagina + data = httptools.downloadpage(item.url).data + + # Estrae i contenuti + patron = '
    \s*]+>' + matches = re.compile(patron, re.DOTALL).findall(data) + scrapertools.printMatches(matches) + + for scrapedurl, scrapedtitle, scrapedthumbnail in matches: + scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle) + scrapedplot = "" + itemlist.append(Item(channel=item.channel, action="findvideos", fulltitle=scrapedtitle, show=scrapedtitle, + title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot, + folder=True)) + + # Paginazione + patronvideos = '' + matches = re.compile(patronvideos, re.DOTALL).findall(data) + scrapertools.printMatches(matches) + + if len(matches) > 0: + scrapedurl = urlparse.urljoin(item.url, matches[0]) + itemlist.append( + Item(channel=item.channel, action="peliculas", title="[COLOR orange]Avanti >>[/COLOR]", url=scrapedurl, + folder=True)) + + return itemlist + +# test update diff --git a/plugin.video.alfa/channels/saghe.json b/plugin.video.alfa/channels/saghe.json new file mode 100644 index 00000000..c6a0854b --- /dev/null +++ b/plugin.video.alfa/channels/saghe.json @@ -0,0 +1,23 @@ +{ + "id": "saghe", + "name": "Saghe", + "language": ["it"], + "active": false, + "adult": false, + "thumbnail": null, + "banner": null, + "categories": [ + null + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": false, + "visible": false + } + ] +} + diff --git a/plugin.video.alfa/channels/saghe.py b/plugin.video.alfa/channels/saghe.py new file mode 100644 index 00000000..eef195fa --- /dev/null +++ b/plugin.video.alfa/channels/saghe.py @@ -0,0 +1,281 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Kodi on Demand - Kodi Addon +# Ricerca "Saghe" +# https://alfa-addon.com/categories/kod-addon.50/ +# ------------------------------------------------------------ + +import datetime +import re +import urllib + +from core import httptools, tmdb +from core import scrapertools +from core.item import Item +from core.tmdb import infoIca +from platformcode import logger, config + +PERPAGE = 15 + +tmdb_key = tmdb.tmdb_auth_key # tmdb_key = '92db8778ccb39d825150332b0a46061d' +# tmdb_key = '92db8778ccb39d825150332b0a46061d' +dttime = (datetime.datetime.utcnow() - datetime.timedelta(hours=5)) +systime = dttime.strftime('%Y%m%d%H%M%S%f') +today_date = dttime.strftime('%Y-%m-%d') +month_date = (dttime - datetime.timedelta(days=30)).strftime('%Y-%m-%d') +month2_date = (dttime - datetime.timedelta(days=60)).strftime('%Y-%m-%d') +year_date = (dttime - datetime.timedelta(days=365)).strftime('%Y-%m-%d') +tmdb_image = 'http://image.tmdb.org/t/p/original' +tmdb_poster = 'http://image.tmdb.org/t/p/w500' + + +def mainlist(item): + logger.info(" mainlist") + itemlist = [Item(channel=item.channel, + title="[COLOR yellow]Cult IMDB[/COLOR]", + action="movies", + url='https://www.imdb.com/list/ls000571226/', + thumbnail="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTVTW_L9vDQY0sjdlpfiOZdI0Nvi_NxSBpxmltDOFUYlctVxzX0Qg"), + Item(channel=item.channel, + title="[COLOR yellow]The Marvel Universe[/COLOR]", + action="tmdb_saghe_alt", + url='http://api.themoviedb.org/3/list/50941077760ee35e1500000c?api_key=%s&language=it' % tmdb_key, + thumbnail="https://image.tmdb.org/t/p/w180_and_h270_bestv2/6t3KOEUtrIPmmtu1czzt6p2XxJy.jpg"), + Item(channel=item.channel, + title="[COLOR yellow]The DC Comics Universe[/COLOR]", + action="tmdb_saghe_alt", + url='http://api.themoviedb.org/3/list/5094147819c2955e4c00006a?api_key=%s&language=it' % tmdb_key, + thumbnail="https://image.tmdb.org/t/p/w180_and_h270_bestv2/xWlaTLnD8NJMTT9PGOD9z5re1SL.jpg"), + Item(channel=item.channel, + title="[COLOR yellow]iMDb Top 250 Movies[/COLOR]", + action="tmdb_saghe_alt", + url='http://api.themoviedb.org/3/list/522effe419c2955e9922fcf3?api_key=%s&language=it' % tmdb_key, + thumbnail="https://image.tmdb.org/t/p/w180_and_h270_bestv2/9O7gLzmreU0nGkIB6K3BsJbzvNv.jpg"), + Item(channel=item.channel, + title="[COLOR yellow]Rotten Tomatoes top 100 movies of all times[/COLOR]", + action="tmdb_saghe_alt", + url='http://api.themoviedb.org/3/list/5418c914c3a368462c000020?api_key=%s&language=it' % tmdb_key, + thumbnail="https://image.tmdb.org/t/p/w180_and_h270_bestv2/zGadcmcF48gy8rKCX2ubBz2ZlbF.jpg"), + Item(channel=item.channel, + title="[COLOR yellow]Reddit top 250 movies[/COLOR]", + action="tmdb_saghe_alt", + url='http://api.themoviedb.org/3/list/54924e17c3a3683d070008c8?api_key=%s&language=it' % tmdb_key, + thumbnail="https://image.tmdb.org/t/p/w180_and_h270_bestv2/dM2w364MScsjFf8pfMbaWUcWrR.jpg"), + Item(channel=item.channel, + title="[COLOR yellow]Sci-Fi Action[/COLOR]", + action="tmdb_saghe_alt", + url='http://api.themoviedb.org/3/list/54408e79929fb858d1000052?api_key=%s&language=it' % tmdb_key, + thumbnail="https://image.tmdb.org/t/p/w180_and_h270_bestv2/5ig0kdWz5kxR4PHjyCgyI5khCzd.jpg"), + Item(channel=item.channel, + title="[COLOR yellow]007 - Movies[/COLOR]", + action="tmdb_saghe_alt", + url='http://api.themoviedb.org/3/list/557b152bc3a36840f5000265?api_key=%s&language=it' % tmdb_key, + thumbnail="https://image.tmdb.org/t/p/w180_and_h270_bestv2/zlWBxz2pTA9p45kUTrI8AQiKrHm.jpg"), + Item(channel=item.channel, + title="[COLOR yellow]Disney Classic Collection[/COLOR]", + action="tmdb_saghe_alt", + url='http://api.themoviedb.org/3/list/51224e42760ee3297424a1e0?api_key=%s&language=it' % tmdb_key, + thumbnail="https://image.tmdb.org/t/p/w180_and_h270_bestv2/vGV35HBCMhQl2phhGaQ29P08ZgM.jpg"), + Item(channel=item.channel, + title="[COLOR yellow]Bad Movies[/COLOR]", + action="badmovies", + url='http://www.badmovies.org/movies/', + thumbnail="http://www.badmovies.org/mainpage/badmovielogo_600.jpg")] + return itemlist + + +def tmdb_saghe_alt(item): + itemlist = [] + + alphabet = dict() + + # Carica la pagina + data = httptools.downloadpage(item.url).data + + # Estrae i contenuti + patron = '"title":"(.*?)"' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedtitle in matches: + letter = scrapedtitle[0].upper() + if letter not in alphabet: + alphabet[letter] = [] + alphabet[letter].append(scrapedtitle) + + for letter in sorted(alphabet): + itemlist.append( + Item(channel=item.channel, + action="tmdb_saghe", + url='\n\n'.join(alphabet[letter]), + title=letter, + fulltitle=letter)) + + return itemlist + + +def tmdb_saghe(item): + itemlist = [] + + p = 1 + if '{}' in item.url: + item.url, p = item.url.split('{}') + p = int(p) + + matches = item.url.split('\n\n') + for i, (scrapedtitle) in enumerate(matches): + if (p - 1) * PERPAGE > i: continue + if i >= p * PERPAGE: break + scrapedplot = "" + scrapedthumbnail = "" + scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle) + + itemlist.append(infoIca( + Item(channel=item.channel, + action="do_search", + contentType="movie", + extra=urllib.quote_plus(scrapedtitle), + title=scrapedtitle, + fulltitle=scrapedtitle, + plot=scrapedplot, + thumbnail=scrapedthumbnail), tipo="movie")) + + if len(matches) >= p * PERPAGE: + scrapedurl = item.url + '{}' + str(p + 1) + itemlist.append( + Item(channel=item.channel, + extra=item.extra, + action="tmdb_saghe", + title=config.get_localized_string(30992), + url=scrapedurl, + thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png", + folder=True)) + + return itemlist + + +def badmovies(item): + itemlist = [] + + p = 1 + if '{}' in item.url: + item.url, p = item.url.split('{}') + p = int(p) + + # Carica la pagina + data = httptools.downloadpage(item.url).data + data = scrapertools.find_single_match(data, + '(.*?)
    ') + + # Estrae i contenuti + patron = r'">([^<]+)\s*' + matches = re.compile(patron, re.DOTALL).findall(data) + + scrapedurl = "" + scrapedplot = "" + scrapedthumbnail = "" + for i, (scrapedtitle) in enumerate(matches): + if (p - 1) * PERPAGE > i: continue + if i >= p * PERPAGE: break + title = scrapertools.decodeHtmlentities(scrapedtitle).strip() + itemlist.append(infoIca( + Item(channel=item.channel, + extra=urllib.quote_plus(title), + action="do_search", + title=title, + url=title, + thumbnail=scrapedthumbnail, + fulltitle=title, + show=title, + plot=scrapedplot, + folder=True), tipo='movie')) + + if len(matches) >= p * PERPAGE: + scrapedurl = item.url + '{}' + str(p + 1) + itemlist.append( + Item(channel=item.channel, + extra=item.extra, + action="badmovies", + title=config.get_localized_string(30992), + url=scrapedurl, + thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png", + folder=True)) + + return itemlist + + +def do_search(item): + from channels import search + return search.do_search(item) + + +def movies(item): + logger.info("[saghe.py]==> movies") + itemlist = [] + + data = httptools.downloadpage(item.url).data + groups = scrapertools.find_multiple_matches(data, + r'
    ]+>([^<]+)'), + 'year': single_scrape(group, r'unbold">\((\d+)\)'), + 'rating': single_scrape(group, r'star__rating">(\d+,?\d*)'), + 'plot': single_scrape(group, r'

    \s*([^<]+)

    '), + 'genres': single_scrape(group, r'genre">\s*([^<]+)'), + 'age': single_scrape(group, r'certificate">([^<]+)'), + 'metascore': single_scrape(group, r'metascore[^>]*>\s*(\d+)[^>]+>'), + 'image': single_scrape(group, r'loadlate="([^"]+)"[^>]+>') + } + + infos['title'] = scrapertools.decodeHtmlentities(infos['title']).strip() + infos['plot'] = scrapertools.decodeHtmlentities(infos['plot']).strip() + + title = "%s (%s)%s[%s]" % (infos['title'], color(infos['year'], "gray"), + (" [%s]" % age_color("%s" % infos['age'])) if infos['age'] else "", + color(infos['rating'], "orange")) + + plot = "Anno: %s%s\nVoto: %s\nGeneri: %s\nMetascore: %s\nDescrizione:\n%s" % \ + (infos['year'], "\nPubblico: %s" % age_color(infos['age']) if infos['age'] else "", infos['rating'], + infos['genres'], infos['metascore'], infos['plot']) + + itemlist.append( + Item(channel=item.channel, + text_color="azure", + action="do_search", + contentTitle=infos['title'], + infoLabels={'year': infos['year']}, + title=title, + plot=plot, + extra="%s{}%s" % (urllib.quote_plus(infos['title']), "movie"), + thumbnail=infos['image'])) + + tmdb.set_infoLabels_itemlist(itemlist, True) + return itemlist + + +def age_color(age): + logger.info("[saghe.py]==> age_color") + if age.lower() == "t": + age = color(age, "green") + elif age.lower() == "pg": + age = color(age, "yellow") + elif age.lower() == "vm14": + age = color(age, "yellow") + elif age.lower() == "vm18": + age = color(age, "red") + elif 'banned' in age.lower(): + age = color(age.replace('(', '').replace(')', '').strip(), "red") + + return age + + +def single_scrape(text, patron): + logger.info("[saghe.py]==> single_scrape") + return scrapertools.find_single_match(text, patron) + + +def color(text, color): + logger.info("[saghe.py]==> color") + return "[COLOR %s]%s[/COLOR]" % (color, text) diff --git a/plugin.video.alfa/channels/searchall.py b/plugin.video.alfa/channels/searchall.py new file mode 100644 index 00000000..5538a0a9 --- /dev/null +++ b/plugin.video.alfa/channels/searchall.py @@ -0,0 +1,865 @@ +# -*- coding: utf-8 -*- + +import Queue +import datetime +import glob +import os +import re +import threading +import time +import urllib +from threading import Thread +from unicodedata import normalize + +import xbmc + +from core import channeltools, httptools, tmdb, servertools +from lib.fuzzywuzzy import fuzz +from platformcode import platformtools + +try: + import json +except: + import simplejson as json + +from platformcode import config +from platformcode import logger +from core.item import Item + +TMDB_KEY = tmdb.tmdb_auth_key ######TMDB_KEY = '92db8778ccb39d825150332b0a46061d' +# TMDB_KEY = '92db8778ccb39d825150332b0a46061d' + + +TMDB_URL_BASE = 'http://api.themoviedb.org/3/' +TMDB_IMAGES_BASEURL = 'http://image.tmdb.org/t/p/' +INCLUDE_ADULT = True if config.get_setting("enableadultmode") else False +LANGUAGE_ID = 'it' + +DTTIME = (datetime.datetime.utcnow() - datetime.timedelta(hours=5)) +SYSTIME = DTTIME.strftime('%Y%m%d%H%M%S%f') +TODAY_TIME = DTTIME.strftime('%Y-%m-%d') +MONTH_TIME = (DTTIME - datetime.timedelta(days=30)).strftime('%Y-%m-%d') +MONTH2_TIME = (DTTIME - datetime.timedelta(days=60)).strftime('%Y-%m-%d') +YEAR_DATE = (DTTIME - datetime.timedelta(days=365)).strftime('%Y-%m-%d') + +TIMEOUT_TOTAL = config.get_setting("timeout") +MAX_THREADS = config.get_setting("maxthreads") + +# TIMEOUT_TOTAL = config.get_setting("timeout", default=90) +# MAX_THREADS = config.get_setting("maxthreads", default=24) + +NLS_Search_by_Channel = config.get_localized_string(30974) +NLS_Alternative_Search = config.get_localized_string(70021) +NLS_Search_by_Title = config.get_localized_string(30980) +NLS_Search_by_Person = config.get_localized_string(30981) +NLS_Search_by_Company = config.get_localized_string(30982) +NLS_Now_Playing = config.get_localized_string(30983) +NLS_Popular = config.get_localized_string(30984) +NLS_Top_Rated = config.get_localized_string(30985) +NLS_Search_by_Collection = config.get_localized_string(30986) +NLS_List_by_Genre = config.get_localized_string(30987) +NLS_Search_by_Year = config.get_localized_string(30988) +NLS_Search_Similar_by_Title = config.get_localized_string(30989) +NLS_Search_Tvshow_by_Title = config.get_localized_string(30990) +NLS_Most_Voted = config.get_localized_string(30996) +NLS_Oscar = config.get_localized_string(30997) +NLS_Last_2_months = config.get_localized_string(60534) +NLS_Library = config.get_localized_string(30991) +NLS_Next_Page = config.get_localized_string(30992) +NLS_Looking_For = config.get_localized_string(30993) +NLS_Searching_In = config.get_localized_string(30994) +NLS_Found_So_Far = config.get_localized_string(30995) +NLS_Info_Title = config.get_localized_string(30975) +NLS_Info_Person = config.get_localized_string(30979) +NLS_New_TVShow = config.get_localized_string(30978) +NLS_TVShow_onair = config.get_localized_string(30977) +NLS_TVShow_airing_today = config.get_localized_string(30976) + +TMDb_genres = {} + + +def mainlist(item): + logger.info(" mainlist") + itemlist = [Item(channel="search", + title="[COLOR lightgreen]%s[/COLOR]" % NLS_Search_by_Channel, + action="mainlist", + thumbnail="http://i.imgur.com/pE5WSZp.png"), + Item(channel="tvmoviedb", + title="[COLOR yellow]%s[/COLOR]" % NLS_Alternative_Search, + action="mainlist", + url="search_movie_by_title", + thumbnail="https://s6.postimg.cc/6lll9b8c1/searching.png"), + Item(channel=item.channel, + title="[COLOR yellow]%s[/COLOR]" % NLS_Search_by_Title, + action="search", + url="search_movie_by_title", + thumbnail="http://i.imgur.com/B1H1G8U.png"), + Item(channel=item.channel, + title="[COLOR yellow]%s[/COLOR]" % NLS_Search_by_Person, + action="search", + url="search_person_by_name", + thumbnail="http://i.imgur.com/efuEeNu.png"), + Item(channel=item.channel, + title="[COLOR yellow]%s[/COLOR]" % NLS_Search_by_Year, + action="search_movie_by_year", + url="search_movie_by_year", + thumbnail="https://d1kz0yd1invg7i.cloudfront.net/uploads/app/icon/1/calendar-icon-big.png"), + Item(channel=item.channel, + title="[COLOR yellow]%s[/COLOR]" % NLS_Search_by_Collection, + action="search", + url="search_collection_by_name", + thumbnail="http://i.imgur.com/JmcvZDL.png"), + Item(channel=item.channel, + title="[COLOR yellow]%s[/COLOR]" % NLS_Search_Similar_by_Title, + action="search", + url="search_similar_movie_by_title", + thumbnail="http://i.imgur.com/JmcvZDL.png"), + Item(channel=item.channel, + title="[COLOR lime]%s[/COLOR]" % NLS_Search_Tvshow_by_Title, + action="search", + url="search_tvshow_by_title", + thumbnail="https://i.imgur.com/2ZWjLn5.jpg?1"), + Item(channel=item.channel, + title="(TV Shows) [COLOR lime]%s[/COLOR]" % NLS_New_TVShow, + action="list_tvshow", + url='discover/tv?sort_by=popularity.desc&first_air_date.gte=%s&first_air_date.lte=%s&' % ( + MONTH2_TIME, TODAY_TIME), + plot="1", + type="tvshow", + thumbnail="https://i.imgur.com/2ZWjLn5.jpg?1"), + Item(channel=item.channel, + title="(TV Shows) [COLOR lime]%s[/COLOR]" % NLS_TVShow_onair, + action="list_tvshow", + url="tv/on_the_air?", + plot="1", + type="tvshow", + thumbnail="https://i.imgur.com/2ZWjLn5.jpg?1"), + Item(channel=item.channel, + title="(TV Shows) [COLOR lime]%s[/COLOR]" % NLS_Popular, + action="list_tvshow", + url="tv/popular?", + plot="1", + type="tvshow", + thumbnail="https://i.imgur.com/2ZWjLn5.jpg?1"), + Item(channel=item.channel, + title="(TV Shows) [COLOR lime]%s[/COLOR]" % NLS_Top_Rated, + action="list_tvshow", + url="tv/top_rated?", + plot="1", + type="tvshow", + thumbnail="https://i.imgur.com/2ZWjLn5.jpg?1"), + Item(channel=item.channel, + title="(TV Shows) [COLOR lime]%s[/COLOR]" % NLS_TVShow_airing_today, + action="list_tvshow", + url="tv/airing_today?", + plot="1", + type="tvshow", + thumbnail="https://i.imgur.com/2ZWjLn5.jpg?1"), + Item(channel=item.channel, + title="(Movies) [COLOR yellow]%s[/COLOR]" % NLS_Now_Playing, + action="list_movie", + url="movie/now_playing?", + plot="1", + type="movie", + thumbnail="http://i.imgur.com/B16HnVh.png"), + Item(channel=item.channel, + title="(Movies) [COLOR yellow]%s[/COLOR]" % NLS_Popular, + action="list_movie", + url="movie/popular?", + plot="1", + type="movie", + thumbnail="http://i.imgur.com/8IBjyzw.png"), + Item(channel=item.channel, + title="(Movies) [COLOR yellow]%s[/COLOR]" % NLS_Top_Rated, + action="list_movie", + url="movie/top_rated?", + plot="1", + type="movie", + thumbnail="http://www.clipartbest.com/cliparts/RiG/6qn/RiG6qn79T.png"), + Item(channel=item.channel, + title="(Movies) [COLOR yellow]%s[/COLOR]" % NLS_Most_Voted, + action="list_movie", + url='discover/movie?certification_country=US&sort_by=vote_count.desc&', + plot="1", + type="movie", + thumbnail="http://i.imgur.com/5ShnO8w.png"), + Item(channel=item.channel, + title="(Movies) [COLOR yellow]%s[/COLOR]" % NLS_Oscar, + action="list_movie", + url='list/509ec17b19c2950a0600050d?', + plot="1", + type="movie", + thumbnail="http://i.imgur.com/5ShnO8w.png"), + Item(channel=item.channel, + title="(Movies) [COLOR yellow]%s[/COLOR]" % NLS_Last_2_months, + action="list_movie", + url='discover/movie?primary_release_date.gte=%s&primary_release_date.lte=%s&' % ( + YEAR_DATE, MONTH2_TIME), + plot="1", + type="movie", + thumbnail="http://i.imgur.com/CsizqUI.png"), + Item(channel=item.channel, + title="(Movies) [COLOR yellow]%s[/COLOR]" % NLS_List_by_Genre, + action="list_genres", + type="movie", + thumbnail="http://i.imgur.com/uotyBbU.png")] + + return itemlist + + +def list_movie(item): + logger.info(" list_movie '%s/%s'" % (item.url, item.plot)) + + results = [0, 0] + page = int(item.plot) + itemlist = build_movie_list(item, tmdb_get_data('%s&page=%d&' % (item.url, page), results=results)) + if page < results[0]: + itemlist.append(Item( + channel=item.channel, + title="[COLOR orange]%s (%d/%d)[/COLOR]" % (NLS_Next_Page, page * len(itemlist), results[1]), + action="list_movie", + url=item.url, + plot="%d" % (page + 1), + type=item.type, + viewmode="" if page <= 1 else "paged_list")) + + return itemlist + + +def list_tvshow(item): + logger.info(" list_tvshow '%s/%s'" % (item.url, item.plot)) + + results = [0, 0] + page = int(item.plot) + itemlist = build_movie_list(item, tmdb_get_data('%spage=%d&' % (item.url, page), results=results)) + if page < results[0]: + itemlist.append(Item( + channel=item.channel, + title="[COLOR orange]%s (%d/%d)[/COLOR]" % (NLS_Next_Page, page * len(itemlist), results[1]), + action="list_tvshow", + url=item.url, + plot="%d" % (page + 1), + type=item.type, + viewmode="" if page <= 1 else "paged_list")) + + return itemlist + + +def list_genres(item): + logger.info(" list_genres") + + tmdb_genre(1) + itemlist = [] + for genre_id, genre_name in TMDb_genres.iteritems(): + itemlist.append( + Item(channel=item.channel, + title=genre_name, + action="list_movie", + url='genre/%d/movies?primary_release_date.gte=%s&primary_release_date.lte=%s&language=it' % ( + genre_id, YEAR_DATE, TODAY_TIME), + plot="1")) + + return itemlist + + +def discover_list(item): + from platformcode import unify + from core import scrapertools + itemlist = [] + + result = tmdb.discovery(item) + + tvshow = False + + logger.debug(item) + + for elem in result: + elem['tmdb_id'] = elem['id'] + if 'title' in elem: + title = unify.normalize(elem['title']).capitalize() + elem['year'] = scrapertools.find_single_match(elem['release_date'], '(\d{4})-\d+-\d+') + else: + title = unify.normalize(elem['name']).capitalize() + tvshow = True + + new_item = Item(channel='searchall', title=title, infoLabels=elem, action='search_tmdb', extra=title, + category='Resultados', context='') + + if tvshow: + new_item.contentSerieName = title + else: + new_item.contentTitle = title + + itemlist.append(new_item) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + if item.page != '' and len(itemlist) > 0: + next_page = str(int(item.page) + 1) + # if not 'similar' in item.list_type: + # itemlist.append(item.clone(title='Pagina Siguente', page=next_page)) + # else: + itemlist.append(Item(channel=item.channel, action='discover_list', title=config.get_localized_string(30992), + text_color="orange", search_type=item.search_type, list_type=item.list_type, + type=item.type, page=next_page)) + + return itemlist + + +# Do not change the name of this function otherwise launcher.py won't create the keyboard dialog required to enter the search terms +def search(item, search_terms): + if item.url == '': return [] + + return globals()[item.url](item, search_terms) if item.url in globals() else [] + + +def search_tvshow_by_title(item, search_terms): + logger.info(" search_tvshow_by_title '%s'" % (search_terms)) + + return list_movie( + Item(channel=item.channel, + url='search/tv?query=%s&' % search_terms, + plot="1", + type="tvshow")) + + +def search_movie_by_title(item, search_terms): + logger.info(" search_movie_by_title '%s'" % (search_terms)) + + return list_movie( + Item(channel=item.channel, + url='search/movie?query=%s&' % search_terms, + plot="1", + type="movie")) + + +def search_similar_movie_by_title(item, search_terms): + logger.info(" search_similar_movie_by_title '%s'" % (search_terms)) + + return list_movie( + Item(channel=item.channel, + url='search/movie?append_to_response=similar_movies,alternative_title&query=%s&' % search_terms, + plot="1", + type='movie')) + + +def search_movie_by_year(item): + logger.info(" search_movie_by_year") + now = datetime.datetime.now() + year = int(now.year) + result = [] + for i in range(150): + year_to_search = year - i + result.append(Item(channel=item.channel, + url='discover/movie?primary_release_year=%s&' % year_to_search, + plot="1", + type="movie", + title="%s" % year_to_search, + action="list_movie")) + return result + + +def search_person_by_name(item, search_terms): + logger.info(" search_person_by_name '%s'" % (search_terms)) + + persons = tmdb_get_data("search/person?query=%s&" % search_terms) + + itemlist = [] + for person in persons: + name = normalize_unicode(tmdb_tag(person, 'name')) + poster = tmdb_image(person, 'profile_path') + fanart = '' + for movie in tmdb_tag(person, 'known_for', []): + if tmdb_tag_exists(movie, 'backdrop_path'): + fanart = tmdb_image(movie, 'backdrop_path', 'w1280') + break + + # extracmds = [ + # (NLS_Info_Person, "RunScript(script.extendedinfo,info=extendedactorinfo,id=%s)" % str(tmdb_tag(person, 'id')))] \ + # if xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)') else [] + + itemlist.append(Item( + channel=item.channel, + action='search_movie_by_person', + extra=str(tmdb_tag(person, 'id')), + title=name, + thumbnail=poster, + viewmode='list', + fanart=fanart, + type='movie' + # extracmds=extracmds + )) + + return itemlist + + +def search_movie_by_person(item): + logger.info(" search_movie_by_person '%s'" % (item.extra)) + + # return list_movie( + # Item(channel=item.channel, + # url="discover/movie?with_people=%s&primary_release_date.lte=%s&sort_by=primary_release_date.desc&" % ( + # item.extra, TODAY_TIME), + # plot="1")) + + person_movie_credits = tmdb_get_data( + "person/%s/movie_credits?primary_release_date.lte=%s&sort_by=primary_release_date.desc&" % ( + item.extra, TODAY_TIME)) + movies = [] + if person_movie_credits: + movies.extend(tmdb_tag(person_movie_credits, 'cast', [])) + movies.extend(tmdb_tag(person_movie_credits, 'crew', [])) + + # Movie person list is not paged + return build_movie_list(item, movies) + + +def search_collection_by_name(item, search_terms): + logger.info(" search_collection_by_name '%s'" % (search_terms)) + + collections = tmdb_get_data("search/collection?query=%s&" % search_terms) + + itemlist = [] + for collection in collections: + name = normalize_unicode(tmdb_tag(collection, 'name')) + poster = tmdb_image(collection, 'poster_path') + fanart = tmdb_image(collection, 'backdrop_path', 'w1280') + + itemlist.append(Item( + channel=item.channel, + action='search_movie_by_collection', + extra=str(tmdb_tag(collection, 'id')), + title=name, + thumbnail=poster, + viewmode='list', + fanart=fanart, + type='movie' + )) + + return itemlist + + +def search_movie_by_collection(item): + logger.info(" search_movie_by_collection '%s'" % (item.extra)) + + collection = tmdb_get_data("collection/%s?" % item.extra) + + # Movie collection list is not paged + return build_movie_list(item, collection['parts']) if 'parts' in collection else [] + + +def build_movie_list(item, movies): + if movies is None: return [] + + itemlist = [] + for movie in movies: + t = tmdb_tag(movie, 'title') + if t == '': + t = re.sub('\s(|[(])(UK|US|AU|\d{4})(|[)])$', '', tmdb_tag(movie, 'name')) + title = normalize_unicode(t) + title_search = normalize_unicode(t, encoding='ascii') + if not all(ord(char) < 128 for char in title): continue + poster = tmdb_image(movie, 'poster_path') + fanart = tmdb_image(movie, 'backdrop_path', 'w1280') + jobrole = normalize_unicode( + ' [COLOR yellow][' + tmdb_tag(movie, 'job') + '][/COLOR]' if tmdb_tag_exists(movie, 'job') else '') + genres = normalize_unicode( + ' / '.join([tmdb_genre(genre).upper() for genre in tmdb_tag(movie, 'genre_ids', [])])) + year = tmdb_tag(movie, 'release_date')[0:4] if tmdb_tag_exists(movie, 'release_date') else '' + plot = normalize_unicode(tmdb_tag(movie, 'overview')) + rating = tmdb_tag(movie, 'vote_average') + votes = tmdb_tag(movie, 'vote_count') + + extrameta = {'plot': plot} + if year != "": extrameta["Year"] = year + if genres != "": extrameta["Genre"] = genres + if votes: + extrameta["Rating"] = rating + extrameta["Votes"] = "%d" % votes + + # extracmds = [(NLS_Info_Title, "RunScript(script.extendedinfo,info=extendedinfo,id=%s)" % str(tmdb_tag(movie, 'id')))] \ + # if xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)') else [('Movie/Show Info', 'XBMC.Action(Info)')] + + found = False + kodi_db_movies = kodi_database_movies(title) + for kodi_db_movie in kodi_db_movies: + logger.info('Kod.database set for local playing(%s):\n%s' % (title, str(kodi_db_movie))) + if year == str(kodi_db_movie["year"]): + found = True + + # If some, less relevant, keys are missing locally + # try to get them through TMDB anyway. + try: + poster = kodi_db_movie["art"]["poster"] + fanart = kodi_db_movie["art"]["fanart"] + except KeyError: + poster = poster + fanart = fanart + + itemlist.append(Item( + channel=item.channel, + action='play', + url=kodi_db_movie["file"], + title='[COLOR orange][%s][/COLOR] ' % NLS_Library + kodi_db_movie["title"] + jobrole, + thumbnail=poster, + category=genres, + plot=plot, + viewmode='movie_with_plot', + fanart=fanart, + infoLabels=extrameta, + folder=False, + )) + + if not found: + logger.info('Kod.database set for channels search(%s)' % title) + itemlist.append(Item( + channel=item.channel, + action='do_channels_search', + extra=url_quote_plus(title_search) + '{}' + item.type + '{}' + year, + title=title + jobrole, + thumbnail=poster, + category=genres, + plot=plot, + viewmode='movie_with_plot', + fanart=fanart, + infoLabels=extrameta, + )) + + return itemlist + + +def normalize_unicode(string, encoding='utf-8'): + if string is None: string = '' + return normalize('NFKD', string if isinstance(string, unicode) else unicode(string, encoding, 'ignore')).encode( + encoding, 'ignore') + + +def tmdb_get_data(url="", results=[0, 0], language=True): + url = TMDB_URL_BASE + "%sinclude_adult=%s&api_key=%s" % (url, INCLUDE_ADULT, TMDB_KEY) + # Temporary fix until tmdb fixes the issue with getting the genres by language! + if language: url += "&language=%s" % LANGUAGE_ID + response = get_json_response(url) + results[0] = response['total_pages'] if 'total_pages' in response else 0 + results[1] = response['total_results'] if 'total_results' in response else 0 + + if response: + if "results" in response: + return response["results"] + elif "items" in response: + return response["items"] + elif "tv_credits" in response: + return response["tv_credits"]["cast"] + else: + return response + + +def tmdb_tag_exists(entry, tag): + return isinstance(entry, dict) and tag in entry and entry[tag] is not None + + +def tmdb_tag(entry, tag, default=""): + return entry[tag] if isinstance(entry, dict) and tag in entry else default + + +def tmdb_image(entry, tag, width='original'): + return TMDB_IMAGES_BASEURL + width + '/' + tmdb_tag(entry, tag) if tmdb_tag_exists(entry, tag) else '' + + +def tmdb_genre(id): + if id not in TMDb_genres: + genres = tmdb_get_data("genre/list?", language="it") + for genre in tmdb_tag(genres, 'genres', []): + TMDb_genres[tmdb_tag(genre, 'id')] = tmdb_tag(genre, 'name') + + return TMDb_genres[id] if id in TMDb_genres and TMDb_genres[id] != None else str(id) + + +def kodi_database_movies(title): + json_query = \ + '{"jsonrpc": "2.0",\ + "params": {\ + "sort": {"order": "ascending", "method": "title"},\ + "filter": {"operator": "is", "field": "title", "value": "%s"},\ + "properties": ["title", "art", "file", "year"]\ + },\ + "method": "VideoLibrary.GetMovies",\ + "id": "libMovies"\ + }' % title + response = get_xbmc_jsonrpc_response(json_query) + return response["result"]["movies"] if response and "result" in response and "movies" in response["result"] else [] + + +def get_xbmc_jsonrpc_response(json_query=""): + try: + response = xbmc.executeJSONRPC(json_query) + response = unicode(response, 'utf-8', errors='ignore') + response = json.loads(response) + logger.info(" jsonrpc %s" % response) + except Exception, e: + logger.info(" jsonrpc error: %s" % str(e)) + response = None + return response + + +def url_quote_plus(input_string): + try: + return urllib.quote_plus(input_string.encode('utf8', 'ignore')) + except: + return urllib.quote_plus(unicode(input_string, "utf-8").encode("utf-8")) + + +def get_json_response(url=""): + response = httptools.downloadpage(url).data + try: + results = json.loads(response) + except: + logger.info(" Exception: Could not get new JSON data from %s" % url) + results = [] + return results + + +def channel_search(queue, channel_parameters, category, title_year, tecleado): + try: + search_results = [] + + title_search = urllib.unquote_plus(tecleado) + + exec "from channels import " + channel_parameters["channel"] + " as module" + mainlist = module.mainlist(Item(channel=channel_parameters["channel"])) + + for item in mainlist: + if item.action != "search" or category and item.extra != category: + continue + + for res_item in module.search(item.clone(), tecleado): + title = res_item.fulltitle + + # If the release year is known, check if it matches the year found in the title + if title_year > 0: + year_match = re.search('\(.*(\d{4}).*\)', title) + if year_match and abs(int(year_match.group(1)) - title_year) > 1: + continue + + # Clean up a bit the returned title to improve the fuzzy matching + title = re.sub(r'\(.*\)', '', title) # Anything within () + title = re.sub(r'\[.*\]', '', title) # Anything within [] + + # Check if the found title fuzzy matches the searched one + if fuzz.token_sort_ratio(title_search, title) > 85: + res_item.title = "[COLOR azure]" + res_item.title + "[/COLOR][COLOR orange] su [/COLOR][COLOR green]" + \ + channel_parameters["title"] + "[/COLOR]" + search_results.append(res_item) + + queue.put(search_results) + + except: + logger.error("No se puede buscar en: " + channel_parameters["title"]) + import traceback + logger.error(traceback.format_exc()) + + +def do_channels_search(item): + logger.info(" do_channels_search") + + tecleado, category, title_year = item.extra.split('{}') + + try: + title_year = int(title_year) + except: + title_year = 0 + + itemlist = [] + + channels_path = os.path.join(config.get_runtime_path(), "channels", '*.json') + logger.info(" channels_path=" + channels_path) + + channel_language = config.get_setting("channel_language") + logger.info(" channel_language=" + channel_language) + if channel_language == "": + channel_language = "all" + logger.info(" channel_language=" + channel_language) + + progreso = platformtools.dialog_progress_bg(NLS_Looking_For % urllib.unquote_plus(tecleado)) + + channel_files = sorted(glob.glob(channels_path)) + + search_results = Queue.Queue() + completed_channels = 0 + number_of_channels = 0 + + start_time = int(time.time()) + + for infile in channel_files: + + basename_without_extension = os.path.basename(infile)[:-5] + + channel_parameters = channeltools.get_channel_parameters(basename_without_extension) + + # No busca si es un canal inactivo + if channel_parameters["active"] != True: + continue + + # En caso de busqueda por categorias + if category and category not in channel_parameters["categories"]: + continue + + # No busca si el canal es en un idioma filtrado + if channel_language != "all" and channel_parameters["language"] != channel_language: + continue + + # No busca si es un canal excluido de la busqueda global + include_in_global_search = channel_parameters["include_in_global_search"] + if include_in_global_search == True: + # Buscar en la configuracion del canal + include_in_global_search = config.get_setting("include_in_global_search", basename_without_extension) + if include_in_global_search == False: + continue + + t = Thread(target=channel_search, args=[search_results, channel_parameters, category, title_year, tecleado]) + t.setDaemon(True) + t.start() + number_of_channels += 1 + + while threading.active_count() >= MAX_THREADS: + + delta_time = int(time.time()) - start_time + if len(itemlist) <= 0: + timeout = None # No result so far,lets the thread to continue working until a result is returned + elif delta_time >= TIMEOUT_TOTAL: + progreso.close() + itemlist = sorted(itemlist, key=lambda item: item.fulltitle) + return itemlist + else: + timeout = TIMEOUT_TOTAL - delta_time # Still time to gather other results + + progreso.update(completed_channels * 100 / number_of_channels) + + try: + itemlist.extend(search_results.get(timeout=timeout)) + completed_channels += 1 + except: + progreso.close() + itemlist = sorted(itemlist, key=lambda item: item.fulltitle) + return itemlist + + while completed_channels < number_of_channels: + + delta_time = int(time.time()) - start_time + if len(itemlist) <= 0: + timeout = None # No result so far,lets the thread to continue working until a result is returned + elif delta_time >= TIMEOUT_TOTAL: + break # At least a result matching the searched title has been found, lets stop the search + else: + timeout = TIMEOUT_TOTAL - delta_time # Still time to gather other results + + progreso.update(completed_channels * 100 / number_of_channels) + + try: + itemlist.extend(search_results.get(timeout=timeout)) + completed_channels += 1 + except: + # Expired timeout raise an exception + break + + progreso.close() + + # todo 1 : impostare una visualizzazione % di avanzamento (serve?) + # todo 2 : verificare la formattazione dei titoli estratti + # todo 3 : gestione numero threads e timeout + if config.get_setting("findlinks") == True and "{}movie{}" in item.extra: + itemlist = links_list(itemlist) + itemlist = sorted(itemlist, key=lambda item: item.title.lower()) + else: + itemlist = sorted(itemlist, key=lambda item: item.fulltitle) + + return itemlist + + +def links_list(itemlist): + logger.info(" links_list") + itemlistresults = [] + itemlistlist = [] + allthreads = [] + global_search_results = Queue.Queue() + + # create and collect threads + for item in itemlist: + t = Thread(target=list_single_site, args=[global_search_results, item]) + t.setDaemon(True) + allthreads.append(t) + + # start threads + for thread in allthreads: + try: + thread.start() + except: + logger.error("thread error !") + + # join threads, to wait all threads end before going on + for thread in allthreads: + thread.join() + + # collect results + while not global_search_results.empty(): + for item in global_search_results.get(): + if not item_url_in_itemlist(item, itemlistresults): + channelformatteditem = rewrite_item_title(item) + if channelformatteditem is not None: + itemlistresults.append(channelformatteditem) + + return itemlistresults + + +def list_single_site(queue, item): + logger.info(" list_single_site") + channelitemlist = [] + try: + # logger.info(item.channel + " start channel search " + time.strftime("%Y-%m-%d %H:%M:%S")) + module_to_call = getattr(__import__("channels"), item.channel) + channelitemlist = module_to_call.findvideos(item) + queue.put(channelitemlist) + # logger.info(item.channel + " end channel search " + time.strftime("%Y-%m-%d %H:%M:%S")) + except: + try: + # logger.info(item.channel + " start servertools search " + time.strftime("%Y-%m-%d %H:%M:%S")) + # logger.info("no findvideos defined in channel functions, calling servertools.findvideos to find links") + servertools_itemlist = [] + headers = [['Referer', item.channel]] + data = httptools.downloadpage(item.url, headers=headers).data + list_servertools = servertools.findvideos(data) + for item_servertools in list_servertools: + servertools_itemlist.append(Item(channel=item.channel, + action="play", + fulltitle=item.title, + server=item_servertools[0], + thumbnail=item_servertools[3], + title=item.title, + url=item_servertools[1])) + queue.put(servertools_itemlist) + # logger.info(item.channel + " end servertools search " + time.strftime("%Y-%m-%d %H:%M:%S")) + except Exception, e: + logger.error('exception in list_single_site: ' + str(e)) + return channelitemlist + + +# utility function +def item_url_in_itemlist(item, itemlist): + logger.info(" item_url_in_itemlist") + i = 0 + while i < len(itemlist): + if itemlist[i].url == item.url: + # logger.info("elemento eliminato : " + item.url) + return True + i = i + 1 + return False + + +# utility function, optional +def rewrite_item_title(item): + logger.info(" rewrite_item_title") + if "download" not in item.title.lower(): + item.title = "[COLOR yellow][%s][/COLOR][COLOR orange][%s][/COLOR] %s" % ( + item.server, item.channel, item.fulltitle) + else: + return None + return item diff --git a/plugin.video.alfa/channels/seriehd.json b/plugin.video.alfa/channels/seriehd.json new file mode 100644 index 00000000..c248f89e --- /dev/null +++ b/plugin.video.alfa/channels/seriehd.json @@ -0,0 +1,62 @@ +{ + "id": "seriehd", + "name": "SerieHD", + "active": true, + "adult": false, + "language": ["ita"], + "thumbnail": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/seriehd.png", + "banner": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/seriehd.png", + "categories": [ + "tvshow", + "top channels" + + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Includi ricerca globale", + "default": true, + "enabled": true, + "visible": true + }, + + { + "id": "include_in_newest_series", + "type": "bool", + "label": "Includi in Novità - Serie TV", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "comprueba_enlaces", + "type": "bool", + "label": "Verifica se i link esistono", + "default": false, + "enabled": true, + "visible": true + }, + { + "id": "comprueba_enlaces_num", + "type": "list", + "label": "Numero de link da verificare", + "default": 1, + "enabled": true, + "visible": "eq(-1,true)", + "lvalues": [ "1", "3", "5", "10" ] + }, + { + "id": "filter_languages", + "type": "list", + "label": "Mostra link in lingua...", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": [ + "Non filtrare", + "IT" + ] + } + ] +} diff --git a/plugin.video.alfa/channels/seriehd.py b/plugin.video.alfa/channels/seriehd.py new file mode 100644 index 00000000..6d240b6d --- /dev/null +++ b/plugin.video.alfa/channels/seriehd.py @@ -0,0 +1,304 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Kodi on Demand - Kodi Addon +# Canale per seriehd +# Alhaziel +# ------------------------------------------------------------ +import base64 +import re +import urlparse + +from channels import autoplay +from channels import filtertools +from core import scrapertools, servertools, httptools +from platformcode import logger, config +from core.item import Item +from platformcode import config +from core.tmdb import infoIca + +__channel__ = "seriehd" + +host = "https://www.seriehd.video" + +IDIOMAS = {'Italiano': 'IT'} +list_language = IDIOMAS.values() +list_servers = ['openload', 'streamango', 'thevideome'] +list_quality = ['1080p', '720p', '480p', '360'] + +__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'seriehd') +__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'seriehd') + +headers = [['Referer', host]] + + +def mainlist(item): + logger.info("seriehd.py mainlist") + + autoplay.init(item.channel, list_servers, list_quality) + + itemlist = [Item(channel=item.channel, + action="fichas", + title="[COLOR azure]Serie TV[/COLOR]", + url=host + "/serie-tv-streaming/", + thumbnail="http://i.imgur.com/rO0ggX2.png"), + Item(channel=__channel__, + action="sottomenu", + title="[COLOR orange]Categoria[/COLOR]", + url=host, + thumbnail="http://i.imgur.com/rO0ggX2.png"), + Item(channel=__channel__, + action="search", + extra="tvshow", + title="[COLOR limegreen]Cerca...[/COLOR]", + thumbnail="")] + + autoplay.show_option(item.channel, itemlist) + + return itemlist + + +def search(item, texto): + logger.info("[seriehd.py] search") + + item.url = host + "/?s=" + texto + + try: + return fichas(item) + + # Continua la ricerca in caso di errore . + except: + import sys + for line in sys.exc_info(): + logger.error("%s" % line) + return [] + + +def sottomenu(item): + logger.info("[seriehd.py] sottomenu") + itemlist = [] + + data = httptools.downloadpage(item.url).data + + patron = '([^<]+)' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedtitle in matches: + itemlist.append( + Item(channel=__channel__, + action="fichas", + title=scrapedtitle, + url=scrapedurl)) + + # Elimina 'Serie TV' de la lista de 'sottomenu' + itemlist.pop(0) + + return itemlist + + +def fichas(item): + logger.info("[seriehd.py] fichas") + itemlist = [] + + data = httptools.downloadpage(item.url).data + + patron = '

    (.*?)

    \s*' + patron += '[^\s*' + patron += '' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedtitle, scrapedthumbnail, scrapedurl in matches: + scrapedthumbnail = httptools.get_url_headers(scrapedthumbnail) + scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle).strip() + itemlist.append(infoIca( + Item(channel=__channel__, + action="episodios", + title="[COLOR azure]" + scrapedtitle + "[/COLOR]", + fulltitle=scrapedtitle, + url=scrapedurl, + show=scrapedtitle, + thumbnail=scrapedthumbnail), tipo='tv')) + + patron = "\d+\d+" + next_page = scrapertools.find_single_match(data, patron) + if next_page != "": + itemlist.append( + Item(channel=__channel__, + action="fichas", + title="[COLOR lightgreen]" + config.get_localized_string(30992) + "[/COLOR]", + url=next_page)) + + return itemlist + + +def episodios(item): + logger.info("[seriehd.py] episodios") + itemlist = [] + + data = httptools.downloadpage(item.url).data + + patron = r'