migliorie tmdb
This commit is contained in:
+1
-1
@@ -536,7 +536,7 @@ def scrape(func):
|
||||
if function == 'episodios': autorenumber.start(itemlist, item)
|
||||
else: autorenumber.start(itemlist)
|
||||
|
||||
if action != 'play' and 'patronMenu' not in args and not disabletmdb and inspect.stack()[1][3] not in ['add_tvshow'] or (function in ['episodios'] and config.get_setting('episode_info')): # and function != 'episodios' and item.contentType in ['movie', 'tvshow', 'episode', 'undefined']
|
||||
if action != 'play' and 'patronMenu' not in args and not disabletmdb and inspect.stack()[1][3] not in ['add_tvshow'] and function != 'episodios' or (function in ['episodios'] and config.get_setting('episode_info')): # and function != 'episodios' and item.contentType in ['movie', 'tvshow', 'episode', 'undefined']
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
if not group and not args.get('groupExplode') and ((pagination and len(matches) <= pag * pagination) or not pagination): # next page with pagination
|
||||
|
||||
+31
-31
@@ -17,7 +17,7 @@ from future.builtins import object
|
||||
|
||||
import ast, copy, re, time
|
||||
|
||||
from core import filetools, httptools, jsontools, scrapertools, support
|
||||
from core import filetools, httptools, jsontools, scrapertools
|
||||
from core.item import InfoLabels
|
||||
from platformcode import config, logger, platformtools
|
||||
import threading
|
||||
@@ -246,6 +246,7 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang):
|
||||
global otmdb_global
|
||||
|
||||
def read_data(otmdb_aux):
|
||||
# item.infoLabels = otmdb_aux.get_infoLabels(item.infoLabels)
|
||||
infoLabels = otmdb_aux.get_infoLabels(item.infoLabels)
|
||||
if not infoLabels['plot']: infoLabels['plot'] = otmdb_aux.get_plot('en')
|
||||
item.infoLabels = infoLabels
|
||||
@@ -404,7 +405,7 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang):
|
||||
# carry out another search to expand the information
|
||||
otmdb = Tmdb(id_Tmdb=otmdb.result.get("id"), search_type=search_type,
|
||||
search_language=search_language)
|
||||
if otmdb:
|
||||
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)
|
||||
@@ -837,7 +838,7 @@ class Tmdb(object):
|
||||
self.search_text = re.sub('\[\\\?(B|I|COLOR)\s?[^\]]*\]', '', self.searched_text).strip()
|
||||
self.search_type = kwargs.get('search_type', '')
|
||||
self.search_language = kwargs.get('search_language', def_lang)
|
||||
self.fallback_language = kwargs.get('search_language', 'en')
|
||||
self.fallback_language = 'en'
|
||||
# self.search_include_adult = kwargs.get('include_adult', False)
|
||||
self.search_year = kwargs.get('year', '')
|
||||
self.search_filter = kwargs.get('filtro', {})
|
||||
@@ -937,7 +938,7 @@ class Tmdb(object):
|
||||
if self.search_id:
|
||||
if source == "tmdb":
|
||||
url = ('{}/{}/{}?api_key={}&language={}&append_to_response=images,videos,external_ids,credits&include_image_language={},en,null'.format(host, self.search_type, self.search_id, api, self.search_language, self.search_language))
|
||||
searching = "id_Tmdb: " + self.search_id
|
||||
searching = "id_Tmdb: {}".format(self.search_id)
|
||||
else:
|
||||
url = ('{}/find/{}?external_source={}&api_key={}8&language={}'.format(host, self.search_id, source, api, self.search_language))
|
||||
searching = "{}: {}".format(source.capitalize(), self.search_id)
|
||||
@@ -957,6 +958,13 @@ class Tmdb(object):
|
||||
else:
|
||||
result = result['tv_episode_results'][0]
|
||||
|
||||
Mpaaurl = '{}/{}/{}/{}?api_key={}'.format(host, self.search_type, result['id'], 'release_dates' if self.search_type == 'movie' else 'content_ratings', api)
|
||||
Mpaas = self.get_json(Mpaaurl).get('results',[])
|
||||
for m in Mpaas:
|
||||
if m.get('iso_3166_1','').lower() == 'us':
|
||||
result['mpaa'] = m.get('rating', m.get('release_dates', [{}])[0].get('certification'))
|
||||
break
|
||||
|
||||
self.results = [result]
|
||||
self.total_results = 1
|
||||
self.total_pages = 1
|
||||
@@ -1333,19 +1341,14 @@ class Tmdb(object):
|
||||
# http://api.themoviedb.org/3/tv/1407/season/1?api_key=a1ab8b8669da03637a4b98fa39c39228&language=es&
|
||||
# append_to_response=credits
|
||||
url = "{}/tv/{}/season/{}?api_key={}&language={}&append_to_response=videos,images,credits,external_ids&include_image_language={},en,null".format(host, self.result["id"], seasonNumber, api, search_language, search_language)
|
||||
fallbackUrl = "{}/tv/{}/season/{}?api_key={}&language=en&append_to_response=videos,images,credits&include_image_language={},en,null".format(host, self.result["id"], seasonNumber, api, search_language)
|
||||
# fallbackUrl = "{}/tv/{}/season/{}?api_key={}&language=en&append_to_response=videos,images,credits&include_image_language={},en,null".format(host, self.result["id"], seasonNumber, api, search_language)
|
||||
logger.debug('TMDB URL', url)
|
||||
|
||||
searching = "id_Tmdb: " + str(self.result["id"]) + " season: " + str(seasonNumber) + "\nURL: " + url
|
||||
logger.debug("[Tmdb.py] Searching " + searching)
|
||||
# from core.support import dbg;dbg()
|
||||
try:
|
||||
info = self.get_json(url)
|
||||
if not language:
|
||||
fallbackInfo = self.get_json(fallbackUrl)
|
||||
self.season[seasonNumber] = parse_fallback_info(info, fallbackInfo)
|
||||
else:
|
||||
self.season[seasonNumber] = self.get_json(url)
|
||||
self.season[seasonNumber] = self.get_json(url)
|
||||
if not isinstance(self.season[seasonNumber], dict):
|
||||
self.season[seasonNumber] = ast.literal_eval(self.season[seasonNumber].decode('utf-8'))
|
||||
|
||||
@@ -1372,16 +1375,19 @@ class Tmdb(object):
|
||||
_id = collection.get('id')
|
||||
if _id:
|
||||
url = '{}/collection/{}?api_key={}&language={}&append_to_response=images'.format(host, _id, api, self.search_language)
|
||||
fallbackUrl = '{}/collection/{}?api_key={}&language=en&append_to_response=images'.format(host, _id, api)
|
||||
tanslationurl = '{}/collection/{}/translations?api_key={}'.format(host, _id, api)
|
||||
info = self.get_json(url)
|
||||
fallbackInfo = self.get_json(fallbackUrl)
|
||||
ret['set'] = info.get('name') if info.get('name') else fallbackInfo.get('name')
|
||||
ret['setoverview'] = info.get('overview') if info.get('overview') else fallbackInfo.get('overview')
|
||||
posters = ['https://image.tmdb.org/t/p/original' + (info.get('poster_path') if info.get('poster_path') else fallbackInfo.get('poster_path'))]
|
||||
fanarts = ['https://image.tmdb.org/t/p/original' + (info.get('backdrop_path') if info.get('backdrop_path') else fallbackInfo.get('backdrop_path'))]
|
||||
for image in info['images']['posters'] + fallbackInfo['images']['posters']:
|
||||
for t in self.get_json(tanslationurl).get('translations'):
|
||||
if t.get('iso_639_1') == self.fallback_language:
|
||||
translation = t.get('data',{})
|
||||
break
|
||||
ret['set'] = info.get('name') if info.get('name') else translation.get('name')
|
||||
ret['setoverview'] = info.get('overview') if info.get('overview') else translation.get('overview')
|
||||
posters = ['https://image.tmdb.org/t/p/original' + info.get('poster_path')] if info.get('poster_path') else []
|
||||
fanarts = ['https://image.tmdb.org/t/p/original' + info.get('backdrop_path')] if info.get('backdrop_path') else []
|
||||
for image in info['images']['posters']:
|
||||
posters.append('https://image.tmdb.org/t/p/original' + image['file_path'])
|
||||
for image in info['images']['backdrops'] + fallbackInfo['images']['backdrops']:
|
||||
for image in info['images']['backdrops']:
|
||||
fanarts.append('https://image.tmdb.org/t/p/original' + image['file_path'])
|
||||
ret['setposters'] = posters
|
||||
ret['setfanarts'] = fanarts
|
||||
@@ -1633,11 +1639,11 @@ class Tmdb(object):
|
||||
|
||||
elif k == 'release_date':
|
||||
ret_infoLabels['year'] = int(v[:4])
|
||||
ret_infoLabels['premiered'] = v.split("-")[2] + "/" + v.split("-")[1] + "/" + v.split("-")[0]
|
||||
ret_infoLabels['premiered'] = v
|
||||
|
||||
elif k == 'first_air_date':
|
||||
ret_infoLabels['year'] = int(v[:4])
|
||||
ret_infoLabels['aired'] = v.split("-")[2] + "/" + v.split("-")[1] + "/" + v.split("-")[0]
|
||||
ret_infoLabels['aired'] = v
|
||||
ret_infoLabels['premiered'] = ret_infoLabels['aired']
|
||||
|
||||
elif k == 'original_title' or k == 'original_name':
|
||||
@@ -1704,6 +1710,7 @@ class Tmdb(object):
|
||||
ret_infoLabels[k] = v
|
||||
|
||||
elif k == 'production_countries' or k == 'origin_country':
|
||||
# support.dbg()
|
||||
if isinstance(v, str):
|
||||
l_country = list(set(l_country + v.split(',')))
|
||||
|
||||
@@ -1713,9 +1720,9 @@ class Tmdb(object):
|
||||
elif isinstance(v[0], dict):
|
||||
# {'iso_3166_1': 'FR', 'name':'France'}
|
||||
for i in v:
|
||||
if 'iso_3166_1' in i:
|
||||
pais = Tmdb.dic_country.get(i['iso_3166_1'], i['iso_3166_1'])
|
||||
l_country = list(set(l_country + [pais]))
|
||||
if 'name' in i:
|
||||
# pais = Tmdb.dic_country.get(i['iso_3166_1'], i['iso_3166_1'])
|
||||
l_country = list(set(l_country + [i['name']]))
|
||||
|
||||
elif k == 'credits_crew' or k == 'episode_crew' or k == 'season_crew':
|
||||
for crew in v:
|
||||
@@ -1737,13 +1744,6 @@ class Tmdb(object):
|
||||
# logger.debug("Atributos no añadidos: " + k +'= '+ str(v))
|
||||
pass
|
||||
|
||||
Mpaaurl = '{}/{}/{}/content_ratings?api_key={}'.format(host, self.search_type, ret_infoLabels['tmdb_id'], api)
|
||||
Mpaas = self.get_json(Mpaaurl).get('results',[])
|
||||
for m in Mpaas:
|
||||
if m.get('iso_3166_1','').lower() == 'us':
|
||||
ret_infoLabels['Mpaa'] = m['rating']
|
||||
break
|
||||
|
||||
# Sort the lists and convert them to str if necessary
|
||||
if l_castandrole:
|
||||
ret_infoLabels['castandrole'] = sorted(l_castandrole, key=lambda tup: tup[0])
|
||||
|
||||
@@ -1373,7 +1373,7 @@ msgid "More than 17 years old"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#60292"
|
||||
msgid "Searching for TV show information"
|
||||
msgid "Search for information on episodes"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#60293"
|
||||
|
||||
@@ -1372,8 +1372,8 @@ msgid "More than 17 years old"
|
||||
msgstr "Più di 17 anni"
|
||||
|
||||
msgctxt "#60292"
|
||||
msgid "Searching for TV show information"
|
||||
msgstr "Ricerca informazioni sulla serie TV"
|
||||
msgid "Search for information on episodes"
|
||||
msgstr "Cerca informazioni sugli episodi"
|
||||
|
||||
msgctxt "#60293"
|
||||
msgid "Please wait..."
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<setting id="resolver_dns" type="bool" label="707408" default="true" enable="true" visible="true"/>
|
||||
<setting id="checkdns" type="bool" default="true" visible="false"/>
|
||||
<setting label="70788" type="lsep"/>
|
||||
<setting id="episode_info" type="bool" label="Infornmazioni episodio (non consigliato in dispositivi lenti)" default="false"/>
|
||||
<setting id="debug" type="bool" label="30003" default="false"/>
|
||||
<setting id="chrome_ua_version" type="text" default="87.0.4280.88" visible="False"/>
|
||||
</category>
|
||||
@@ -93,6 +92,7 @@
|
||||
<setting id="tmdb_active" default="true" visible="false"/>
|
||||
<!-- <setting id="tmdb_threads" type="slider" option="int" range="5,5,30" label="70155" default="20"/>-->
|
||||
<setting id="tmdb_plus_info" type="bool" label="70156" default="false"/>
|
||||
<setting id="episode_info" type="bool" label="60292" default="false"/>
|
||||
<setting id="tmdb_cache" type="bool" label="70157" default="true"/>
|
||||
<setting id="tmdb_cache_expire" type="select" lvalues="70158|70159|70160|70161|70170" label="70162" enable="eq(-1,true)" default="4"/>
|
||||
<setting id="tmdb_clean_db_cache" type="action" label="70163" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2NyaXB0Ig0KfQ==)" />
|
||||
|
||||
Reference in New Issue
Block a user