From 0e7a059daff49bfe73885e1e300d2b0db9cd42e3 Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 29 Jun 2020 12:57:27 +0200 Subject: [PATCH] piccole migliorie --- core/scrapertools.py | 2 +- platformcode/platformtools.py | 16 ++++++++-------- specials/filmontv.py | 19 +++++++++++++++---- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/core/scrapertools.py b/core/scrapertools.py index 08e32108..43631578 100644 --- a/core/scrapertools.py +++ b/core/scrapertools.py @@ -432,7 +432,7 @@ def get_season_and_episode(title): """ filename = "" - patrons = ["(\d+)\s*[x-]\s*(\d+)", "(\d+)\s*×\s*(\d+)", "(?:[Ss]|[Tt])(\d+)(?:[Ee]|Ep\.)(\d+)", + patrons = ["(\d+)\s*[x-]\s*(\d+)", "(\d+)\s*×\s*(\d+)", "(?:[Ss]|[Tt])(\d+)\s?(?:[Ee]|Ep\.?)(\d+)", "(?:[Ss]tag|[Ss]eason|[Ss]tagione\w*)\s*(\d+)\s*(?:[Ee]pi|[Ee]pisode|[Ee]pisodio\w*)\s*(\d+)"] for patron in patrons: diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index afe0b1fd..d62934ca 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -116,15 +116,15 @@ def dialog_browse(_type, heading, default=""): def itemlist_refresh(): - pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition - logger.info('Current position: ' + str(pos)) + # pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition + # logger.info('Current position: ' + str(pos)) xbmc.executebuiltin("Container.Refresh") - while Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition != pos: - win = xbmcgui.Window(xbmcgui.getCurrentWindowId()) - cid = win.getFocusId() - ctl = win.getControl(cid) - ctl.selectItem(pos) + # while Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition != pos: + # win = xbmcgui.Window(xbmcgui.getCurrentWindowId()) + # cid = win.getFocusId() + # ctl = win.getControl(cid) + # ctl.selectItem(pos) def itemlist_update(item, replace=False): @@ -162,7 +162,7 @@ def render_items(itemlist, parent_item): dirItems = [] for n, item in enumerate(itemlist): - item.itemlistPosition = n + 1 + # item.itemlistPosition = n + 1 item_url = item.tourl() if item.category == "": diff --git a/specials/filmontv.py b/specials/filmontv.py index 813dabd5..5c4e260d 100644 --- a/specials/filmontv.py +++ b/specials/filmontv.py @@ -9,7 +9,7 @@ from core.item import Item from platformcode import logger 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'] +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', 'documentario'] def mainlist(item): @@ -69,6 +69,7 @@ def peliculas(item, f=None, ): director = '' year = '' genres = [] + genre = '' country = '' skip = False @@ -80,7 +81,7 @@ def peliculas(item, f=None, ): channel = scrapertools.find_single_match(line, r'channel="([^"]+)"') elif '([^<]+?)(?: - (?:1\s*\^\s*TV|Prima\s*T[Vv]))?<') - if not title or title in titles: + if not title or title in titles or title == 'EPG non disponibile': skip = True elif not skip and '(?:\[([^\]]+)\])?(S[0-9]+\s*Ep?[0-9]+)?(?:\s*-\s*)?([^<]+)') @@ -111,13 +112,20 @@ def peliculas(item, f=None, ): elif genre: genres = genre.split('/') if not skip: 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): + if episode: + episode = scrapertools.get_season_and_episode(episode) + se, ep = episode.split('x') + else: + se, ep = ('', '') itemlist.append(Item( channel=item.channel, action='new_search', title=support.typo(title + (' - ' + episode if episode else ''), 'bold'), contentTitle=title if item.contentType == 'movie' else '', contentSerieName=title if item.contentType == 'tvshow' else '', + contentSeason=se, + contentEpisodeNumber=ep, fulltitle=title, search_text=title, mode=item.contentType, @@ -129,7 +137,9 @@ def peliculas(item, f=None, ): 'director': director, 'genre': genres, 'country': country, - 'year': year + 'year': year, + 'season': se, + 'episode': ep } )) @@ -142,6 +152,7 @@ def peliculas(item, f=None, ): director = '' year = '' genres = [] + genre = '' country = '' skip = False