Aggiornamento filmontv

This commit is contained in:
Alhaziel01
2020-06-27 19:51:35 +02:00
parent 920156c55f
commit 579e36b23c
2 changed files with 70 additions and 57 deletions
+5 -5
View File
@@ -76,7 +76,7 @@ def getchanneltypes(view="thumb_"):
logger.info() logger.info()
# Category List # Category List
channel_types = ["movie", "tvshow", "anime", "documentary", "vos", "direct", "live", "torrent", "music"] channel_types = ["movie", "tvshow", "anime", "documentary", "vos", "live", "torrent", "music"] #, "direct"
# Channel Language # Channel Language
channel_language = auto_filter() channel_language = auto_filter()
@@ -296,7 +296,7 @@ def thumb(item_or_itemlist=None, genre=False, thumb=''):
import re import re
icon_dict = {'movie':['film', 'movie'], icon_dict = {'movie':['film', 'movie'],
'tvshow':['serie','tv','episodi','episodio','fiction', 'show'], 'tvshow':['serie','tv','episodi','episodio','fiction', 'show'],
'documentary':['documentari','documentario', 'documentary'], 'documentary':['documentari','documentario', 'documentary', 'documentaristico'],
'teenager':['ragazzi','teenager', 'teen'], 'teenager':['ragazzi','teenager', 'teen'],
'learning':['learning'], 'learning':['learning'],
'all':['tutti', 'all'], 'all':['tutti', 'all'],
@@ -308,17 +308,17 @@ def thumb(item_or_itemlist=None, genre=False, thumb=''):
'action':['azione', 'arti marziali', 'action'], 'action':['azione', 'arti marziali', 'action'],
'adventure': ['avventura', 'adventure'], 'adventure': ['avventura', 'adventure'],
'biographical':['biografico', 'biographical'], 'biographical':['biografico', 'biographical'],
'comedy':['comico', 'commedia', 'demenziale', 'comedy'], 'comedy':['comico', 'commedia', 'demenziale', 'comedy', 'brillante'],
'adult':['erotico', 'hentai', 'harem', 'ecchi', 'adult'], 'adult':['erotico', 'hentai', 'harem', 'ecchi', 'adult'],
'drama':['drammatico', 'drama', 'dramma'], 'drama':['drammatico', 'drama', 'dramma'],
'syfy':['fantascienza', 'science fiction', 'syfy', 'sci'], 'syfy':['fantascienza', 'science fiction', 'syfy', 'sci'],
'fantasy':['fantasy', 'magia', 'magic'], 'fantasy':['fantasy', 'magia', 'magic', 'fantastico'],
'crime':['gangster','poliziesco', 'crime', 'crimine'], 'crime':['gangster','poliziesco', 'crime', 'crimine'],
'grotesque':['grottesco', 'grotesque'], 'grotesque':['grottesco', 'grotesque'],
'war':['guerra', 'war'], 'war':['guerra', 'war'],
'children':['bambini', 'kids'], 'children':['bambini', 'kids'],
'horror':['horror'], 'horror':['horror'],
'music':['musical', 'musica', 'music'], 'music':['musical', 'musica', 'music', 'musicale'],
'mistery':['mistero', 'giallo', 'mystery'], 'mistery':['mistero', 'giallo', 'mystery'],
'noir':['noir'], 'noir':['noir'],
'popular' : ['popolari','popolare', 'più visti'], 'popular' : ['popolari','popolare', 'più visti'],
+65 -52
View File
@@ -9,15 +9,16 @@ from core.item import Item
from platformcode import logger from platformcode import logger
host = "http://epg-guide.com/kltv.gz" host = "http://epg-guide.com/kltv.gz"
blacklisted_genres = ['attualita', 'scienza', 'religione', 'cucina', 'notiziario', 'altro', 'soap opera', 'viaggi', 'economia', 'tecnologia', 'magazine', 'show', 'reality show', 'lifestyle', 'societa', 'wrestling', 'azione', 'Musica', 'real life', 'real adventure', 'dplay original', 'natura', 'news', 'food', 'sport', 'moda', 'arte e cultura', 'crime', 'box set e serie tv', 'casa', 'storia', 'talk show', 'motori', 'attualit\xc3\xa0 e inchiesta', 'documentari', 'musica', 'spettacolo', 'medical', 'talent show', 'sex and love', 'beauty and style', 'news/current affairs', "children's/youth programmes", 'leisure hobbies', 'social/political issues/economics', 'education/science/factual topics', 'undefined content', 'show/game show', 'music/ballet/dance', 'sports', 'arts/culture', 'biografico', 'informazione']
def mainlist(item): def mainlist(item):
support.log() support.log()
itemlist = [Item(title=support.typo('Film in onda oggi', 'bold'), channel=item.channel, action='category', contentType='movie'), itemlist = [Item(title=support.typo('Film in onda oggi', 'bold'), channel=item.channel, action='category', contentType='movie', thumbnail=support.thumb(thumb='movie.png')),
Item(title=support.typo('Serie Tv in onda oggi', 'bold'), channel=item.channel, action='peliculas', contentType='tvshow'), Item(title=support.typo('Serie Tv in onda oggi', 'bold'), channel=item.channel, action='peliculas', contentType='tvshow', thumbnail=support.thumb(thumb='tvshow.png')),
Item(title=support.typo('Guida tv per canale', 'bold'), channel=item.channel, action='listaCanali'), Item(title=support.typo('Guida tv per canale', 'bold'), channel=item.channel, action='listaCanali', thumbnail=support.thumb(thumb='on_the_air.png')),
Item(title=support.typo('Canali live (Rai Play)', 'bold'), channel=item.channel, action='live')] Item(title=support.typo('Canali live (Rai Play)', 'bold'), channel=item.channel, action='live', thumbnail=support.thumb(thumb='tvshow_on_the_air.png'))]
return itemlist return itemlist
@@ -46,11 +47,11 @@ def getEpg():
def category(item): def category(item):
itemlist = [Item(title="Tutti", all=True, channel=item.channel, action='peliculas', contentType=item.contentType)] itemlist = [Item(title="Tutti", all=True, channel=item.channel, action='peliculas', contentType=item.contentType)]
category = ['Famiglia', 'Documentario', 'Thriller', 'Azione', 'Crime', 'Drammatico', 'Western', 'Avventura', 'Commedia', 'Fantascienza', 'Fantastico', 'Animazione', 'Horror', 'Mistero', 'Sport', 'Mondo e Tendenze', 'Intrattenimento', 'Musicale', 'Guerra', 'Storico', 'Biografico', 'Poliziesco'] category = ['Animazione', 'Avventura', 'Azione', 'Biografico', 'Brillante', 'Comico', 'Commedia', 'Crime', 'Documentario', 'Documentaristico', 'Drammatico', 'Famiglia', 'Fantascienza', 'Fantastico', 'Giallo', 'Guerra', 'Horror', 'Mistero', 'Musicale', 'Poliziesco', 'Sexy', 'Storico', 'Thriller', 'Western']
for cat in category: for cat in category:
itemlist.append(Item(title=cat, category=cat, channel=item.channel, action='peliculas', contentType=item.contentType)) itemlist.append(Item(title=cat, category=cat, channel=item.channel, action='peliculas', contentType=item.contentType))
return itemlist return support.thumb(itemlist)
def peliculas(item, f=None, ): def peliculas(item, f=None, ):
@@ -78,34 +79,36 @@ def peliculas(item, f=None, ):
if '<programme' in line: if '<programme' in line:
channel = scrapertools.find_single_match(line, r'channel="([^"]+)"') channel = scrapertools.find_single_match(line, r'channel="([^"]+)"')
elif '<title' in line: elif '<title' in line:
title = scrapertools.find_single_match(line, r'>([^<]+?)(?: - 1\s*\^\s*TV)?<') title = scrapertools.find_single_match(line, r'>([^<]+?)(?: - (?:1\s*\^\s*TV|Prima\s*T[Vv]))?<')
if title in titles: if not title or title in titles:
skip = True skip = True
elif not skip and '<desc' in line: elif not skip and '<desc' in line:
for match in scrapertools.find_multiple_matches_groups(line, r'>(?:\[(?P<genre>[^\]]+)\])?(?P<episode>S[0-9]+\s*Ep?[0-9]+)?(?P<plot>[^<]+)'): genre, episode, plot = scrapertools.find_single_match(line, r'>(?:\[([^\]]+)\])?(S[0-9]+\s*Ep?[0-9]+)?(?:\s*-\s*)?([^<]+)')
if match['genre']: if plot:
genres.append(match['genre']) CY = scrapertools.find_single_match(plot, r'(\D{3}) (\d{4})')
episode = match['episode'] if CY: country, year = CY
plot = match['plot'] director = scrapertools.find_single_match(plot, r'Regia di ([^;|<]+)')
if episode and item.contentType == 'movie': skip = True
if episode and item.contentType == 'movie': elif not skip and '<category' in line:
skip = True genre = scrapertools.find_single_match(line, r'>([^<]+)<')
elif not skip and '<actor' in line: # elif not skip and '<actor' in line:
match = scrapertools.find_single_match(line, r'(?:role="([^"]*)")?>([^<]+)<') # match = scrapertools.find_single_match(line, r'(?:role="([^"]*)")?>([^<]+)<')
actors.append([match[1], match[0]]) # actors.append([match[1], match[0]])
elif not skip and '<director' in line: # elif not skip and '<director' in line:
director = scrapertools.find_single_match(line, r'>([^<]+)<') # director = scrapertools.find_single_match(line, r'>([^<]+)<')
elif not skip and '<date' in line: # elif not skip and '<date' in line:
year = scrapertools.find_single_match(line, r'>([^<]+)<') # year = scrapertools.find_single_match(line, r'>([^<]+)<')
elif not skip and '<country' in line: # elif not skip and '<country' in line:
country = scrapertools.find_single_match(line, r'>([^<]+)<') # country = scrapertools.find_single_match(line, r'>([^<]+)<')
elif not skip and '<episode-num' in line: # elif not skip and '<episode-num' in line:
episode = scrapertools.find_single_match(line, r'>([^<]+)<') # episode = scrapertools.find_single_match(line, r'>([^<]+)<')
if item.contentType == 'movie': # if item.contentType == 'movie':
skip = True # skip = True
elif not skip and '<icon' in line: # elif not skip and '<icon' in line:
thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"') # thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"')
elif '</programme' in line: elif '</programme' in line:
if genre in blacklisted_genres: skip = True
elif genre: genres = genre.split('/')
if not skip: if not skip:
titles.append(title) titles.append(title)
if (item.contentType == 'movie' and genres and (item.category in genres or item.all==True)) or (item.contentType == 'tvshow' and episode): if (item.contentType == 'movie' and genres and (item.category in genres or item.all==True)) or (item.contentType == 'tvshow' and episode):
@@ -119,10 +122,9 @@ def peliculas(item, f=None, ):
thumbnail=thumbnail if thumbnail else item.thumbnail, thumbnail=thumbnail if thumbnail else item.thumbnail,
contentType=item.contentType, contentType=item.contentType,
channel_name=channel, channel_name=channel,
plot=plot,
infoLabels={ infoLabels={
'title': title, 'title': title,
'plot': plot,
'castandrole': actors,
'director': director, 'director': director,
'genre': genres, 'genre': genres,
'country': country, 'country': country,
@@ -158,7 +160,9 @@ def listaCanali(item):
while line: while line:
line = f.readline() line = f.readline()
if '<channel' in line: if '<channel' in line:
channel = scrapertools.find_single_match(line, r'id="([^"]+)"') channelID = scrapertools.find_single_match(line, r'id="([^"]+)"')
elif '<display-name' in line:
channelName = scrapertools.find_single_match(line, r'>([^<]+)<')
elif not skip and '<icon' in line: elif not skip and '<icon' in line:
thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"') thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"')
elif not skip and '<programme' in line: elif not skip and '<programme' in line:
@@ -168,8 +172,8 @@ def listaCanali(item):
itemlist.append(Item( itemlist.append(Item(
channel=item.channel, channel=item.channel,
action='guidatv', action='guidatv',
title=support.typo(channel, 'bold'), title=support.typo(channelName, 'bold'),
channelName=channel, channelID=channelID,
thumbnail=thumbnail thumbnail=thumbnail
)) ))
thumbnail = None thumbnail = None
@@ -205,31 +209,40 @@ def guidatv(item):
line = f.readline() line = f.readline()
if '<programme' in line: if '<programme' in line:
start, stop, channel = scrapertools.find_single_match(line,r'start="([^"]*)" stop="([^"]*)" channel="([^"]+)"') start, stop, channel = scrapertools.find_single_match(line,r'start="([^"]*)" stop="([^"]*)" channel="([^"]+)"')
if channel != item.channelName: if channel != item.channelID:
skip = True skip = True
elif not skip and '<title' in line: elif not skip and '<title' in line:
title = scrapertools.find_single_match(line, r'>([^<]+?)<') title = scrapertools.find_single_match(line, r'>([^<]+?)<')
if title == 'EPG non disponibile': if title == 'EPG non disponibile':
skip = True skip = True
elif not skip and '<desc' in line: elif not skip and '<desc' in line:
plot = scrapertools.find_single_match(line, r'>([^<]+)<') genre, episode, plot = scrapertools.find_single_match(line, r'>(?:\[([^\]]+)\])?(S[0-9]+\s*Ep?[0-9]+)?(?:\s*-\s*)?([^<]+)')
elif not skip and '<actor' in line: if plot:
match = scrapertools.find_single_match(line, r'(?:role="([^"]*)")?>([^<]+)<') CY = scrapertools.find_single_match(plot, r'(\D{3}) (\d{4})')
actors.append([match[1], match[0]]) if CY: country, year = CY
elif not skip and '<director' in line: director = scrapertools.find_single_match(plot, r'Regia di ([^;|<]+)')
director = scrapertools.find_single_match(line, r'>([^<]+)<') if genre: genres.append(genre)
elif not skip and '<date' in line: if episode and item.contentType == 'movie':skip = True
year = scrapertools.find_single_match(line, r'>([^<]+)<')
elif not skip and '<category' in line: elif not skip and '<category' in line:
genres.append(scrapertools.find_single_match(line, r'>([^<]+)<')) genre = scrapertools.find_single_match(line, r'>([^<]+)<')
elif not skip and '<country' in line: # elif not skip and '<actor' in line:
country = scrapertools.find_single_match(line, r'>([^<]+)<') # match = scrapertools.find_single_match(line, r'(?:role="([^"]*)")?>([^<]+)<')
elif not skip and '<episode-num' in line: # actors.append([match[1], match[0]])
episode = scrapertools.find_single_match(line, r'>([^<]+)<') # elif not skip and '<director' in line:
elif not skip and '<icon' in line: # director = scrapertools.find_single_match(line, r'>([^<]+)<')
thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"') # elif not skip and '<date' in line:
# year = scrapertools.find_single_match(line, r'>([^<]+)<')
# elif not skip and '<category' in line:
# genres.append(scrapertools.find_single_match(line, r'>([^<]+)<'))
# elif not skip and '<country' in line:
# country = scrapertools.find_single_match(line, r'>([^<]+)<')
# elif not skip and '<episode-num' in line:
# episode = scrapertools.find_single_match(line, r'>([^<]+)<')
# elif not skip and '<icon' in line:
# thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"')
elif '</programme' in line: elif '</programme' in line:
if not skip: if not skip:
if genre: genres = genre.split('/')
tzHour = int(start.split('+')[1][:2]) tzHour = int(start.split('+')[1][:2])
start = time.strptime(start.split(' ')[0], '%Y%m%d%H%M%S') start = time.strptime(start.split(' ')[0], '%Y%m%d%H%M%S')
stop = time.strptime(stop.split(' ')[0], '%Y%m%d%H%M%S') stop = time.strptime(stop.split(' ')[0], '%Y%m%d%H%M%S')