Fix per Kodi 18

This commit is contained in:
Alhaziel01
2022-07-13 12:25:25 +02:00
parent fb1b0ab0a8
commit 7a9a0c977a
4 changed files with 30 additions and 30 deletions

View File

@@ -24,7 +24,7 @@ def mainlist(item):
def moviefilter(item):
if logger.testMode:
return f'{host}/movie-lib-sort/all/all/score/desc/all/1/'
return host +'/movie-lib-sort/all/all/score/desc/all/1/'
from platformcode import platformtools
item.args = ''
@@ -68,14 +68,14 @@ def filtered(item, values):
order = item.orderValues[values['order']]
year = item.yearValues[values['year']]
return f'{host}/movie-lib-sort/{genre}/{lang}/{sortby}/{order}/{year}/1/'
return '{}/movie-lib-sort/{}/{}/{}/{}/{}/1/'.format(host, genre, lang, sortby, order, year)
def az(item):
import string
itemlist = [item.clone(title='1-9', url=f'{item.url}num/1/', action='peliculas', thumbnail=support.thumb('az'))]
itemlist = [item.clone(title='1-9', url=item.url +'num/1/', action='peliculas', thumbnail=support.thumb('az'))]
for letter in list(string.ascii_lowercase):
itemlist.append(item.clone(title=letter.upper(), url=f'{item.url}{letter}/1/', action='peliculas', thumbnail=support.thumb('az')))
itemlist.append(item.clone(title=letter.upper(), url=item.url + letter +'/1/', action='peliculas', thumbnail=support.thumb('az')))
return itemlist
@@ -85,7 +85,7 @@ def search(item, text):
if config.get_setting('itaSearch', channel=item.channel, default=False):
text += ' ita'
text = text.replace(' ', '+')
item.url = f'{host}/search/{text}/1/'
item.url = '{}/search/{}/1/'.format(host, text)
try:
return peliculas(item)
# Cattura la eccezione così non interrompe la ricerca globle se il canale si rompe!
@@ -122,7 +122,7 @@ def peliculas(item):
if lastUrl:
currentPage = support.match(item.url, string=True, patron=r'/(\d+)/').match
nextPage = int(currentPage) + 1
support.nextPage(itemlist, item, next_page=item.url.replace(f'/{currentPage}', f'/{nextPage}'), function_or_level='peliculas')
support.nextPage(itemlist, item, next_page=item.url.replace('/{}'.format(currentPage), '/{}'.format(nextPage)), function_or_level='peliculas')
return itemlist
return locals()
@@ -173,14 +173,14 @@ def findvideos(item):
else:
lang = vars(subs).get('alpha3').upper()
if lang:
title = f'{title} [{lang}]'
title = '{} [{}]'.format(title, lang)
sizematch = support.match(size, patron='(\d+(?:\.\d+)?)\s* (\w+)').match
sizenumber = float(sizematch[0])
if sizematch[1].lower() == 'gb':
sizenumber = sizenumber * 1024
itemlist.append(item.clone(title = f'{title} [{seed} SEEDS] [{size}]', seed=int(seed), size=sizenumber, url=host + url, server='torrent', action='play'))
itemlist.append(item.clone(title = '{} [{} SEEDS] [{}]'.format(title, seed, size), seed=int(seed), size=sizenumber, url=host + url, server='torrent', action='play'))
itemlist.sort(key=lambda it: (it.seed, it.size), reverse=True)
Videolibrary = True if 'movie' in item.args else False

View File

@@ -17,11 +17,11 @@ deviceId = uuid.uuid4().hex
# domain = 'https://eu1-prod-direct.discoveryplus.com'
domain = 'https://' + session.get("https://prod-realmservice.mercury.dnitv.com/realm-config/www.discoveryplus.com%2Fit%2Fepg").json()["domain"]
token = session.get(f'{domain}/token?deviceId={deviceId}&realm=dplay&shortlived=true').json()['data']['attributes']['token']
token = session.get('{}/token?deviceId={}&realm=dplay&shortlived=true'.format(domain, deviceId)).json()['data']['attributes']['token']
session.headers = {'User-Agent': 'Mozilla/50.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
'Referer': host,
'Origin': host,
'Cookie': f'st={token}',
'Cookie': 'st={}'.format(token),
'content-type': 'application/json',
'x-disco-params': 'realm=dplay,siteLookupKey=dplus_it'}
@@ -54,7 +54,7 @@ def live(item):
logger.debug()
itemlist =[]
data = session.get(f'{domain}/cms/routes/epg?include=default').json()['included']
data = session.get(domain + '/cms/routes/epg?include=default').json()['included']
for key in data:
@@ -62,7 +62,7 @@ def live(item):
itemlist.append(item.clone(title = typo(key['attributes']['name'], 'bold'),
fulltitle = key['attributes']['name'],
plot = key['attributes'].get('description', ''),
url = f"{host}/canali/{key['attributes']['alternateId']}",
url = "{}/canali/{}".format(host, key['attributes']['alternateId']),
id = key['id'],
action = 'findvideos'))
return support.thumb(itemlist, live=True)
@@ -72,7 +72,7 @@ def programs(item):
logger.debug()
itemlist = []
data = session.get(f'{domain}/cms/routes/browse?include=default').json()['included']
data = session.get(domain + '/cms/routes/browse?include=default').json()['included']
images = {key['id'] : key['attributes']['src'] for key in data if key['type'] == 'image'}
channels = {}
@@ -95,7 +95,7 @@ def genres(item):
logger.debug()
itemlist = []
data = session.get(f'{domain}/cms/collections/{item.id}?include=default').json()['included']
data = session.get('{}/cms/collections/{}?include=default'. format(domain, item.id)).json()['included']
collection = {k['id']: k['relationships'].get('show', k['relationships'].get('collection'))['data']['id'] for k in data if k['type'] == 'collectionItem'}
included = {}
@@ -126,9 +126,9 @@ def peliculas(item):
itemlist =[]
if item.text:
data = session.get(f'{domain}/cms/routes/search/result?include=default&contentFilter[query]={item.text}').json()['included']
data = session.get('{}/cms/routes/search/result?include=default&contentFilter[query]={}').json()['included']
else:
data = session.get(f'{domain}/cms/collections/{item.id}?include=default').json()['included']
data = session.get('{}/cms/collections/{}?include=default'.format(domain, item.id)).json()['included']
images = {key['id'] : key['attributes']['src'] for key in data if key['type'] == 'image'}
@@ -163,12 +163,12 @@ def seasons(item):
logger.debug()
itemlist = []
data = session.get(f'{domain}/cms/routes/show/{item.programid}?include=default').json()['included']
data = session.get('{}/cms/routes/show/{}?include=default'.format(domain, item.programid)).json()['included']
for key in data:
if key['type'] == 'collection':
for option in key['attributes']['component']['filters'][0]['options']:
itemlist.append(item.clone(title=f"Stagione {option['value']}",
itemlist.append(item.clone(title="Stagione {}".format(option['value']),
season=int(option['value']),
seasonparams=option['parameter'],
showparams=key['attributes']['component']['mandatoryParams'],
@@ -184,12 +184,12 @@ def episodios(item):
logger.debug()
itemlist =[]
data = session.get(f'{domain}/cms/collections/{item.id}?include=default&{item.seasonparams}&{item.showparams}').json()['included']
data = session.get('{}/cms/collections/{}?include=default&{}&{}'.format(domain, item.id, item.seasonparams, item.showparams)).json()['included']
images = {key['id'] : key['attributes']['src'] for key in data if key['type'] == 'image'}
for key in data:
if key['type'] == 'video' and 'Free' in str(key.get('relationships',{}).get('contentPackages',{}).get('data',[])):
itemlist.append(item.clone(title = f"{item.season}x{key['attributes']['episodeNumber']:02d} - {key['attributes']['name']}",
itemlist.append(item.clone(title = "{}x{:02d} - {}".format(item.season, key['attributes']['episodeNumber'], key['attributes']['name']),
plot = key['attributes']['description'],
episode = key['attributes']['episodeNumber'],
contentType = 'episode',
@@ -210,14 +210,14 @@ def findvideos(item):
logger.debug()
content = 'video' if item.contentType == 'episode' else 'channel'
post = {f'{content}Id': item.id, 'deviceInfo': {'adBlocker': False,'drmSupported': True}}
post = {content + 'Id': item.id, 'deviceInfo': {'adBlocker': False,'drmSupported': True}}
data = session.post(f'{domain}/playback/v3/{content}PlaybackInfo', json=post).json().get('data',{}).get('attributes',{})
data = session.post('{}/playback/v3/{}PlaybackInfo'.format(domain, content), json=post).json().get('data',{}).get('attributes',{})
if data.get('protection', {}).get('drmEnabled',False):
item.url = data['streaming']['dash']['url']
item.drm = 'com.widevine.alpha'
item.license =f"{data['protection']['schemes']['widevine']['licenseUrl']}|PreAuthorization={data['protection']['drmToken']}|R{{SSM}}|"
item.license ="{}|PreAuthorization={}|R{{SSM}}|".format(data['protection']['schemes']['widevine']['licenseUrl'], data['protection']['drmToken'])
else:
item.url = data['streaming'][0]['url']
item.manifest = 'hls'

View File

@@ -27,7 +27,7 @@ def search(item, text):
logger.debug('search', text)
itemlist = []
text = text.replace(" ", "+")
item.url = f'{host}/index.php?do=search&subaction=search&story={text}'
item.url = '{}/index.php?do=search&subaction=search&story={}'.format(host, text)
try:
return peliculas(item)
@@ -76,7 +76,7 @@ def genres(item):
action = "peliculas"
_type ={'years':'Anno', 'genres':'Categorie'}
patronBlock = f'{_type[item.args]}(?:[^>]+>){{4}}(?P<block>.*?)</ul>'
patronBlock = _type[item.args] + r'(?:[^>]+>){4}(?P<block>.*?)</ul>'
patronMenu = '<li><a href="(?P<url>[^"]+)">(?P<title>.*?)</a>'
return locals()

View File

@@ -631,7 +631,7 @@ def set_content(content_type, silent=False, custom=False):
# Configure scraper
if seleccion != -1:
xbmc.executebuiltin(f'Addon.OpenSettings({values[seleccion]})', True)
xbmc.executebuiltin('Addon.OpenSettings({})'.format(values[seleccion]), True)
else:
continuar = False
@@ -691,7 +691,7 @@ def set_content(content_type, silent=False, custom=False):
strContent = 'movies'
scanRecursive = 2147483647
strScraper = values[seleccion]
path_settings = xbmc.translatePath(f"special://profile/addon_data/{strScraper}/settings.xml")
path_settings = xbmc.translatePath("special://profile/addon_data/{}/settings.xml".format(strScraper))
if not os.path.exists(path_settings):
logger.debug("%s: %s" % (content_type, path_settings + " doesn't exist"))
return continuar
@@ -706,7 +706,7 @@ def set_content(content_type, silent=False, custom=False):
strContent = 'tvshows'
scanRecursive = 0
strScraper = values[seleccion]
path_settings = xbmc.translatePath(f"special://profile/addon_data/{strScraper}/settings.xml")
path_settings = xbmc.translatePath("special://profile/addon_data/{}/settings.xml".format(strScraper))
if not os.path.exists(path_settings):
logger.debug("%s: %s" % (content_type, path_settings + " doesn't exist"))
return continuar
@@ -1303,9 +1303,9 @@ class NextDialog(xbmcgui.WindowXMLDialog):
else: img = filetools.join(config.get_runtime_path(), "resources", "noimage.png")
self.setProperty("next_img", img)
self.setProperty("title", info["tvshowtitle"])
ep_title = f'{info["season"]}x{info["episode"]:02d}'
ep_title = '{}x{:02d}'.format(info['season'], info["episode"])
if info.get("title",''):
ep_title += f' - {info["title"]}'
ep_title += ' - ' + info["title"]
self.setProperty("ep_title", ep_title)
self.show()