diff --git a/channels/accuradio.py b/channels/accuradio.py index 46527398..dec8ac88 100644 --- a/channels/accuradio.py +++ b/channels/accuradio.py @@ -4,7 +4,7 @@ # ------------------------------------------------------------ import random -from core import httptools, support +from core import httptools, support, config from platformcode import logger host = 'https://www.accuradio.com' @@ -12,29 +12,27 @@ api_url = host + '/c/m/json/{}/' headers = [['Referer', host]] - def mainlist(item): + js = httptools.downloadpage(api_url.format('brands')).json itemlist = [] item.action = 'peliculas' js = httptools.downloadpage(api_url.format('brands')).json - for it in js.get('features',[]): + for it in js.get('features',[]) + js.get('brands',[]): itemlist.append( item.clone(url= '{}/{}'.format(host,it.get('canonical_url','')), - title=support.typo(it['name'],'italic') + support.typo(it.get('channels',''),'_ [] color kod') - )) - for it in js.get('brands',[]): - itemlist.append( - item.clone(url= '{}/{}'.format(host,it.get('canonical_url','')), - title=support.typo(it['name'],'bullet bold') + support.typo(it.get('channels',''),'_ [] color kod') + extraInfo = it.get('channels',''), + title=it['name'], + thumbnail = support.thumb('music') )) - itemlist.append(item.clone(title=support.typo('Cerca...', 'bold color kod'), action='search', thumbnail=support.thumb('search'))) + itemlist.append(item.clone(title=support.typo(config.get_localized_string(70741) % 'Musica… ', 'bold'), action='search', thumbnail=support.thumb('music_search'))) support.channel_config(item, itemlist) return itemlist @support.scrape def peliculas(item): + disabletmdb = True action = 'playradio' patron = r'data-id="(?P[^"]+)"\s*data-oldid="(?P[^"]+)".*?data-name="(?P[^"]+)(?:[^>]+>){5}<img class="[^"]+"\s*src="(?P<thumb>[^"]+)(?:[^>]+>){6}\s*(?P<plot>[^<]+)' return locals() diff --git a/channels/altadefinizione01.py b/channels/altadefinizione01.py index d815496d..d35e23c6 100644 --- a/channels/altadefinizione01.py +++ b/channels/altadefinizione01.py @@ -65,8 +65,9 @@ def peliculas(item): else: patronBlock = r'<div class="cover_kapsul ml-mask">(?P<block>.*)<div class="page_nav">' - patronNext = '<span>\d</span> <a href="([^"]+)">' - # debug = True + patronNext = '<a href="([^"]+)">»' + patronTotalPages = r'>(\d+)(?:[^>]+>){3}»' + # debugBlock = True return locals() @@ -97,7 +98,6 @@ def orderalf(item): patron = r'<td class="mlnh-thumb"><a href="(?P<url>[^"]+)".*?src="(?P<thumb>[^"]+)"'\ '.+?[^>]+>[^>]+ [^>]+[^>]+ [^>]+>(?P<title>[^<]+).*?[^>]+>(?P<year>\d{4})<'\ '[^>]+>[^>]+>(?P<quality>[A-Z]+)[^>]+> <td class="mlnh-5">(?P<lang>.*?)</td>' - patronNext = r'<span>[^<]+</span>[^<]+<a href="(.*?)">' return locals() @@ -105,7 +105,7 @@ def orderalf(item): def search(item, text): support.info(item, text) - + itemlist = [] text = text.replace(" ", "+") item.url = host + "/index.php?do=search&story=%s&subaction=search" % (text) diff --git a/channels/altadefinizione01_link.py b/channels/altadefinizione01_link.py index e1e28686..185ca179 100644 --- a/channels/altadefinizione01_link.py +++ b/channels/altadefinizione01_link.py @@ -32,12 +32,8 @@ def mainlist(item): @support.scrape def peliculas(item): - # debug = True - support.info('peliculas',item) - patron = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)(?:[^>]+>){5}\s*<div class="[^"]+" style="background-image:url\((?P<thumb>[^\)]+)(?:[^>]+>){6}\s*(?P<year>\d{4})[^>]+>[^>]+>(?:\s*(?P<duration>\d+))?(?:[^>]+>){0,2}\s+(?P<quality>[a-zA-Z]+)\s+(?:[^>]+>){2}\s*(?P<lang>[^>]+)\s+[^>]+>' patronNext = r'<span>\d</span> <a href="([^"]+)">' - # debug = True return locals() # =========== def pagina categorie ====================================== @@ -56,8 +52,6 @@ def genres(item): patronBlock = r'FILM RANDOM.*?class="listSubCat">(?P<block>.*)</ul>' action = 'findvideos' patronMenu = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<' - - #debug = True return locals() # =========== def per cercare film/serietv ============= diff --git a/channels/altadefinizioneclick.py b/channels/altadefinizioneclick.py index 83af45fa..5995d8d9 100644 --- a/channels/altadefinizioneclick.py +++ b/channels/altadefinizioneclick.py @@ -52,8 +52,9 @@ def peliculas(item): if not item.args: # patronBlock = r'(?:ULTIMI INSERITI|Serie TV)(?P<block>.*?)</section' patronBlock = r'({})(?P<block>.*?)</section'.format('ULTIMI INSERITI' if item.contentType == 'movie' else 'Serie TV') - + # debugBlock = True patronNext = r'<a class="next page-numbers" href="([^"]+)">' + patronTotalPages = r'>(\d+)(?:[^>]+>){3}<a class="next' return locals() diff --git a/channels/altadefinizionecommunity.py b/channels/altadefinizionecommunity.py index c53b9cc5..bc36707d 100644 --- a/channels/altadefinizionecommunity.py +++ b/channels/altadefinizionecommunity.py @@ -2,7 +2,7 @@ # ------------------------------------------------------------ # Canale per Altadefinizione Community -from core import support +from core import jsontools, support from lib.fakeMail import Gmailnator from platformcode import config, platformtools, logger from core import scrapertools, httptools @@ -132,7 +132,7 @@ def peliculas(item): json = {} if item.contentType == 'undefined': - disabletmdb = True + # disabletmdb = True action = 'check' elif item.contentType == 'movie': action = 'findvideos' @@ -149,15 +149,17 @@ def peliculas(item): else: json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json data = "\n".join(json['data']) - patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">\s*<span class="year">(?P<year>[0-9]{4})</span>\s*<span[^>]+>[^<]+</span>\s*<span class="qual">(?P<quality>[^<]+).*?<img src="(?P<thumbnail>[^"]+)[^>]+>\s*<h3>(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' + patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">\s*<span class="year">(?P<year>[0-9]{4})</span>\s*<span[^>]+>(?P<rating>[^<]+)</span>\s*<span class="qual">(?P<quality>[^<]+).*?<img src="(?P<thumbnail>[^"]+)(?:[^>]+>){1,2}\s*<h3>(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' # paginazione + logger.debug('JSON FIND',jsontools.load(json)) if json.get('have_next'): def fullItemlistHook(itemlist): spl = item.url.split('=') url = '='.join(spl[:-1]) page = str(int(spl[-1])+1) - support.nextPage(itemlist, item, next_page='='.join((url, page)), function_or_level='peliculas') + total_pages = json.get('lastPage', 0) + support.nextPage(itemlist, item, next_page='='.join((url, page)), function_or_level='peliculas', total_pages=total_pages) return itemlist return locals() diff --git a/channels/animeforce.py b/channels/animeforce.py index 5d7de661..8f8c99bb 100644 --- a/channels/animeforce.py +++ b/channels/animeforce.py @@ -27,12 +27,12 @@ def mainlist(item): def submenu(item): action = 'peliculas' patronBlock = r'data-taxonomy="' + item.args + r'"(?P<block>.*?)</select' - patronMenu = r'<option class="level-\d+ (?P<u>[^"]+)"[^>]+>(?P<t>[^(]+)[^\(]+\((?P<num>\d+)' + patronMenu = r'<option class="level-\d+ (?P<u>[^"]+)"[^>]+>(?P<title>[^(]+)[^\(]+\((?P<num>\d+)' if 'genre' in item.args: patronGenreMenu = patronMenu def itemHook(item): item.url += host + '/anime/' + item.args + '/' + item.u - item.title = support.typo(item.t, 'bold') + # item.title = support.typo(item.t, 'bold') return item return locals() @@ -90,7 +90,6 @@ def peliculas(item): def itemHook(item): if 'sub-ita' in item.url: - if item.args != 'newest': item.title = item.title + support.typo('Sub-ITA','_ [] color kod') item.contentLanguage = 'Sub-ITA' return item diff --git a/channels/animeleggendari.py b/channels/animeleggendari.py index 0eb86e6f..bfd00a61 100644 --- a/channels/animeleggendari.py +++ b/channels/animeleggendari.py @@ -63,7 +63,7 @@ def peliculas(item): def itemHook(item): if 'movie' in item.title.lower(): item.title = support.re.sub(' - [Mm][Oo][Vv][Ii][Ee]|[Mm][Oo][Vv][Ii][Ee]','',item.title) - item.title += support.typo('Movie','_ () bold') + # item.title += support.typo('Movie','_ () bold') item.contentType = 'movie' item.action = 'findvideos' return item @@ -107,10 +107,10 @@ def episodios(item): if not item.url: item.url = url if 'Movie Parte' in data: - item.title = support.typo(item.fulltitle + ' - Part ','bold') + item.title + item.title = item.fulltitle + ' - Part ' + item.title item.contentType = 'movie' else: - item.title = support.typo('Episodio ', 'bold') + item.title + item.title = 'Episodio ' + item.title return item return locals() diff --git a/channels/animeunity.py b/channels/animeunity.py index 6b5af247..fc0f997f 100644 --- a/channels/animeunity.py +++ b/channels/animeunity.py @@ -33,6 +33,7 @@ def mainlist(item): search ='' return locals() + def menu(item): item.action = 'peliculas' ITA = copy.copy(item.args) @@ -200,11 +201,12 @@ def episodios(item): title = 'Parte ' if item.type.lower() == 'movie' else 'Episodio ' for it in item.episodes: itemlist.append( - item.clone(title=support.typo(title + it['number'], 'bold'), + item.clone(title=title, episode = it['number'], fulltitle=item.title, show=item.title, contentTitle='', + contentEpisodeNumber=it['number'], contentSerieName=item.contentSerieName, thumbnail=item.thumbnail, plot=item.plot, diff --git a/channels/casacinema.py b/channels/casacinema.py index e3d3a486..f2eef748 100644 --- a/channels/casacinema.py +++ b/channels/casacinema.py @@ -110,17 +110,17 @@ def peliculas(item): patron = r'<li><a href="(?P<url>[^"]+)"[^=]+="(?P<thumb>[^"]+)"><div>\s*?<div[^>]+>(?P<title>[^\(\[<]+)(?P<title2>\([\D*]+\))?(?:\[(?P<quality1>HD)\])?\s?(?:[\(\[])?(?P<lang>[sS]ub-[iI][tT][aA])?(?:[\)\]])?\s?(?:\[(?P<quality>.+?)\])?\s?(?:\((?P<year>\d+)\))?(?:\(\D{2}\s\d{4}\))?<' patronNext = r'<a href="([^"]+)"\s*>Pagina' - # debug = True + patronTotalPages = r'>(\d+)(?:[^>]+>){4}Pagina' def itemHook(item): if item.quality1: item.quality = item.quality1 - item.title += support.typo(item.quality, '_ [] color kod') + # item.title += support.typo(item.quality, '_ [] color kod') if item.lang2: item.contentLanguage = item.lang2 - item.title += support.typo(item.lang2, '_ [] color kod') - if item.args == 'novita': - item.title = item.title + # item.title += support.typo(item.lang2, '_ [] color kod') + # if item.args == 'novita': + # item.title = item.title # if 'wp-content' in item.thumbnail and not item.infoLabels['year']: # item.infoLabels['year'] = item.thumbnail.split('/')[5] return item diff --git a/channels/cineblog01.py b/channels/cineblog01.py index 4610b144..07f00962 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -122,6 +122,7 @@ def peliculas(item): item.contentType = 'tvshow' patronNext = '<a class="?page-link"? href="?([^>"]+)"?><i class="fa fa-angle-right">' + patronTotalPages = '(\d+[\.]?\d+)</option>\s*</sele' def itemHook(item): if item.quality2: diff --git a/channels/discoveryplus.py b/channels/discoveryplus.py index 491c1695..b7ebf85d 100644 --- a/channels/discoveryplus.py +++ b/channels/discoveryplus.py @@ -4,9 +4,8 @@ # ------------------------------------------------------------ import requests -from core import support, jsontools -from platformcode import logger, config -typo = support.typo +from core import support +from platformcode import logger session = requests.Session() host = support.config.get_channel_url() @@ -65,7 +64,7 @@ def live(item): logger.debug() itemlist =[] for name, values in liveDict().items(): - itemlist.append(item.clone(title=typo(name,'bold'), fulltitle=name, plot=values['plot'], url=values['url'], id=values['id'], action='play', forcethumb=True, no_return=True)) + itemlist.append(item.clone(title=name, fulltitle=name, plot=values['plot'], url=values['url'], id=values['id'], action='play', forcethumb=True, no_return=True)) return support.thumb(itemlist, mode='live') @@ -116,7 +115,7 @@ def peliculas(item): fanarts = [image['attributes']['src'] for image in images if len(key['relationships']['images']['data']) > 1 and image['id'] == key['relationships']['images']['data'][1]['id']] fanart = fanarts[0] if fanarts else item.fanart itemlist.append( - item.clone(title=typo(title,'bold'), + item.clone(title=title, fulltitle=title, plot=plot, url=url, @@ -163,7 +162,7 @@ def episodios(item): title = '{}x{:02d} - {}'.format(option['id'], episode['attributes']['episodeNumber'], episode['attributes']['name']) plot = episode['attributes']['description'] itemlist.append( - item.clone(title=typo(title,'bold'), + item.clone(title=title, fulltitle=title, plot=plot, id=episode['id'], diff --git a/channels/eurostreaming.py b/channels/eurostreaming.py index b67a33e9..22d7b8c6 100644 --- a/channels/eurostreaming.py +++ b/channels/eurostreaming.py @@ -49,7 +49,7 @@ def episodios(item): if 'clicca qui per aprire' in data.lower(): data = support.match(support.match(data, patron=r'"go_to":"([^"]+)"').match.replace('\\',''), headers=headers).data elif 'clicca qui</span>' in data.lower(): data = support.match(support.match(data, patron=r'<h2 style="text-align: center;"><a href="([^"]+)">').match, headers=headers).data patronBlock = r'</span>(?P<block>[a-zA-Z\s]+\d+(.+?)?(?:\()?(?P<lang>ITA|SUB ITA)(?:\))?.*?)</div></div>' - patron = r'(?P<season>\d+)&#\d+;(?P<episode>\d+(?:-\d+)?)\s*(?:</strong>|<em>)?\s*(?P<title>.*?)(?:–|-.+?-|–.+?–|–|em|.)?(?:/em.*?)?(?:<a (?P<other>.*?))?<br />' + patron = r'(?P<season>\d+)&#\d+;(?P<episode>\d+(?:-\d+)?)\s*(?:</strong>|<em>)?\s*(?P<title>.*?)(?:–|-.+?-|–.+?–|–|em|.)?(?:/em.*?)?(?:<a (?P<data>.*?))<br />' def itemHook(i): i.url = item.url @@ -98,4 +98,4 @@ def newest(categoria): def findvideos(item): support.info() - return support.server(item, item.other) + return support.server(item, item.data) diff --git a/channels/filmpertutti.py b/channels/filmpertutti.py index 9d9cefd6..ff544363 100644 --- a/channels/filmpertutti.py +++ b/channels/filmpertutti.py @@ -8,7 +8,7 @@ from core.item import Item from platformcode import config, logger def findhost(url): - return support.match(url, patron=r'Il nuovo indirizzo di FILMPERTUTTI è ?<a href="([^"]+)', debug=True).match + return support.match(url, patron=r'Il nuovo indirizzo di FILMPERTUTTI è ?<a href="([^"]+)').match host = config.get_channel_url(findhost) headers = [['Referer', host]] @@ -58,10 +58,11 @@ def peliculas(item): @support.scrape def episodios(item): + # debug=True data = support.match(item.url, headers=headers).data if 'accordion-item' in data: patronBlock = r'<span class="season[^>]*>\d+[^>]+>[^>]+>[^>]+>[^>]+>\D*(?:STAGIONE|Stagione)[ -]+(?P<lang>[a-zA-Z\- ]+)[^<]*</span>(?P<block>.*?)<div id="(?:season|disqus)' - patron = r'<img src="(?P<thumb>[^"]+)">.*?<li class="season-no">(?P<season>\d+)(?:×|×|x)(?P<episode>\d+)[^<0-9]*<\/li>(?P<data>.*?javascript:;">(?P<title>[^<]+).*?</tbody>)' + patron = r'data-src="(?P<thumb>[^"]+)"[^>]*>.*?<li class="season-no">(?P<season>\d+)(?:×|×|x)(?P<episode>\d+)[^<0-9]*<\/li>(?P<data>.*?javascript:;">(?P<title>[^<]+).*?</tbody>)' else: patronBlock = r'(?:STAGIONE|Stagione)(?:<[^>]+>)?\s*(?:(?P<lang>[A-Za-z- ]+))?(?P<block>.*?)(?: |<strong>|<div class="addtoany)' patron = r'(?:/>|p>)\s*(?P<season>\d+)(?:×|×|x)(?P<episode>\d+)[^<]+(?P<data>.*?)(?:<br|</p)' diff --git a/channels/metalvideo.py b/channels/metalvideo.py index 50c5817c..0fd57117 100644 --- a/channels/metalvideo.py +++ b/channels/metalvideo.py @@ -3,7 +3,7 @@ # Canale per altadefinizione01 # ------------------------------------------------------------ -from core import support +from core import support, config host = 'https://metalvideo.com' headers = {'X-Requested-With': 'XMLHttpRequest'} @@ -24,11 +24,11 @@ def mainlist(item): itemlist.append( support.Item( channel=item.channel, - title=support.typo('Cerca...', 'bold'), + title=support.typo(config.get_localized_string(70741) % 'Musica… ', 'bold'), contentType='music', url=item.url, action='search', - thumbnail=support.thumb('search'))) + thumbnail=support.thumb('music_search'))) support.channel_config(item, itemlist) return itemlist diff --git a/channels/tunein.py b/channels/tunein.py index 3626891c..c70630cc 100644 --- a/channels/tunein.py +++ b/channels/tunein.py @@ -3,7 +3,7 @@ # Canale per tunein # ------------------------------------------------------------ -from core import scrapertools, support +from core import scrapertools, support, config from platformcode import logger host = 'http://api.radiotime.com' @@ -21,7 +21,7 @@ def mainlist(item): return item def itemlistHook(itemlist): itemlist.append( - item.clone(title=support.typo('Cerca...', 'bold color kod'), action='search', thumbnail=support.thumb('search'))) + item.clone(title=support.typo(config.get_localized_string(70741) % 'Musica… ', 'bold'), action='search', thumbnail=support.thumb('search'))) support.channel_config(item, itemlist) return itemlist return locals() @@ -35,7 +35,8 @@ def radio(item): for title, location, url, quality, song, type, thumbnail in data.matches: title = scrapertools.decodeHtmlentities(title) itemlist.append( - item.clone(title = support.typo(title, 'bold') + support.typo(quality + ' kbps','_ [] bold color kod'), + item.clone(contentTitle = title, + quality= quality, thumbnail = thumbnail, url = url, contentType = 'music', @@ -49,7 +50,7 @@ def radio(item): infoLabels={} infoLabels['duration'] = duration itemlist.append( - item.clone(title = support.typo(title, 'bold'), + item.clone(contentTitle = title, thumbnail = thumbnail, infolLbels = infoLabels, url = url, @@ -62,7 +63,7 @@ def radio(item): title = scrapertools.unescape(title) itemlist.append( item.clone(channel = item.channel, - title = support.typo(title, 'bold'), + contentTitle = title, thumbnail = item.thumbnail, url = url, action = 'radio')) @@ -76,10 +77,11 @@ def findvideos(item): item.action = 'play' urls = support.match(item.url).data.strip().split() for url in urls: + item.title = 'TuneIn' item.url= url item.server = 'directo' itemlist.append(item) - return itemlist + return support.server(item, itemlist=itemlist) def search(item, text): diff --git a/channels/vvvvid.py b/channels/vvvvid.py index 1faadea4..5c3b9659 100644 --- a/channels/vvvvid.py +++ b/channels/vvvvid.py @@ -100,12 +100,16 @@ def newest(categoria): def peliculas(item): + itemlist = [] # support.dbg() if not item.args: json_file =loadjs(item.url + 'channel/10005/last/') support.logger.debug(json_file) make_itemlist(itemlist, item, json_file) + itemlist = support.pagination(itemlist, item, item.page if item.page else 1, 20) + if item.contentType != 'movie': autorenumber.start(itemlist) + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) elif ('=' not in item.args) and ('=' not in item.url): json_file=loadjs(item.url + item.args) @@ -123,15 +127,14 @@ def peliculas(item): action = 'peliculas', args = 'filters')) - else : + else: json_file=loadjs(item.url) item.args='' make_itemlist(itemlist, item, json_file) + if 'category' in item.args: support.thumb(itemlist,mode='genre') - elif not 'filter' in item.args: - if item.contentType != 'movie': autorenumber.start(itemlist) - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + return itemlist @@ -214,6 +217,7 @@ def findvideos(item): def make_itemlist(itemlist, item, data): search = item.search if item.search else '' infoLabels = {} + for key in data['data']: if search.lower() in encode(key['title']).lower(): title = encode(key['title']) diff --git a/core/support.py b/core/support.py index 1ac5eb03..fe2269c9 100755 --- a/core/support.py +++ b/core/support.py @@ -232,7 +232,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t matches = scrapertools.find_multiple_matches_groups(block, patron) logger.debug('MATCHES =', matches) - known_keys = ['url', 'title', 'title2', 'season', 'episode', 'episode2', 'thumb', 'quality', 'year', 'plot', 'duration', 'genere', 'rating', 'type', 'lang', 'other', 'size', 'seed'] + known_keys = ['url', 'title', 'title2', 'season', 'episode', 'episode2', 'thumb', 'quality', 'year', 'plot', 'duration', 'genere', 'rating', 'type', 'lang', 'size', 'seed'] # Legenda known_keys per i groups nei patron # known_keys = ['url', 'title', 'title2', 'season', 'episode', 'thumb', 'quality', # 'year', 'plot', 'duration', 'genere', 'rating', 'type', 'lang'] @@ -440,7 +440,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t contentSeason= infolabels.get('season', ''), contentEpisodeNumber=infolabels.get('episode', ''), news = item.news if item.news else '', - other = scraped['other'] if scraped['other'] else '', + # other = scraped['other'] if scraped['other'] else '', grouped = group, title2 = cleantitle(title2) if title2 else '', episode2 = second_episode, @@ -502,6 +502,7 @@ def scrape(func): else: headers = '' patronNext = args.get('patronNext', '') + patronTotalPages = args.get('patronTotalPages', '') patronBlock = args.get('patronBlock', '') typeActionDict = args.get('typeActionDict', {}) typeContentDict = args.get('typeContentDict', {}) @@ -581,7 +582,7 @@ def scrape(func): @scrape def newFunc(): return nextArgs - nextArgs['item'] = nextPage(itemlist, item, data, patronNext, function) + nextArgs['item'] = nextPage(itemlist, item, data, patronNext, function, patron_total_pages=patronTotalPages) nextArgs['group'] = False if nextArgs['item']: nextArgs['groupExplode'] = True @@ -603,7 +604,7 @@ def scrape(func): if not group and not args.get('groupExplode') and ((pagination and len(matches) <= pag * pagination) or not pagination): # next page with pagination if patronNext and inspect.stack()[1][3] not in ['newest'] and len(inspect.stack()) > 2 and inspect.stack()[2][3] not in ['get_channel_results']: - nextPage(itemlist, item, data, patronNext, function) + nextPage(itemlist, item, data, patronNext, function, patron_total_pages=patronTotalPages) # next page for pagination @@ -851,7 +852,7 @@ def menu(func): contentType= var[3] if len(var) > 3 else 'movie',) if single_search: - menuItem(itemlist, filename, config.get_localized_string(70741) % '… {bold}', 'search', host + dictUrl['search'], style=not global_search) + menuItem(itemlist, filename, config.get_localized_string(70741).replace(' %s', '… {bold}'), 'search', host + dictUrl['search'], style=not global_search) if not global_search: channel_config(item, itemlist) @@ -919,6 +920,9 @@ def typo(string, typography=''): if 'italic' in typography: string = '[I]' + string + '[/I]' typography = typography.replace('italic', '') + if '__' in typography: + string = string + ' ' + typography = typography.replace('__', '') if '_' in typography: string = ' ' + string typography = typography.replace('_', '') @@ -1180,10 +1184,12 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''): return itemlist -def nextPage(itemlist, item, data='', patron='', function_or_level=1, next_page='', resub=[]): +def nextPage(itemlist, item, data='', patron='', function_or_level=1, next_page='', resub=[], patron_total_pages='', total_pages=0): # Function_level is useful if the function is called by another function. # If the call is direct, leave it blank logger.debug() + page=None + # page = item.page if item.page else 2 action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level if not data and not patron and not next_page: @@ -1197,6 +1203,11 @@ def nextPage(itemlist, item, data='', patron='', function_or_level=1, next_page= if next_page == '': next_page = scrapertools.find_single_match(data, patron) + if patron_total_pages: + found = scrapertools.find_single_match(data, patron_total_pages).replace('.','').replace(',','') + if found.isdigit(): + total_pages = int(found) + if next_page != "": if resub: next_page = re.sub(resub[0], resub[1], next_page) if 'http' not in next_page: @@ -1211,22 +1222,29 @@ def nextPage(itemlist, item, data='', patron='', function_or_level=1, next_page= title=typo(config.get_localized_string(30992), 'color kod bold'), url=next_page, nextPage=True, + total_pages=total_pages, + page = page, thumbnail=thumb())) return itemlist[-1] def pagination(itemlist, item, page, perpage, function_level=1): + itlist = [] + for i, it in enumerate(itemlist): + if perpage and (page - 1) * perpage > i: continue # pagination + if perpage and i >= page * perpage: break # pagination + itlist.append(it) if len(itemlist) >= page * perpage: - itemlist.append( - Item(channel=item.channel, - action=inspect.stack()[function_level][3], - contentType=item.contentType, - title=typo(config.get_localized_string(30992), 'color kod bold'), - url=item.url, - args=item.args, - page=page + 1, - thumbnail=thumb())) - return itemlist + itlist.append( + item.clone(channel=item.channel, + action=inspect.stack()[function_level][3], + contentType=item.contentType, + title=typo(config.get_localized_string(30992), 'color kod bold'), + page=page + 1, + total_pages=round(len(itemlist)/perpage), + nextPage=True, + thumbnail=thumb())) + return itlist def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=True, Download=True, patronTag=None, Videolibrary=True): diff --git a/core/tmdb.py b/core/tmdb.py index 4d7c466c..f47a833b 100644 --- a/core/tmdb.py +++ b/core/tmdb.py @@ -408,12 +408,11 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang): if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False): # If the search has been successful and you are not looking for a list of items, # carry out another search to expand the information + if search_type == 'multi': + search_type = 'movie' if otmdb.result.get('media_type') else 'tv' otmdb = Tmdb(id_Tmdb=otmdb.result.get("id"), search_type=search_type, search_language=search_language) - if otmdb and config.get_setting('tmdb_plus_info'): - info = otmdb.get_infoLabels(item.infoLabels) - otmdb = Tmdb(id_Tmdb=info['tmdb_id'], search_type=search_type, - search_language=search_language) + if otmdb is not None and otmdb.get_id(): # The search has found a valid result @@ -437,8 +436,11 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang): ret = search(otmdb_global, search_type) if not ret: # try with unified title + backup = [item.fulltitle, item.infoLabels['tvshowtitle'], item.infoLabels['title']] if unify(): ret = search(otmdb_global, search_type) + if not ret: + item.fulltitle, item.infoLabels['tvshowtitle'], item.infoLabels['title'] = backup return ret # Search in tmdb is deactivated or has not given result # item.contentType = item.infoLabels['mediatype'] @@ -607,6 +609,7 @@ def discovery(item, dict_=False, cast=False): if dict_: if item.page: + item.discovery={} item.discovery['page'] = item.page listado = Tmdb(discover = dict_, cast=cast) diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 675f0d6b..21337183 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -149,15 +149,23 @@ def run(item=None): else: platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)])) elif item.action == "gotopage": - page = platformtools.dialog_numeric(0, config.get_localized_string(70513)) - if page: + from core import scrapertools + head = config.get_localized_string(70511) + scraped_page = scrapertools.find_single_match(item.url,'[=/]([0-9]+)') + if item.total_pages and (item.page or scraped_page.isdigit()): + pages = [str(p) for p in range(1, item.total_pages + 1)] + page = item.page if item.page else int(scraped_page) + page = platformtools.dialog_select(head, pages, page - 2) + 1 + else: + page = platformtools.dialog_numeric(0, head) + if page and int(page) > -1: import xbmc item.action = item.real_action if item.page: item.page = page else: import re - item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>' + page + '\g<2>', item.url) + item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url) xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl())) else: # Checks if channel exists diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 29b7d809..b6a373fb 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -346,9 +346,9 @@ def render_items(itemlist, parent_item): itemlist.append(Item(title=config.get_localized_string(60347), thumbnail=thumb('nofolder'))) dirItems = [] - # for n, item in enumerate(itemlist): + def set_item(n, item, parent_item): - item.itemlistPosition = n + 1 + item.itemlistPosition = n item_url = item.tourl() if item.category == "": @@ -379,15 +379,16 @@ def render_items(itemlist, parent_item): if episode: title = '{}. {}'.format(episode, title) if item.title2: title = '{} - {}'.format(title, item.title2) - if config.get_setting('format_title'): - server = typo(item.serverName, '_ []') if item.server else '' + if config.get_setting('format_title') or item.server: + server = typo(item.serverName, '__ [] bold') if item.server else '' quality = typo(item.quality, '_ [] color kod') if item.quality else '' lang = typo(item.contentLanguage, '_ [] color kod') if item.contentLanguage else '' extra = typo(item.extraInfo, '_ [] color kod') if item.extraInfo else '' size = typo(item.size, '_ [] color kod') if item.size else '' seed = typo('Seed: ' + item.seed, '_ [] color kod') if item.seed else '' - title = '{}{}{}{}{}{}{}'.format(title, server, quality, lang, extra, size, seed) + title = '{}{}{}{}{}{}{}'.format(server, title, quality, lang, extra, size, seed) + listitem = xbmcgui.ListItem(title) art = {'icon': icon_image, 'thumb': item.thumbnail, 'poster': item.thumbnail, 'fanart': item.fanart if item.fanart else default_fanart} @@ -426,6 +427,7 @@ def render_items(itemlist, parent_item): # r_list = [set_item(i, item, parent_item) for i, item in enumerate(itemlist)] r_list = [] + position = 0 with futures.ThreadPoolExecutor() as executor: searchList = [executor.submit(set_item, i, item, parent_item) for i, item in enumerate(itemlist)] @@ -434,9 +436,10 @@ def render_items(itemlist, parent_item): r_list.sort(key=lambda it: it[0].itemlistPosition) + for item, item_url, listitem in r_list: - # item, item_url, listitem = v - # if item.infoLabels.get('playcount', 0): pos = n + 2 + if not position and not item.infoLabels.get('playcount', 0): + position = item.itemlistPosition dirItems.append(('%s?%s' % (sys.argv[0], item_url), listitem, item.folder, len(r_list))) xbmcplugin.addDirectoryItems(_handle, dirItems) @@ -464,12 +467,15 @@ def render_items(itemlist, parent_item): logger.debug('END render_items') if parent_item.channel == 'videolibrary' and parent_item.action in ['get_episodes', 'get_season']: - _id = xbmcgui.getCurrentWindowId() - win = xbmcgui.Window(_id) + + while xbmcgui.getCurrentWindowDialogId() == 10138: + logger.debug('WINDOW ID', xbmcgui.getCurrentWindowDialogId()) + xbmc.sleep(100) + xbmc.sleep(100) + win = xbmcgui.Window(10025) cid = win.getFocusId() ctl = win.getControl(cid) - xbmc.sleep(50) - pos = int(xbmc.getInfoLabel('Container.TotalWatched')) + (1 if xbmc.getInfoLabel('Container(10138).HasParent') else 0) + pos = position + (1 if xbmc.getInfoLabel('Container(10138).HasParent') else 0) ctl.selectItem(pos) @@ -486,8 +492,8 @@ def viewmodeMonitor(): logger.debug('viewmode changed: ' + currentModeName + '-' + str(currentMode) + ' - content: ' + content) config.set_setting('view_mode_%s' % content, currentModeName + ', ' + str(currentMode)) dialog_notification(config.get_localized_string(70153), - config.get_localized_string(70187) % (content, currentModeName), - sound=False) + config.get_localized_string(70187) % (content, currentModeName), + sound=False) except: import traceback logger.error(traceback.print_exc()) @@ -659,6 +665,8 @@ def set_context_commands(item, item_url, parent_item, **kwargs): return context_commands # Options according to criteria, only if the item is not a tag, nor is it "Add to the video library", etc... if item.action and item.action not in ["add_movie_to_library", "add_serie_to_library", "buscartrailer", "actualizar_titulos"]: + if item.nextPage: + context_commands.append((config.get_localized_string(70511), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=gotopage&real_action='+item.action))) # Show information: if the item has a plot, we assume that it is a series, season, chapter or movie # if item.infoLabels['plot'] and (num_version_xbmc < 17.0 or item.contentType == 'season'): # context_commands.append((config.get_localized_string(60348), "Action(Info)")) @@ -734,8 +742,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs): if (item.contentTitle and item.contentType in ['movie', 'tvshow']) or "buscar_trailer" in context: context_commands.append((config.get_localized_string(60359), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({ 'channel': "trailertools", 'action': "buscartrailer", 'search_title': item.contentTitle if item.contentTitle else item.fulltitle, 'contextual': True})))) - if item.nextPage: - context_commands.append((config.get_localized_string(70511), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=gotopage&real_action='+item.action))) + if config.dev_mode(): context_commands.insert(0, ("item info", "Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo", parent=item.tojson()).tourl()))) return context_commands diff --git a/platformcode/shortcuts.py b/platformcode/shortcuts.py index 13e0f8db..5ceececf 100644 --- a/platformcode/shortcuts.py +++ b/platformcode/shortcuts.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -from platformcode import logger - +from platformcode import logger, platformtools def context(): from platformcode import config @@ -150,4 +149,4 @@ def select(item): ID = config.get_setting(item.id) if config.get_setting(item.id) else 0 select = platformtools.dialog_select(label, values, ID) - config.set_setting(item.id, values[select]) \ No newline at end of file + config.set_setting(item.id, values[select]) diff --git a/resources/skins/Default/720p/GlobalSearch.xml b/resources/skins/Default/720p/GlobalSearch.xml index ce2ef412..1ddc70b1 100644 --- a/resources/skins/Default/720p/GlobalSearch.xml +++ b/resources/skins/Default/720p/GlobalSearch.xml @@ -37,7 +37,7 @@ <width>100%</width> <height>100%</height> <aspectratio>scale</aspectratio> - <texture colordiffuse="FF555555">$INFO[Container(102).ListItem.Property(fanart)]</texture> + <texture colordiffuse="FF555555">$INFO[Container(102).ListItem.Art(fanart)]</texture> </control> @@ -63,47 +63,194 @@ <description>Search Result Group</description> <visible>Integer.IsGreater(Container(102).NumItems, 0)</visible> <animation effect="fade" time="200">Visible</animation> - - <control type="textbox"> - <description>Item Title</description> + <control type='group'> <left>400</left> <top>90</top> - <width>840</width> - <height>60</height> - <font>font13</font> - <textcolor>FFFFFFFF</textcolor> - <shadowcolor>00000000</shadowcolor> - <label>$INFO[Container(102).ListItem.Label][B][COLOR FFAAAAAA]$INFO[Container(102).ListItem.Property(year)]$INFO[Container(102).ListItem.Property(rating)][CR]$INFO[Container(102).ListItem.Property(channel)][/COLOR][/B]</label> - <align>left</align> - <aligny>center</aligny> - </control> + <control type='group'> + <visible>!String.IsEmpty(Container(102).ListItem.Property(rating))</visible> + <control type='image'> + <description>Rating Circle</description> + <top>0</top> + <left>0</left> + <width>60</width> + <height>60</height> + <texture colordiffuse='$INFO[Container(102).ListItem.Property(color)]'>Circular/$INFO[Container(102).ListItem.Property(rating)].png</texture> + <aspectratio>keep</aspectratio> + </control> + <control type='textbox'> + <description>Rating</description> + <visible>!String.IsEmpty(Container(102).ListItem.Rating())</visible> + <top>15</top> + <left>10</left> + <height>30</height> + <width>40</width> + <font>font13</font> + <textcolor>FFFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>$INFO[Container(102).ListItem.Rating()]</label> + <align>center</align> + <aligny>center</aligny> + </control> + <control type='textbox'> + <description>NO Rating</description> + <visible>String.IsEmpty(Container(102).ListItem.Rating())</visible> + <top>15</top> + <left>10</left> + <height>30</height> + <width>40</width> + <font>font13</font> + <textcolor>FFFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>N/A</label> + <align>center</align> + <aligny>center</aligny> + </control> + <control type="textbox"> + <description>Item Title</description> + <left>80</left> + <top>0</top> + <width>840</width> + <height>60</height> + <font>font13</font> + <textcolor>FFFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>$INFO[Container(102).ListItem.Label]</label> + <align>left</align> + <aligny>center</aligny> + </control> + </control> - <control type="textbox"> - <description>Item Title</description> - <left>1040</left> - <top>91</top> - <width>200</width> - <height>30</height> - <font>font13</font> - <textcolor>FFFFFFFF</textcolor> - <shadowcolor>00000000</shadowcolor> - <label>[B][COLOR FFAAAAAA]$INFO[Container(102).CurrentItem]/$INFO[Container(102).NumItems][/COLOR][/B]</label> - <align>right</align> - <aligny>center</aligny> - </control> + <control type="textbox"> + <visible>String.IsEmpty(Container(102).ListItem.Property(rating))</visible> + <description>Item Title</description> + <left>0</left> + <top>0</top> + <width>840</width> + <height>60</height> + <font>font13</font> + <textcolor>FFFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>$INFO[Container(102).ListItem.Label]</label> + <align>left</align> + <aligny>center</aligny> + </control> - <control type="textbox"> - <description>Item Plot</description> - <left>400</left> - <top>170</top> - <width>840</width> - <height>170</height> - <font>font13</font> - <textcolor>FFFFFFFF</textcolor> - <shadowcolor>00000000</shadowcolor> - <label>$INFO[Container(102).ListItem.Property(plot)]</label> - <autoscroll time="3000" delay="3000" repeat="3000">True</autoscroll> - <align>left</align> + <control type="textbox"> + <description>Item Count</description> + <left>640</left> + <top>1</top> + <width>200</width> + <height>30</height> + <font>font13</font> + <textcolor>FFAAAAAA</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>[B]$INFO[Container(102).CurrentItem]/$INFO[Container(102).NumItems][/B]</label> + <align>right</align> + <aligny>center</aligny> + </control> + + + <!-- Video Info --> + <control type='group'> + <description>Video Info</description> + <visible>Integer.IsGreater(Container(102).NumItems, 0)</visible> + <top>80</top> + <height>120</height> + <width>840</width> + <control type='grouplist'> + <top>0</top> + <height>30</height> + <width>300</width> + <itemgap>10</itemgap> + <orientation>horizontal</orientation> + <align>left</align> + <control type='textbox'> + <description>Year</description> + <height>30</height> + <width>45</width> + <font>font13</font> + <textcolor>ffFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>$INFO[Container(102).ListItem.Year]</label> + <align>left</align> + <aligny>center</aligny> + </control> + <control type='textbox'> + <description>Separator</description> + <height>30</height> + <width>10</width> + <font>font13</font> + <textcolor>ffFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <visible>!String.IsEmpty(Container(102).ListItem.Duration())</visible> + <label>[B]•[/B]</label> + <align>center</align> + <aligny>center</aligny> + </control> + <control type='textbox'> + <description>Duration</description> + <height>30</height> + <width>50</width> + <font>font13</font> + <textcolor>ffFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>$INFO[Container(102).ListItem.Duration(hh:mm)]</label> + <align>left</align> + <aligny>center</aligny> + </control> + <control type='textbox'> + <description>Separator</description> + <height>30</height> + <width>10</width> + <font>font13</font> + <textcolor>ffFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <visible>!String.IsEmpty(Container(102).ListItem.Mpaa)</visible> + <label>[B]•[/B]</label> + <align>center</align> + <aligny>center</aligny> + </control> + <control type='textbox'> + <description>Mpaa</description> + <height>30</height> + <width>60</width> + <font>font13</font> + <textcolor>ffFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>$INFO[Container(102).ListItem.Mpaa]</label> + <align>left</align> + <aligny>center</aligny> + </control> + </control> + + <control type='textbox'> + <description>Genre</description> + <visible>!String.isEmpty(Container(102).ListItem.Genre</visible> + <right>0</right> + <height>30</height> + <width>600</width> + <font>font13</font> + <textcolor>ffFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>[B]$ADDON[plugin.video.kod 70499][/B] $INFO[Container(102).ListItem.Genre]</label> + <align>right</align> + <aligny>center</aligny> + </control> + + <control type='textbox'> + <description>Plot</description> + <top>40</top> + <left>0</left> + <height>150</height> + <font>font13</font> + <textcolor>ffFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>$INFO[Container(102).ListItem.Plot]</label> + <align>justify</align> + <aligny>top</aligny> + <autoscroll time='3000' delay='3000' repeat='3000'>True</autoscroll> + </control> + </control> </control> <control type="fixedlist" id="102"> @@ -126,7 +273,7 @@ <left>0</left> <width>180</width> <height>270</height> - <texture colordiffuse="FF999999">$INFO[ListItem.Property(thumb)]</texture> + <texture colordiffuse="FF999999">$INFO[ListItem.Art(poster)]</texture> <visible>!Control.HasFocus(102)</visible> <bordersize>10</bordersize> <aspectratio>scale</aspectratio> @@ -137,7 +284,7 @@ <left>0</left> <width>180</width> <height>270</height> - <texture>$INFO[ListItem.Property(thumb)]</texture> + <texture>$INFO[ListItem.Art(poster)]</texture> <visible>Control.HasFocus(102)</visible> <bordersize>10</bordersize> <aspectratio>scale</aspectratio> @@ -178,7 +325,7 @@ <left>0</left> <width>380</width> <height>570</height> - <texture colordiffuse="FF999999">$INFO[ListItem.Property(thumb)]</texture> + <texture colordiffuse="FF999999">$INFO[ListItem.Art(poster)]</texture> <visible>!Control.HasFocus(102)</visible> <bordersize>10</bordersize> <aspectratio>scale</aspectratio> @@ -189,7 +336,7 @@ <left>0</left> <width>380</width> <height>570</height> - <texture>$INFO[ListItem.Property(thumb)]</texture> + <texture>$INFO[ListItem.Art(poster)]</texture> <visible>Control.HasFocus(102)</visible> <bordersize>10</bordersize> <aspectratio>scale</aspectratio> @@ -238,31 +385,45 @@ <control type="group"> <!-- Chennels Group--> <description>Chennels Group</description> - <bottom>-100</bottom> + <bottom>-160</bottom> <width>100%</width> - <height>150</height> + <height>200</height> <animation effect="slide" start="0,150" time="500" condition="Integer.IsGreater(Container(101).NumItems, 0)">Conditional</animation> - <animation effect="slide" start="0,-100" time="200" condition="!Control.HasFocus(101)">Conditional</animation> + <animation effect="slide" start="0,-160" time="200" condition="!Control.HasFocus(101)">Conditional</animation> <visible>Integer.IsGreater(Container(101).NumItems, 0)</visible> + <control type="button" id='506'> + <description>Chennels Bar Tab</description> + <top>0</top> + <left>575</left> + <width>130</width> + <height>30</height> + <texturefocus colordiffuse="FF232323">tab.png</texturefocus> + <texturenofocus colordiffuse="FF232323">tab.png</texturenofocus> + </control> <control type="image"> - <description>Chennels Bar Background Opacity on hover</description> - <width>100%</width> - <height>100%</height> - <animation effect="fade" start='100' end='0' time="200" condition="!Control.HasFocus(101)">Conditional</animation> - <texture colordiffuse="FF232323">white.png</texture> + <description>Chennels Bar Arrow</description> + <top>8</top> + <left>633</left> + <width>14</width> + <height>14</height> + <texture colordiffuse="FFFFFFFF">dd.png</texture> + <aspectratio align='center' aligny='center'>keep</aspectratio> + <animation effect="rotate" center= 'auto' end="180" time="200" condition="Control.HasFocus(101)">Conditional</animation> </control> <control type="image"> <description>Chennels Bar Background</description> + <top>30</top> <width>100%</width> - <height>100%</height> - <texture colordiffuse="88232323">white.png</texture> + <height>180</height> + <texture colordiffuse="FF232323">white.png</texture> </control> <control type="list" id="101"> <description>Channels list</description> <width>100%</width> + <top>40</top> <height>150</height> <onup>102</onup> <orientation>horizontal</orientation> @@ -275,7 +436,8 @@ <left>0</left> <width>150</width> <height>150</height> - <texture colordiffuse="55FFFFFF">$INFO[ListItem.Property(thumb)]</texture> + <texture>$INFO[ListItem.Property(thumb)]</texture> + <bordersize>2</bordersize> <aspectratio>scale</aspectratio> </control> <control type="image"> @@ -284,7 +446,7 @@ <left>110</left> <width>40</width> <height>40</height> - <texture colordiffuse="20232323">white.png</texture> + <texture colordiffuse="FF232323">white.png</texture> <aspectratio>scale</aspectratio> </control> <control type="textbox"> @@ -309,6 +471,8 @@ <width>150</width> <height>150</height> <texture>$INFO[ListItem.Property(thumb)]</texture> + <bordersize>2</bordersize> + <bordertexture colordiffuse='FF0082C2'>white.png</bordertexture> <aspectratio>scale</aspectratio> </control> <control type="image"> @@ -317,7 +481,7 @@ <left>110</left> <width>40</width> <height>40</height> - <texture colordiffuse="880082C2">white.png</texture> + <texture colordiffuse="FF0082C2">white.png</texture> <aspectratio>scale</aspectratio> </control> <control type="textbox"> @@ -339,7 +503,6 @@ </control> <!-- END SEARCH GROUP--> - <control type="group"> <!-- EPISODES GROUP--> <description>Episodes Group</description> <visible>Control.IsVisible(2)</visible> @@ -619,18 +782,18 @@ <animation effect="slide" tween="linear" center="auto" end="0,-890" time="600" condition="Integer.IsGreater(Container(102).NumItems, 0)">Conditional</animation> </control> - <control type="textbox" id="501"> + <control type="label" id="501"> <description>Progress Count</description> - <top>340</top> - <left>950</left> - <width>200</width> - <height>40</height> + <top>270</top> + <left>450</left> + <width>180</width> + <height>30</height> <font>font13</font> <textcolor>FFFFFFFF</textcolor> <shadowcolor>00000000</shadowcolor> <align>right</align> <aligny>center</aligny> - <animation effect="slide" tween="linear" center="auto" end="-40,-311" time="200" condition="Integer.IsGreater(Container(101).NumItems, 0)">Conditional</animation> + <animation effect="slide" tween="linear" center="0" end="-450,-240" time="600" condition="Integer.IsGreater(Container(102).NumItems, 0)">Conditional</animation> <visible>Control.IsVisible(500)</visible> </control> diff --git a/resources/skins/Default/720p/InfoPlus.xml b/resources/skins/Default/720p/InfoPlus.xml index 37b197a4..2f7d4536 100644 --- a/resources/skins/Default/720p/InfoPlus.xml +++ b/resources/skins/Default/720p/InfoPlus.xml @@ -59,7 +59,7 @@ <width>60</width> <height>60</height> <texture colordiffuse='$INFO[Container(100).ListItem.Property(color)]'>Circular/$INFO[Container(100).ListItem.Property(rating)].png</texture> - <aspectratio>scale</aspectratio> + <aspectratio aligny='center'>keep</aspectratio> </control> <control type='textbox'> <description>Rating</description> @@ -145,7 +145,7 @@ <aligny>center</aligny> </control> <control type='textbox'> - <description>Year</description> + <description>Duration</description> <height>30</height> <width>50</width> <font>font13</font> @@ -168,7 +168,7 @@ <aligny>center</aligny> </control> <control type='textbox'> - <description>Year</description> + <description>Mpaa</description> <height>30</height> <width>60</width> <font>font13</font> @@ -179,6 +179,18 @@ <aligny>center</aligny> </control> </control> + <control type='textbox'> + <description>Genre</description> + <right>0</right> + <height>30</height> + <width>400</width> + <font>font13</font> + <textcolor>ffFFFFFF</textcolor> + <shadowcolor>00000000</shadowcolor> + <label>$INFO[Container(100).ListItem.Genre]</label> + <align>right</align> + <aligny>center</aligny> + </control> <control type='textbox'> <description>Plot</description> <top>50</top> @@ -188,7 +200,7 @@ <textcolor>ffFFFFFF</textcolor> <shadowcolor>00000000</shadowcolor> <label>$INFO[Container(100).ListItem.Plot]</label> - <align>left</align> + <align>justify</align> <aligny>top</aligny> <autoscroll time='3000' delay='3000' repeat='3000'>True</autoscroll> </control> @@ -376,6 +388,7 @@ <top>20</top> <left>40</left> <height>30</height> + <width>450</width> <font>font13</font> <textcolor>ffFFFFFF</textcolor> <shadowcolor>00000000</shadowcolor> @@ -383,13 +396,14 @@ <align>left</align> <aligny>center</aligny> </control> - <control type='textbox'> + <control type='label'> <description>Name</description> <top>20</top> <right>50</right> <width>40</width> <height>30</height> <font>font13</font> + <scroll>true</scroll> <textcolor>ffFFFFFF</textcolor> <shadowcolor>00000000</shadowcolor> <label>[B]$INFO[Container(102).ListItem.Rating][/B]</label> @@ -403,7 +417,7 @@ <width>30</width> <height>30</height> <texture colordiffuse='$INFO[Container(102).ListItem.Property(color)]'>Circular/$INFO[Container(102).ListItem.Property(rating)].png</texture> - <aspectratio>scale</aspectratio> + <aspectratio aligny='center'>keep</aspectratio> </control> <control type='textbox'> <description>Plot</description> diff --git a/resources/skins/Default/media/Infoplus/add_to_videolibrary.png b/resources/skins/Default/media/Infoplus/add_to_videolibrary.png deleted file mode 100644 index 086e7d76..00000000 Binary files a/resources/skins/Default/media/Infoplus/add_to_videolibrary.png and /dev/null differ diff --git a/resources/skins/Default/media/Infoplus/downloads.png b/resources/skins/Default/media/Infoplus/downloads.png deleted file mode 100644 index 7239122a..00000000 Binary files a/resources/skins/Default/media/Infoplus/downloads.png and /dev/null differ diff --git a/resources/skins/Default/media/Infoplus/fanart.png b/resources/skins/Default/media/Infoplus/fanart.png deleted file mode 100644 index 790d1c28..00000000 Binary files a/resources/skins/Default/media/Infoplus/fanart.png and /dev/null differ diff --git a/resources/skins/Default/media/Infoplus/loading.png b/resources/skins/Default/media/Infoplus/loading.png deleted file mode 100644 index 909d4216..00000000 Binary files a/resources/skins/Default/media/Infoplus/loading.png and /dev/null differ diff --git a/resources/skins/Default/media/Infoplus/movie.png b/resources/skins/Default/media/Infoplus/movie.png index 7a5d7764..869e1ab0 100644 Binary files a/resources/skins/Default/media/Infoplus/movie.png and b/resources/skins/Default/media/Infoplus/movie.png differ diff --git a/resources/skins/Default/media/Infoplus/no_photo.png b/resources/skins/Default/media/Infoplus/no_photo.png index f1f6de48..265edf21 100644 Binary files a/resources/skins/Default/media/Infoplus/no_photo.png and b/resources/skins/Default/media/Infoplus/no_photo.png differ diff --git a/resources/skins/Default/media/Infoplus/search.png b/resources/skins/Default/media/Infoplus/search.png deleted file mode 100644 index 35be825c..00000000 Binary files a/resources/skins/Default/media/Infoplus/search.png and /dev/null differ diff --git a/resources/skins/Default/media/Infoplus/tmdb.png b/resources/skins/Default/media/Infoplus/tmdb.png deleted file mode 100644 index b81bb3c1..00000000 Binary files a/resources/skins/Default/media/Infoplus/tmdb.png and /dev/null differ diff --git a/resources/skins/Default/media/Infoplus/trailer.png b/resources/skins/Default/media/Infoplus/trailer.png deleted file mode 100644 index ad22ea11..00000000 Binary files a/resources/skins/Default/media/Infoplus/trailer.png and /dev/null differ diff --git a/resources/skins/Default/media/Infoplus/tv.png b/resources/skins/Default/media/Infoplus/tv.png index cac2bb6b..b4e3611b 100644 Binary files a/resources/skins/Default/media/Infoplus/tv.png and b/resources/skins/Default/media/Infoplus/tv.png differ diff --git a/resources/skins/Default/media/Infoplus/tvdb.png b/resources/skins/Default/media/Infoplus/tvdb.png deleted file mode 100644 index b6893e64..00000000 Binary files a/resources/skins/Default/media/Infoplus/tvdb.png and /dev/null differ diff --git a/resources/skins/Default/media/tab.png b/resources/skins/Default/media/tab.png new file mode 100644 index 00000000..6c1c39b8 Binary files /dev/null and b/resources/skins/Default/media/tab.png differ diff --git a/servers/userload.json b/servers/userload.json index 7c00595d..95b143a1 100644 --- a/servers/userload.json +++ b/servers/userload.json @@ -4,7 +4,7 @@ "ignore_urls": [], "patterns": [ { - "pattern": "userload.co/embed/([a-z0-9]+)", + "pattern": "userload.co/(?:embed|f)/([a-z0-9]+)", "url": "https://userload.co/e/\\1" } ] diff --git a/specials/globalsearch.py b/specials/globalsearch.py index cda07a34..8232e770 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import threading -from core import support +from core import jsontools, support import xbmc, xbmcgui, sys, channelselector, time, os from core.support import dbg, tmdb @@ -67,6 +67,7 @@ MENU = 502 BACK = 503 CLOSE = 504 QUALITYTAG = 505 +TAB = 506 # Servers EPISODESLIST = 200 @@ -165,7 +166,8 @@ class SearchWindow(xbmcgui.WindowXML): tmdb_info = tmdb.Tmdb(searched_text=self.item.text, search_type=self.item.mode.replace('show', '')) results = tmdb_info.results - for result in results: + + def make(n, result): result = tmdb_info.get_infoLabels(result, origen=result) if self.item.mode == 'movie': title = result['title'] @@ -177,17 +179,12 @@ class SearchWindow(xbmcgui.WindowXML): title = result.get('title', '') result['mode'] = result['media_type'].replace('tv', 'tvshow') - thumbnail = result.get('thumbnail', '') noThumb = 'Infoplus/' + result['mode'].replace('show','') + '.png' - fanart = result.get('fanart', '') - year = result.get('release_date', '') - rating = str(result.get('vote_average', '')) + rating = result.get('vote_average', 0) new_item = Item(channel='globalsearch', action=True, title=title, - thumbnail=thumbnail, - fanart=fanart, mode='search', type=result['mode'], contentType=result['mode'], @@ -198,12 +195,26 @@ class SearchWindow(xbmcgui.WindowXML): new_item.contentTitle = result['title'] else: new_item.contentSerieName = result['name'] + tmdb.set_infoLabels(new_item) + tagline = new_item.infoLabels.get('tagline') + it = xbmcgui.ListItem('[B]{}[/B]'.format(title) + ('\n[I]{}[/I]'.format(tagline if tagline else ''))) + it.setArt({'poster':result.get('thumbnail', noThumb), 'fanart':result.get('fanart', '')}) - it = xbmcgui.ListItem(title) - it.setProperties({'thumb': result.get('thumbnail', noThumb), 'fanart': result.get('fanart', ''), 'rating': ' [' + rating + ']' if rating else '', - 'plot': result.get('overview', ''), 'search': 'search', 'release_date': '', 'item': new_item.tourl(), - 'year': ' [' + year.split('/')[-1] + ']' if year else ' [' + result.get('first_air_date','').split('-')[0] + ']'}) - self.items.append(it) + platformtools.set_infolabels(it, new_item) + # logger.debug(jsontools.dump(result)) + # logger.debug(new_item) + + color = 'FFFFFFFF' if not rating else 'FFDB2360' if rating < 4 else 'FFD2D531' if rating < 7 else 'FF21D07A' + it.setProperties({'rating': str(int(rating) * 10) if rating else 100, 'color':color, 'item': new_item.tourl(), 'search': 'search'}) + return n, it + + r_list = [] + with futures.ThreadPoolExecutor() as executor: + searchList = [executor.submit(make, n, result) for n, result in enumerate(results)] + for res in futures.as_completed(searchList): + r_list.append(res.result()) + r_list.sort(key=lambda r: r[0] ) + self.items = [r[1] for r in r_list] if self.items: self.RESULTS.reset() @@ -248,19 +259,22 @@ class SearchWindow(xbmcgui.WindowXML): action=True, title=name, thumbnail=thumb, + plot= plot, mode='search') it = xbmcgui.ListItem(name) - it.setProperties({'thumb': thumb, 'plot': plot, 'search': 'persons', 'item': new_item.tourl()}) + platformtools.set_infolabels(it, new_item) + it.setArt({'poster':thumb}) + it.setProperties({'search': 'persons', 'item': new_item.tourl()}) items.append(it) if len(results) > 19: it = xbmcgui.ListItem(config.get_localized_string(70006)) - it.setProperty('thumb', 'Infoplus/next_focus.png') + it.setArt({'poster':'Infoplus/next_focus.png'}) it.setProperty('search','next') items.append(it) if self.page > 1: it = xbmcgui.ListItem(config.get_localized_string(70005)) - it.setProperty('thumb', 'Infoplus/previous_focus.png') + it.setArt({'poster':'Infoplus/previous_focus.png'}) it.setProperty('search','previous') items.insert(0, it) @@ -308,7 +322,8 @@ class SearchWindow(xbmcgui.WindowXML): except ZeroDivisionError: percent = 0 self.PROGRESS.setPercent(percent) - self.COUNT.setText('%s/%s [%s"]' % (self.count, len(self.searchActions), int(time.time() - self.time))) + self.MAINTITLE.setText('{} | {}/{} [{}"]'.format(self.mainTitle,self.count, len(self.searchActions), int(time.time() - self.time))) + # self.COUNT.setText('%s/%s [%s"]' % (self.count, len(self.searchActions), int(time.time() - self.time))) if percent == 100: self.channels = [] self.moduleDict = {} @@ -393,13 +408,20 @@ class SearchWindow(xbmcgui.WindowXML): def makeItem(self, url): item = Item().fromurl(url) channelParams = channeltools.get_channel_parameters(item.channel) + info = item.infoLabels + tagline = info.get('tagline') + title = '[B]{}[/B]'.format(item.fulltitle) + ('\n[I]{}[/I]'.format(tagline) if tagline else '') thumb = item.thumbnail if item.thumbnail else 'Infoplus/' + item.contentType.replace('show', '') + '.png' - logger.info('THUMB', thumb) - it = xbmcgui.ListItem(item.title) - year = str(item.year if item.year else item.infoLabels.get('year', '')) - rating = str(item.infoLabels.get('rating', '')) - it.setProperties({'thumb': thumb, 'fanart': item.fanart, 'plot': item.plot, - 'year': ' [' + year + ']' if year else '', 'rating':' [' + rating + ']' if rating else '', + + it = xbmcgui.ListItem(title) + it.setArt({'poster':thumb, 'fanart':item.fanart}) + platformtools.set_infolabels(it, item) + logger.debug(item) + + rating = info.get('rating') + color = 'FFFFFFFF' if not rating else 'FFDB2360' if rating < 4 else 'FFD2D531' if rating < 7 else 'FF21D07A' + + it.setProperties({'rating': str(int(info.get('rating',10) * 10)), 'color': color, 'item': url, 'verified': item.verified, 'channel':channelParams['title'], 'channelthumb': channelParams['thumbnail'] if item.verified else ''}) if item.server: color = scrapertools.find_single_match(item.alive, r'(FF[^\]]+)') @@ -485,6 +507,7 @@ class SearchWindow(xbmcgui.WindowXML): def onInit(self): self.time = time.time() + self.mainTitle = config.get_localized_string(30993).replace('...', '') % '"%s"' % self.item.text # collect controls self.CHANNELS = self.getControl(CHANNELS) @@ -492,7 +515,7 @@ class SearchWindow(xbmcgui.WindowXML): self.PROGRESS = self.getControl(PROGRESS) self.COUNT = self.getControl(COUNT) self.MAINTITLE = self.getControl(MAINTITLE) - self.MAINTITLE.setText(config.get_localized_string(30993).replace('...', '') % '"%s"' % self.item.text) + self.MAINTITLE.setText(self.mainTitle) self.SEARCH = self.getControl(SEARCH) self.EPISODES = self.getControl(EPISODES) self.EPISODESLIST = self.getControl(EPISODESLIST) @@ -589,7 +612,7 @@ class SearchWindow(xbmcgui.WindowXML): if self.RESULTS.getSelectedItem(): search = self.RESULTS.getSelectedItem().getProperty('search') else: search = None - if control_id in [CHANNELS]: + if control_id in [CHANNELS, TAB]: items = [] name = self.CHANNELS.getSelectedItem().getLabel() subpos = int(self.CHANNELS.getSelectedItem().getProperty('position')) @@ -600,6 +623,7 @@ class SearchWindow(xbmcgui.WindowXML): self.RESULTS.addItems(items) self.RESULTS.selectItem(subpos) self.CHANNELS.getSelectedItem().setProperty('position', str(subpos)) + self.setFocusId(CHANNELS) elif control_id in [BACK]: self.Back()