Merge branch 'master' of https://github.com/kodiondemand/addon
This commit is contained in:
@@ -239,10 +239,6 @@ def findvideos(item): # Questa def. deve sempre essere nominata findvideos
|
|||||||
Item(channel=item.channel, title='[COLOR lightblue][B]Aggiungi alla videoteca[/B][/COLOR]', url=item.url,
|
Item(channel=item.channel, title='[COLOR lightblue][B]Aggiungi alla videoteca[/B][/COLOR]', url=item.url,
|
||||||
action='add_pelicula_to_library', extra='findservers', contentTitle=item.contentTitle))
|
action='add_pelicula_to_library', extra='findservers', contentTitle=item.contentTitle))
|
||||||
|
|
||||||
# Necessario per filtrare i Link
|
|
||||||
if checklinks:
|
|
||||||
itemlist = servertools.check_list_links(itemlist, checklinks_number)
|
|
||||||
|
|
||||||
# Necessario per FilterTools
|
# Necessario per FilterTools
|
||||||
# itemlist = filtertools.get_links(itemlist, item, list_language)
|
# itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1176,7 +1176,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
|||||||
AP, HS = autoplay.get_channel_AP_HS(item)
|
AP, HS = autoplay.get_channel_AP_HS(item)
|
||||||
|
|
||||||
# Check Links
|
# Check Links
|
||||||
if not AP and (config.get_setting('checklinks') or config.get_setting('checklinks', item.channel)):
|
if not AP and not item.global_search and (config.get_setting('checklinks') or config.get_setting('checklinks', item.channel)):
|
||||||
if config.get_setting('checklinks', item.channel):
|
if config.get_setting('checklinks', item.channel):
|
||||||
checklinks_number = config.get_setting('checklinks_number', item.channel)
|
checklinks_number = config.get_setting('checklinks_number', item.channel)
|
||||||
elif config.get_setting('checklinks'):
|
elif config.get_setting('checklinks'):
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ msgid "Contextual menu"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30025"
|
msgctxt "#30025"
|
||||||
msgid ""
|
msgid "Other possible results"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30026"
|
msgctxt "#30026"
|
||||||
@@ -529,7 +529,7 @@ msgid "Synchronization with Trakt started"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#59972"
|
msgctxt "#59972"
|
||||||
msgid "Search for: '%s' | Found: %d vídeos | Time: %2.f seconds"
|
msgid "Search for: '%s' | Time: %2.f seconds"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#59973"
|
msgctxt "#59973"
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ msgid "Contextual menu"
|
|||||||
msgstr "Menu contestuale"
|
msgstr "Menu contestuale"
|
||||||
|
|
||||||
msgctxt "#30025"
|
msgctxt "#30025"
|
||||||
msgid ""
|
msgid "Other possible results"
|
||||||
msgstr ""
|
msgstr "Altri possibili risultati:"
|
||||||
|
|
||||||
msgctxt "#30026"
|
msgctxt "#30026"
|
||||||
msgid "Direct"
|
msgid "Direct"
|
||||||
@@ -528,8 +528,8 @@ msgid "Synchronization with Trakt started"
|
|||||||
msgstr "Sincronizzazione con Trakt iniziata"
|
msgstr "Sincronizzazione con Trakt iniziata"
|
||||||
|
|
||||||
msgctxt "#59972"
|
msgctxt "#59972"
|
||||||
msgid "Search for: '%s' | Found: %d vídeos | Time: %2.f seconds"
|
msgid "Search for: '%s' | Time: %2.f seconds"
|
||||||
msgstr "Ricerca di: '%s' | Trovati: %d video | Tempo: %2.f secondi"
|
msgstr "Ricerca di: '%s' | Tempo: %2.f secondi"
|
||||||
|
|
||||||
msgctxt "#59973"
|
msgctxt "#59973"
|
||||||
msgid "Search Cancelled"
|
msgid "Search Cancelled"
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ def start(itemlist, item):
|
|||||||
:param item: item (the main item of the channel)
|
:param item: item (the main item of the channel)
|
||||||
:return: try to auto-reproduce, in case of failure it returns the itemlist that it received in the beginning
|
:return: try to auto-reproduce, in case of failure it returns the itemlist that it received in the beginning
|
||||||
'''
|
'''
|
||||||
|
if item.global_search:
|
||||||
|
return itemlist
|
||||||
logger.info()
|
logger.info()
|
||||||
|
|
||||||
global PLAYED
|
global PLAYED
|
||||||
|
|||||||
+78
-31
@@ -198,21 +198,27 @@ def channel_search(item):
|
|||||||
cnt = 0
|
cnt = 0
|
||||||
|
|
||||||
progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(70744) % len(channel_list),
|
progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(70744) % len(channel_list),
|
||||||
str(searching_titles))
|
', '.join(searching_titles))
|
||||||
config.set_setting('tmdb_active', False)
|
config.set_setting('tmdb_active', False)
|
||||||
|
|
||||||
search_action_list = []
|
search_action_list = []
|
||||||
module_dict = {}
|
module_dict = {}
|
||||||
logger.info('start import')
|
|
||||||
for ch in channel_list:
|
for ch in channel_list:
|
||||||
# ch_params = channeltools.get_channel_parameters(ch)
|
try:
|
||||||
module = __import__('channels.%s' % ch, fromlist=["channels.%s" % ch])
|
module = __import__('channels.%s' % ch, fromlist=["channels.%s" % ch])
|
||||||
mainlist = getattr(module, 'mainlist')(Item(channel=ch, global_search=True))
|
mainlist = getattr(module, 'mainlist')(Item(channel=ch, global_search=True))
|
||||||
|
|
||||||
module_dict[ch] = module
|
module_dict[ch] = module
|
||||||
search_action_list.extend([elem for elem in mainlist if
|
search_action_list.extend([elem for elem in mainlist if
|
||||||
elem.action == "search" and (item.mode == 'all' or elem.contentType == item.mode)])
|
elem.action == "search" and (mode == 'all' or elem.contentType == mode)])
|
||||||
logger.info('end import')
|
if progress.iscanceled():
|
||||||
|
return []
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
logger.error('error importing/getting search items of ' + ch)
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
|
total_search_actions = len(search_action_list)
|
||||||
with futures.ThreadPoolExecutor(max_workers=set_workers()) as executor:
|
with futures.ThreadPoolExecutor(max_workers=set_workers()) as executor:
|
||||||
c_results = []
|
c_results = []
|
||||||
for search_action in search_action_list:
|
for search_action in search_action_list:
|
||||||
@@ -221,18 +227,27 @@ def channel_search(item):
|
|||||||
break
|
break
|
||||||
|
|
||||||
for res in futures.as_completed(c_results):
|
for res in futures.as_completed(c_results):
|
||||||
cnt += 1
|
search_action = res.result()[0]
|
||||||
finished = res.result()[0]
|
channel = search_action.channel
|
||||||
if res.result()[1]:
|
if res.result()[1]:
|
||||||
ch_list[res.result()[0]] = res.result()[1]
|
if channel not in ch_list:
|
||||||
|
ch_list[channel] = []
|
||||||
|
ch_list[channel].extend(res.result()[1])
|
||||||
|
|
||||||
if progress.iscanceled():
|
if progress.iscanceled():
|
||||||
break
|
break
|
||||||
if finished in searching:
|
|
||||||
searching_titles.remove(searching_titles[searching.index(finished)])
|
search_action_list.remove(search_action)
|
||||||
searching.remove(finished)
|
# if no action of this channel remains
|
||||||
progress.update(old_div((cnt * 100), len(channel_list)), config.get_localized_string(70744) % str(len(channel_list) - cnt),
|
for it in search_action_list:
|
||||||
str(searching_titles))
|
if it.channel == channel:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
cnt += 1
|
||||||
|
searching_titles.remove(searching_titles[searching.index(channel)])
|
||||||
|
searching.remove(channel)
|
||||||
|
progress.update(old_div(((total_search_actions - len(search_action_list)) * 100), total_search_actions), config.get_localized_string(70744) % str(len(channel_list) - cnt),
|
||||||
|
', '.join(searching_titles))
|
||||||
|
|
||||||
progress.close()
|
progress.close()
|
||||||
|
|
||||||
@@ -241,7 +256,7 @@ def channel_search(item):
|
|||||||
config.get_localized_string(60293))
|
config.get_localized_string(60293))
|
||||||
|
|
||||||
config.set_setting('tmdb_active', True)
|
config.set_setting('tmdb_active', True)
|
||||||
res_count = 0
|
# res_count = 0
|
||||||
for key, value in ch_list.items():
|
for key, value in ch_list.items():
|
||||||
ch_name = channel_titles[channel_list.index(key)]
|
ch_name = channel_titles[channel_list.index(key)]
|
||||||
grouped = list()
|
grouped = list()
|
||||||
@@ -251,12 +266,11 @@ def channel_search(item):
|
|||||||
if len(value) == 1:
|
if len(value) == 1:
|
||||||
if not value[0].action or config.get_localized_string(70006).lower() in value[0].title.lower():
|
if not value[0].action or config.get_localized_string(70006).lower() in value[0].title.lower():
|
||||||
continue
|
continue
|
||||||
tmdb.set_infoLabels_itemlist(value, True, forced=True)
|
|
||||||
for elem in value:
|
for elem in value:
|
||||||
if not elem.infoLabels.get('year', ""):
|
if not elem.infoLabels.get('year', ""):
|
||||||
elem.infoLabels['year'] = '-'
|
elem.infoLabels['year'] = '-'
|
||||||
tmdb.set_infoLabels_item(elem, True)
|
tmdb.set_infoLabels_itemlist(value, True, forced=True)
|
||||||
|
for elem in value:
|
||||||
if elem.infoLabels['tmdb_id'] == searched_id:
|
if elem.infoLabels['tmdb_id'] == searched_id:
|
||||||
elem.from_channel = key
|
elem.from_channel = key
|
||||||
if not config.get_setting('unify'):
|
if not config.get_setting('unify'):
|
||||||
@@ -288,7 +302,7 @@ def channel_search(item):
|
|||||||
title = typo(ch_name,'bold') + typo(str(len(grouped)), '_ [] color kod bold')
|
title = typo(ch_name,'bold') + typo(str(len(grouped)), '_ [] color kod bold')
|
||||||
else:
|
else:
|
||||||
title = typo('%s %s' % (len(grouped), config.get_localized_string(70695)), 'bold')
|
title = typo('%s %s' % (len(grouped), config.get_localized_string(70695)), 'bold')
|
||||||
res_count += len(grouped)
|
# res_count += len(grouped)
|
||||||
plot=''
|
plot=''
|
||||||
|
|
||||||
for it in grouped:
|
for it in grouped:
|
||||||
@@ -297,16 +311,36 @@ def channel_search(item):
|
|||||||
results.append(Item(channel='search', title=title,
|
results.append(Item(channel='search', title=title,
|
||||||
action='get_from_temp', thumbnail=ch_thumb, itemlist=[ris.tourl() for ris in grouped], plot=plot, page=1))
|
action='get_from_temp', thumbnail=ch_thumb, itemlist=[ris.tourl() for ris in grouped], plot=plot, page=1))
|
||||||
|
|
||||||
|
progress.close()
|
||||||
|
# "All Together" and movie mode -> search servers
|
||||||
|
if config.get_setting('result_mode') == 1 and mode == 'movie':
|
||||||
|
progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(60683))
|
||||||
|
valid_servers = []
|
||||||
|
with futures.ThreadPoolExecutor(max_workers=set_workers()) as executor:
|
||||||
|
c_results = [executor.submit(get_servers, v, module_dict) for v in valid]
|
||||||
|
completed = 0
|
||||||
|
|
||||||
|
for res in futures.as_completed(c_results):
|
||||||
|
if progress.iscanceled():
|
||||||
|
break
|
||||||
|
if res.result():
|
||||||
|
completed += 1
|
||||||
|
valid_servers.extend(res.result())
|
||||||
|
progress.update(old_div(completed * 100, len(valid)))
|
||||||
|
valid = valid_servers
|
||||||
|
progress.close()
|
||||||
|
|
||||||
# send_to_temp(to_temp)
|
# send_to_temp(to_temp)
|
||||||
config.set_setting('tmdb_active', True)
|
|
||||||
if item.mode == 'all':
|
results = sorted(results, key=lambda it: it.title)
|
||||||
if config.get_setting('result_mode', 'search') != 0:
|
results_statistic = config.get_localized_string(59972) % (item.title, time.time() - start)
|
||||||
res_count = len(results)
|
if mode == 'all':
|
||||||
results = sorted(results, key=lambda it: it.title)
|
results.insert(0, Item(title=typo(results_statistic, 'color kod bold'), thumbnail=get_thumb('search.png')))
|
||||||
results_statistic = config.get_localized_string(59972) % (item.title, res_count, time.time() - start)
|
else:
|
||||||
results.insert(0, Item(title = typo(results_statistic,'color kod bold')))
|
valid.insert(0, Item(title=typo(results_statistic, 'color kod bold'), thumbnail=get_thumb('search.png')))
|
||||||
|
|
||||||
|
if results:
|
||||||
|
results.insert(0, Item(title=typo(config.get_localized_string(30025), 'color kod bold'), thumbnail=get_thumb('search.png')))
|
||||||
# logger.debug(results_statistic)
|
# logger.debug(results_statistic)
|
||||||
return valid + results
|
return valid + results
|
||||||
|
|
||||||
@@ -328,9 +362,22 @@ def get_channel_results(item, module_dict, search_action):
|
|||||||
|
|
||||||
results = get_info(results)
|
results = get_info(results)
|
||||||
|
|
||||||
return [ch, results]
|
return [search_action, results]
|
||||||
except:
|
except:
|
||||||
return [ch, results]
|
return [search_action, results]
|
||||||
|
|
||||||
|
|
||||||
|
def get_servers(item, module_dict):
|
||||||
|
item.global_search = True
|
||||||
|
ch = item.channel
|
||||||
|
results = list()
|
||||||
|
module = module_dict[ch]
|
||||||
|
try:
|
||||||
|
results = getattr(module, item.action)(item)
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
return [r.clone(title=r.title + typo(item.channel, '_ [] color kod')) for r in results if r.action == 'play']
|
||||||
|
|
||||||
|
|
||||||
def get_info(itemlist):
|
def get_info(itemlist):
|
||||||
|
|||||||
Reference in New Issue
Block a user