-Nuova Ricerca Globale\n-Nuova Rinumerazione\n-Messaggi di Errore più chiari\n-Fix var\n
This commit is contained in:
marco
2020-12-01 20:19:07 +01:00
parent 97e06a8b84
commit 94eac40955
233 changed files with 4568 additions and 2245 deletions

View File

@@ -19,7 +19,7 @@ def start():
Within this function all calls should go to
functions that we want to execute as soon as we open the plugin.
"""
logger.info()
logger.debug()
# config.set_setting('show_once', True)
# Test if all the required directories are created
config.verify_directories_created()
@@ -37,7 +37,7 @@ def start():
updater.showSavedChangelog()
def run(item=None):
logger.info()
logger.debug()
if not item:
# Extract item from sys.argv
if sys.argv[2]:
@@ -94,7 +94,7 @@ def run(item=None):
# If item has no action, stops here
if item.action == "":
logger.info("Item without action")
logger.debug("Item without action")
return
# Action for main menu in channelselector
@@ -135,6 +135,12 @@ def run(item=None):
from platformcode import infoplus
return infoplus.Main(item)
elif config.get_setting('new_search') and item.channel == "search" and item.action == 'new_search':
from platformcode.globalsearch import Search
item.contextual = True
Search(item)
return
elif item.channel == "backup":
from platformcode import backup
return getattr(backup, item.action)(item)
@@ -187,7 +193,7 @@ def run(item=None):
channel_file = os.path.join(config.get_runtime_path(), CHANNELS, item.channel + ".py")
logger.info("channel_file= " + channel_file + ' - ' + CHANNELS + ' - ' + item.channel)
logger.debug("channel_file= " + channel_file + ' - ' + CHANNELS + ' - ' + item.channel)
channel = None
@@ -207,12 +213,12 @@ def run(item=None):
trakt_tools.set_trakt_info(item)
except:
pass
logger.info("item.action=%s" % item.action.upper())
logger.debug("item.action=%s" % item.action.upper())
# logger.debug("item_toPlay: " + "\n" + item.tostring('\n'))
# First checks if channel has a "play" function
if hasattr(channel, 'play'):
logger.info("Executing channel 'play' method")
logger.debug("Executing channel 'play' method")
itemlist = channel.play(item)
b_favourite = item.isFavourite
# Play should return a list of playable URLS
@@ -233,7 +239,7 @@ def run(item=None):
# If player don't have a "play" function, not uses the standard play from platformtools
else:
logger.info("Executing core 'play' method")
logger.debug("Executing core 'play' method")
platformtools.play_video(item)
# Special action for findvideos, where the plugin looks for known urls
@@ -246,8 +252,7 @@ def run(item=None):
# If not, uses the generic findvideos function
else:
logger.info("No channel 'findvideos' method, "
"executing core method")
logger.debug("No channel 'findvideos' method, " "executing core method")
itemlist = servertools.find_video_items(item)
if config.get_setting("max_links", "videolibrary") != 0:
@@ -291,7 +296,7 @@ def run(item=None):
else:
filetools.remove(temp_search_file)
logger.info("item.action=%s" % item.action.upper())
logger.debug("item.action=%s" % item.action.upper())
from core import channeltools
if config.get_setting('last_search'):
@@ -312,7 +317,7 @@ def run(item=None):
# For all other actions
else:
# import web_pdb; web_pdb.set_trace()
logger.info("Executing channel '%s' method" % item.action)
logger.debug("Executing channel '%s' method" % item.action)
itemlist = getattr(channel, item.action)(item)
if config.get_setting('trakt_sync'):
from core import trakt_tools
@@ -336,13 +341,10 @@ def run(item=None):
logger.error(traceback.format_exc())
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"'
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
platformtools.dialog_ok(
config.get_localized_string(59985) + Channel,
config.get_localized_string(60013) %(e))
except:
config.get_localized_string(59985) % e.channel,
config.get_localized_string(60013) % e.url)
except Exception as e:
import traceback
from core import scrapertools
@@ -351,26 +353,15 @@ def run(item=None):
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"'
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
try:
import xbmc
if config.get_platform(True)['num_version'] < 14:
log_name = "xbmc.log"
else:
log_name = "kodi.log"
log_message = config.get_localized_string(50004) + xbmc.translatePath("special://logpath") + log_name
except:
log_message = ""
if Channel:
if Channel or e.__class__ == logger.ChannelScraperException:
if item.url:
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014) + '\n' + log_message, nolabel='ok', yeslabel=config.get_localized_string(70739)):
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014), nolabel='ok', yeslabel=config.get_localized_string(70739)):
run(Item(action="open_browser", url=item.url))
else:
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014) + '\n' + log_message)
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014))
else:
platformtools.dialog_ok(
config.get_localized_string(60038),
config.get_localized_string(60015) + '\n' + log_message)
if platformtools.dialog_yesno(config.get_localized_string(60038), config.get_localized_string(60015)):
run(Item(channel="setting", action="report_menu"))
def new_search(item, channel=None):
@@ -393,7 +384,7 @@ def set_search_temp(item):
filetools.write(temp_search_file, f)
def reorder_itemlist(itemlist):
logger.info()
logger.debug()
# logger.debug("Inlet itemlist size: %i" % len(itemlist))
new_list = []
@@ -431,7 +422,7 @@ def reorder_itemlist(itemlist):
new_list.extend(mod_list)
new_list.extend(not_mod_list)
logger.info("Modified Titles:%i |Unmodified:%i" % (modified, not_modified))
logger.debug("Modified Titles:%i |Unmodified:%i" % (modified, not_modified))
if len(new_list) == 0:
new_list = itemlist
@@ -441,7 +432,7 @@ def reorder_itemlist(itemlist):
def limit_itemlist(itemlist):
logger.info()
logger.debug()
# logger.debug("Inlet itemlist size: %i" % len(itemlist))
try:
@@ -474,7 +465,7 @@ def play_from_library(item):
itemlist=[]
item.fromLibrary = True
logger.info()
logger.debug()
# logger.debug("item: \n" + item.tostring('\n'))
# Try to reproduce an image (this does nothing and also does not give an error)