Modifiche Grafiche PolpoTV

This commit is contained in:
Alhaziel
2019-10-22 11:10:04 +02:00
parent 3a0db373ed
commit d979499d5b
4 changed files with 52 additions and 49 deletions

View File

@@ -7,6 +7,7 @@
"thumbnail": "polpotv.png",
"banner": "polpotv.png",
"categories": ["movie"],
"not_active":["include_in_newest"],
"settings": []
"not_active":[],
"default_off":["include_in_newest"],
"settings": []
}

View File

@@ -1,16 +1,13 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# kod - XBMC Plugin
# KoD - XBMC Plugin
# Canale polpotv
# ------------------------------------------------------------
from platformcode import logger
from core import scrapertools, httptools, support
from core import scrapertools, httptools, support, jsontools
from core.item import Item
from platformcode import config
from core import jsontools
import json
import datetime
import json, datetime
__channel__ = "polpotv"
host = config.get_channel_url(__channel__)
@@ -25,12 +22,21 @@ def mainlist(item):
menu = [
('Ultimi Film aggiunti', ['/api/movies?order[lastReleaseAt]=desc', 'peliculas', '']),
('Generi', ['/api/genres', 'search_movie_by_genre', '']),
('Anni', ['', 'search_movie_by_year', '']),
('Anni {film}', ['', 'search_movie_by_year', '']),
('Cerca Film... bold', ['', 'search', ''])
]
return locals()
def newest(categoria):
support.log()
item = Item()
if categoria == 'peliculas':
item.contentType = 'movie'
item.url = host + '/api/movies?order[lastReleaseAt]=desc'
return peliculas(item)
def peliculas(item):
logger.info("kod.polpotv peliculas")
support.log()
itemlist = []
data = httptools.downloadpage(item.url, headers=headers).data
json_object = jsontools.load(data)
@@ -39,14 +45,15 @@ def peliculas(item):
itemlist.extend(get_itemlist_movie(movie,item))
try:
itemlist = support.nextPage(itemlist, item, next_page=json_object['hydra:view']['hydra:next'])
if support.inspect.stack()[1][3] not in ['newest']:
support.nextPage(itemlist, item, next_page=json_object['hydra:view']['hydra:next'])
except:
pass
return itemlist
def search(item, texto):
logger.info("kod.polpotv " + item.url + " search " + texto)
support.log(item.url, "search", texto)
itemlist=[]
try:
item.url = host + "/api/movies?originalTitle="+texto+"&translations.name=" +texto
@@ -55,15 +62,15 @@ def search(item, texto):
for movie in json_object['hydra:member']:
itemlist.extend(get_itemlist_movie(movie,item))
return itemlist
# Continua la ricerca in caso di errore
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
support.logger.error("%s" % line)
return []
def search_movie_by_genre(item):
logger.info("kod.polpotv search_movie_by_genre")
support.log()
itemlist = []
data = httptools.downloadpage(item.url, headers=headers).data
json_object = jsontools.load(data)
@@ -71,14 +78,14 @@ def search_movie_by_genre(item):
itemlist.append(
Item(channel=item.channel,
action="peliculas",
title="[COLOR azure]" + genre['name'] + "[/COLOR]",
title=support.typo(genre['name'],'bold'),
contentType='movie',
url="%s/api/movies?genres.id=%s" %(host,genre['id']),
extra=item.extra))
return itemlist
return support.thumb(itemlist, True)
def search_movie_by_year(item):
logger.info("kod.polpo.tv search_movie_by_year")
support.log()
now = datetime.datetime.now()
year = int(now.year)
itemlist = []
@@ -88,12 +95,12 @@ def search_movie_by_year(item):
url="%s/api/movies?releaseDate=%s" %(host,year_to_search),
plot="1",
type="movie",
title="[COLOR azure]%s[/COLOR]" % year_to_search,
title=support.typo(year_to_search,'bold'),
action="peliculas"))
return itemlist
return itemlist
def findvideos(item):
logger.info("kod.polpotv peliculas")
support.log()
itemlist = []
try:
data = httptools.downloadpage(item.url, headers=headers).data
@@ -116,7 +123,7 @@ def findvideos(item):
return support.server(item, itemlist=itemlist)
def get_itemlist_movie(movie,item):
logger.info("kod.polpotv get_itemlist_movie")
support.log()
itemlist=[]
try:
if movie['originalLanguage']['id']=='it':
@@ -144,7 +151,7 @@ def get_itemlist_movie(movie,item):
itemlist.append(
Item(channel=item.channel,
action="findvideos",
title=scrapedtitle + " " + support.typo(movie['lastQuality'].upper(), '[] color kod'),
title=support.typo(scrapedtitle,'bold') + support.typo(movie['lastQuality'].upper(), '_ [] color kod bold'),
fulltitle=scrapedtitle,
show=scrapedtitle,
plot=scrapedplot,

View File

@@ -263,20 +263,15 @@ def get_thumb(thumb_name, view="thumb_", auto=False):
thumb_name = unify.set_genre(unify.simplify(thumb_name))
if thumb_name in thumb_dict:
thumbnail = thumb_dict[thumb_name]
return thumbnail
else:
icon_pack_name = config.get_setting('icon_set', default="default")
resource_path = os.path.join(config.get_runtime_path(), "resources", "media", "themes")
media_path = os.path.join(resource_path, icon_pack_name)
media_path = os.path.join("https://raw.githubusercontent.com/kodiondemand/media/master/themes/", icon_pack_name)
if os.path.isdir(media_path) == False:
media_path = os.path.join("https://raw.githubusercontent.com/kodiondemand/media/master/themes/", icon_pack_name)
elif config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and os.path.isfile(config.get_setting('custom_theme') + view + thumb_name):
if config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and os.path.isfile(config.get_setting('custom_theme') + view + thumb_name):
media_path = config.get_setting('custom_theme')
return os.path.join(media_path, view + thumb_name)
@@ -355,39 +350,39 @@ def thumb(itemlist=[], genre=False):
icon_dict = {'channels_movie':['film'],
'channels_tvshow':['serie','tv','episodi','episodio'],
'channels_documentary':['documentari','documentario'],
'channels_documentary':['documentari','documentario', 'documentary'],
'channels_all':['tutti'],
'news':['novità', "novita'", 'aggiornamenti', 'nuovi', 'nuove'],
'now_playing':['cinema', 'in sala'],
'channels_anime':['anime'],
'genres':['genere', 'generi', 'categorie', 'categoria'],
'channels_animation': ['animazione', 'cartoni', 'cartoon'],
'channels_action':['azione', 'arti marziali'],
'channels_adventure': ['avventura'],
'channels_animation': ['animazione', 'cartoni', 'cartoon', 'animation'],
'channels_action':['azione', 'arti marziali', 'action'],
'channels_adventure': ['avventura', 'adventure'],
'channels_biographical':['biografico'],
'channels_comedy':['comico','commedia', 'demenziale'],
'channels_comedy':['comico','commedia', 'demenziale', 'comedy'],
'channels_adult':['erotico', 'hentai'],
'channels_drama':['drammatico', 'drama'],
'channels_syfy':['fantascienza'],
'channels_syfy':['fantascienza', 'science fiction'],
'channels_fantasy':['fantasy'],
'channels_crime':['gangster','poliziesco'],
'channels_crime':['gangster','poliziesco', 'crime'],
'channels_grotesque':['grottesco'],
'channels_war':['guerra'],
'channels_war':['guerra', 'war'],
'channels_children':['bambini', 'kids'],
'horror':['horror'],
'lucky': ['fortunato'],
'channels_musical':['musical', 'musica'],
'channels_mistery':['mistero', 'giallo'],
'channels_musical':['musical', 'musica', 'music'],
'channels_mistery':['mistero', 'giallo', 'mystery'],
'channels_noir':['noir'],
'popular' : ['popolari','popolare', 'più visti'],
'channels_thriller':['thriller'],
'thriller':['thriller'],
'top_rated' : ['fortunato', 'votati'],
'on_the_air' : ['corso', 'onda'],
'channels_western':['western'],
'channels_vos':['sub','sub-ita'],
'channels_romance':['romantico','sentimentale'],
'channels_family':['famiglia','famiglie'],
'channels_historical':['storico'],
'channels_romance':['romantico','sentimentale', 'romance'],
'channels_family':['famiglia','famiglie', 'family'],
'channels_historical':['storico', 'history'],
'autoplay':[config.get_localized_string(60071)]
}

View File

@@ -704,7 +704,7 @@ def typo(string, typography=''):
kod_color = '0xFF65B3DA' #'0xFF0081C2'
string = str(string)
# Check if the typographic attributes are in the string or outside
if typography:
string = string + ' ' + typography
@@ -1000,7 +1000,7 @@ def log(stringa1="", stringa2="", stringa3="", stringa4="", stringa5=""):
frame = inspect.stack()[1]
filename = frame[0].f_code.co_filename
filename = os.path.basename(filename)
logger.info("[" + filename + "] - [" + inspect.stack()[1][3] + "] " + str(stringa1) + str(stringa2) + str(stringa3) + str(stringa4) + str(stringa5))
logger.info("[" + filename + "] - [" + inspect.stack()[1][3] + "] " + str(stringa1) + ( ' ' + str(stringa2) if stringa2 else '') + ( ' ' + str(stringa3) if stringa3 else '') + ( ' ' + str(stringa4) if stringa4 else '') + ( ' ' + str(stringa5) if stringa5 else '') )
def channel_config(item, itemlist):