fix e piccole migliorie trailer
This commit is contained in:
@@ -3285,7 +3285,7 @@ msgid "Only until Kodi restarts"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#70115"
|
msgctxt "#70115"
|
||||||
msgid ""
|
msgid "Trailer search in progress"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#70116"
|
msgctxt "#70116"
|
||||||
|
|||||||
@@ -3284,8 +3284,8 @@ msgid "Only until Kodi restarts"
|
|||||||
msgstr "Fino al riavvio di Kodi"
|
msgstr "Fino al riavvio di Kodi"
|
||||||
|
|
||||||
msgctxt "#70115"
|
msgctxt "#70115"
|
||||||
msgid ""
|
msgid "Trailer search in progress"
|
||||||
msgstr ""
|
msgstr "Ricerca trailer in corso"
|
||||||
|
|
||||||
msgctxt "#70116"
|
msgctxt "#70116"
|
||||||
msgid "New password"
|
msgid "New password"
|
||||||
|
|||||||
+28
-11
@@ -106,7 +106,8 @@ def buscartrailer(item, trailers=[]):
|
|||||||
import traceback
|
import traceback
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
multi_search(item, itemlist, tipo)
|
if multi_search(item, itemlist, tipo):
|
||||||
|
return
|
||||||
if not itemlist:
|
if not itemlist:
|
||||||
itemlist.append(item.clone(title=config.get_localized_string(70501), title2=item.contentTitle,
|
itemlist.append(item.clone(title=config.get_localized_string(70501), title2=item.contentTitle,
|
||||||
action="", thumbnail=get_thumb('nofolder.png'), text_color=""))
|
action="", thumbnail=get_thumb('nofolder.png'), text_color=""))
|
||||||
@@ -128,13 +129,23 @@ def buscartrailer(item, trailers=[]):
|
|||||||
|
|
||||||
def multi_search(item, itemlist, tipo):
|
def multi_search(item, itemlist, tipo):
|
||||||
ris = []
|
ris = []
|
||||||
|
dialog = platformtools.dialog_progress('Trailer', config.get_localized_string(70115))
|
||||||
|
perc = 0
|
||||||
|
canceled = False
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
|
ris.append(executor.submit(tmdb_trailers, item, dialog, tipo))
|
||||||
ris.append(executor.submit(mymovies_search, item))
|
ris.append(executor.submit(mymovies_search, item))
|
||||||
ris.append(executor.submit(youtube_search, item))
|
ris.append(executor.submit(youtube_search, item))
|
||||||
ris.append(executor.submit(tmdb_trailers, item, tipo))
|
|
||||||
|
|
||||||
for r in futures.as_completed(ris):
|
for r in futures.as_completed(ris):
|
||||||
|
if dialog.iscanceled():
|
||||||
|
dialog.close()
|
||||||
|
canceled = True
|
||||||
|
perc += 33
|
||||||
|
dialog.update(perc)
|
||||||
itemlist.extend(r.result())
|
itemlist.extend(r.result())
|
||||||
|
dialog.close()
|
||||||
|
return canceled
|
||||||
|
|
||||||
|
|
||||||
def manual_search(item, tipo):
|
def manual_search(item, tipo):
|
||||||
@@ -142,11 +153,12 @@ def manual_search(item, tipo):
|
|||||||
itemlist = []
|
itemlist = []
|
||||||
texto = platformtools.dialog_input(default=item.contentTitle, heading=config.get_localized_string(30112))
|
texto = platformtools.dialog_input(default=item.contentTitle, heading=config.get_localized_string(30112))
|
||||||
if texto is not None:
|
if texto is not None:
|
||||||
multi_search(item.clone(contentTitle=texto), itemlist, tipo)
|
if multi_search(item.clone(contentTitle=texto), itemlist, tipo):
|
||||||
|
return
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def tmdb_trailers(item, tipo="movie"):
|
def tmdb_trailers(item, dialog, tipo="movie"):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
from core.tmdb import Tmdb
|
from core.tmdb import Tmdb
|
||||||
@@ -158,16 +170,17 @@ def tmdb_trailers(item, tipo="movie"):
|
|||||||
tmdb_search = Tmdb(texto_buscado=item.contentTitle, tipo=tipo, year=item.infoLabels['year'])
|
tmdb_search = Tmdb(texto_buscado=item.contentTitle, tipo=tipo, year=item.infoLabels['year'])
|
||||||
|
|
||||||
if tmdb_search:
|
if tmdb_search:
|
||||||
|
found = False
|
||||||
for vid in tmdb_search.get_videos():
|
for vid in tmdb_search.get_videos():
|
||||||
found = False
|
|
||||||
if vid['type'].lower() == 'trailer':
|
if vid['type'].lower() == 'trailer':
|
||||||
title = vid['name']
|
title = vid['name']
|
||||||
it = item.clone(action="play", title=title, title2="TMDB(youtube) - " + vid['language'].replace("en", "ING").replace("it", "ITA") + " [" + vid['size'] + "p]", url=vid['url'], server="youtube")
|
it = del_id(item.clone(action="play", title=title, title2="TMDB(youtube) - " + vid['language'].replace("en", "ING").replace("it", "ITA") + " [" + vid['size'] + "p]", url=vid['url'], server="youtube"))
|
||||||
itemlist.append(it)
|
itemlist.append(it)
|
||||||
|
|
||||||
if vid['language'] == def_lang and not found: # play now because lang is correct and TMDB is trusted
|
if vid['language'] == def_lang and not found: # play now because lang is correct and TMDB is trusted
|
||||||
found = True
|
found = True
|
||||||
launcher.run(it)
|
launcher.run(it)
|
||||||
|
dialog.close()
|
||||||
while platformtools.is_playing():
|
while platformtools.is_playing():
|
||||||
xbmc.sleep(100)
|
xbmc.sleep(100)
|
||||||
|
|
||||||
@@ -197,8 +210,8 @@ def youtube_search(item):
|
|||||||
if item.contextual:
|
if item.contextual:
|
||||||
scrapedtitle = "%s" % scrapedtitle
|
scrapedtitle = "%s" % scrapedtitle
|
||||||
url = urlparse.urljoin('https://www.youtube.com/', scrapedurl)
|
url = urlparse.urljoin('https://www.youtube.com/', scrapedurl)
|
||||||
itemlist.append(item.clone(title=scrapedtitle, title2='Youtube - ' + scrapedduration, action="play", server="youtube",
|
itemlist.append(del_id(item.clone(title=scrapedtitle, title2='Youtube - ' + scrapedduration, action="play", server="youtube",
|
||||||
url=url, thumbnail=scrapedthumbnail))
|
url=url, thumbnail=scrapedthumbnail)))
|
||||||
# next_page = scrapertools.find_single_match(data, '<a href="([^"]+)"[^>]+><span class="yt-uix-button-content">')
|
# next_page = scrapertools.find_single_match(data, '<a href="([^"]+)"[^>]+><span class="yt-uix-button-content">')
|
||||||
# if next_page != "":
|
# if next_page != "":
|
||||||
# next_page = urlparse.urljoin("https://www.youtube.com", next_page)
|
# next_page = urlparse.urljoin("https://www.youtube.com", next_page)
|
||||||
@@ -234,12 +247,16 @@ def search_links_mymovies(item):
|
|||||||
logger.debug()
|
logger.debug()
|
||||||
trailer_url = match(item, patron=r'<source src="([^"]+)').match
|
trailer_url = match(item, patron=r'<source src="([^"]+)').match
|
||||||
if trailer_url:
|
if trailer_url:
|
||||||
it = item.clone(url=trailer_url, server='directo', action="play")
|
it = del_id(item.clone(url=trailer_url, server='directo', action="play"))
|
||||||
if 'tmdb_id' in it.infoLabels:
|
|
||||||
del it.infoLabels['tmdb_id'] # for not saving watch time
|
|
||||||
return it
|
return it
|
||||||
|
|
||||||
|
|
||||||
|
def del_id(it):
|
||||||
|
"""for not saving watch time"""
|
||||||
|
if 'tmdb_id' in it.infoLabels:
|
||||||
|
del it.infoLabels['tmdb_id']
|
||||||
|
return it
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
import xbmc
|
import xbmc
|
||||||
|
|||||||
Reference in New Issue
Block a user