From 9ac9cce63c43a7292bcebd6aef5244dff36a3b24 Mon Sep 17 00:00:00 2001 From: 4l3x87 Date: Sat, 4 May 2019 01:17:32 +0200 Subject: [PATCH] Nuovo canale Oggi in TV inserito nel menu selezione canali --- channels/filmontv.json | 12 ++++++ channels/filmontv.py | 89 ++++++++++++++++++++++++++++++++++++++++++ channelselector.py | 5 +++ 3 files changed, 106 insertions(+) create mode 100644 channels/filmontv.json create mode 100644 channels/filmontv.py diff --git a/channels/filmontv.json b/channels/filmontv.json new file mode 100644 index 00000000..70a0ad29 --- /dev/null +++ b/channels/filmontv.json @@ -0,0 +1,12 @@ +{ + "id": "filmontv", + "name": "Film in tv", + "language": ["ita"], + "active": false, + "adult": false, + "thumbnail": null, + "banner": null, + "categories": [], + "settings": [], + "channel": false +} \ No newline at end of file diff --git a/channels/filmontv.py b/channels/filmontv.py new file mode 100644 index 00000000..46ade803 --- /dev/null +++ b/channels/filmontv.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Canale film in tv +# Ringraziamo Icarus crew +# ------------------------------------------------------------ + +import re +import urllib + +from channels import support +from core import httptools, scrapertools, tmdb +from core.item import Item +from platformcode import logger + +host = "https://www.comingsoon.it" + +TIMEOUT_TOTAL = 60 + + +def mainlist(item): + logger.info(" mainlist") + itemlist = [Item(channel=item.channel, + title=support.typo("IN ONDA ADESSO bold color kod"), + action="tvoggi", + url="%s/filmtv/" % host, + thumbnail=""), + Item(channel=item.channel, + title="Mattina", + action="tvoggi", + url="%s/filmtv/oggi/mattina/" % host, + thumbnail=""), + Item(channel=item.channel, + title="Pomeriggio", + action="tvoggi", + url="%s/filmtv/oggi/pomeriggio/" % host, + thumbnail=""), + Item(channel=item.channel, + title="Sera", + action="tvoggi", + url="%s/filmtv/oggi/sera/" % host, + thumbnail=""), + Item(channel=item.channel, + title="Notte", + action="tvoggi", + url="%s/filmtv/oggi/notte/" % host, + thumbnail="")] + + return itemlist + + +def tvoggi(item): + logger.info("filmontv tvoggi") + itemlist = [] + + # Carica la pagina + data = httptools.downloadpage(item.url).data + + # Estrae i contenuti + patron = r'
[^<]+(.*?)<[^<]+<[^<]+<[^<]+<[^>]+>
(.*?)<[^<]+
[^<]+<[^<]+<[^<]+<[^>]+>[^<]+<[^<]+<[^<]+<[^>]+><[^<]+<[^>]+>:\s*([^<]+)[^<]+<[^<]+[^<]+<[^<]+[^<]+<[^<]+[^<]+[^>]+>:\s*([^<]+)' + # patron = r'
[^<]+(.*?)<[^<]+<[^<]+<[^<]+<[^>]+>
(.*?)<[^<]+
' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedthumbnail, scrapedtitle, scrapedtv, scrapedgender, scrapedyear in matches: + # for scrapedthumbnail, scrapedtitle, scrapedtv in matches: + scrapedurl = "" + scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle).strip() + infoLabels = {} + infoLabels["year"] = scrapedyear + itemlist.append( + Item(channel=item.channel, + action="do_search", + extra=urllib.quote_plus(scrapedtitle) + '{}' + 'movie', + title=scrapedtitle + "[COLOR yellow] " + scrapedtv + "[/COLOR]", + fulltitle=scrapedtitle, + url=scrapedurl, + thumbnail=scrapedthumbnail, + contentTitle=scrapedtitle, + contentType='movie', + infoLabels=infoLabels, + folder=True)) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + return itemlist + + +def do_search(item): + from channels import search + return search.do_search(item) \ No newline at end of file diff --git a/channelselector.py b/channelselector.py index 65c454e0..3b942e8e 100644 --- a/channelselector.py +++ b/channelselector.py @@ -91,6 +91,11 @@ def getchanneltypes(view="thumb_"): channel_type=channel_type, viewmode="thumbnails", thumbnail=get_thumb("channels_%s.png" % channel_type, view))) + itemlist.append(Item(title='Oggi in TV', channel="filmontv", action="mainlist", view=view, + category=title, channel_type="all", thumbnail=get_thumb("on_the_air.png", view), + viewmode="thumbnails")) + + itemlist.append(Item(title=config.get_localized_string(70685), channel="community", action="mainlist", view=view, category=title, channel_type="all", thumbnail=get_thumb("channels_community.png", view), viewmode="thumbnails"))