Scrape come Classe
This commit is contained in:
@@ -109,6 +109,7 @@ class autorenumber():
|
||||
self.selectspecials = False
|
||||
self.manual = False
|
||||
self.auto = False
|
||||
|
||||
if self.item:
|
||||
from core.videolibrarytools import check_renumber_options
|
||||
check_renumber_options(self.item)
|
||||
@@ -186,7 +187,7 @@ class autorenumber():
|
||||
if number in self.episodes:
|
||||
item.contentSeason = int(self.episodes[number].split('x')[0])
|
||||
item.contentEpisodeNumber = int(self.episodes[number].split('x')[1])
|
||||
|
||||
|
||||
# support.dbg()
|
||||
# for i in self.itemlist:
|
||||
# sub_thread(i)
|
||||
@@ -203,7 +204,7 @@ class autorenumber():
|
||||
self.epdict = {}
|
||||
self.group = self.renumberdict[self.title].get(GROUP, None)
|
||||
busy(True)
|
||||
itemlist = find_episodes(self.item)
|
||||
itemlist = self.itemlist if self.itemlist else find_episodes(self.item)
|
||||
|
||||
|
||||
if not self.group:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
from core import filetools, downloadtools, support
|
||||
from platformcode import config, platformtools, updater
|
||||
from platformcode import config, platformtools, updater, logger
|
||||
import xbmc, xbmcaddon, sys, platform
|
||||
|
||||
host = 'https://github.com'
|
||||
@@ -28,9 +28,9 @@ def download(item=None):
|
||||
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70782)):
|
||||
pform = get_platform()
|
||||
url = support.match(elementum_url, patronBlock=r'<div class="release-entry">(.*?)<!-- /.release-body -->', patron=r'<a href="([a-zA-Z0-9/\.-]+%s.zip)' % pform).match
|
||||
support.info('OS:', pform)
|
||||
support.info('Extract IN:', elementum_path)
|
||||
support.info('URL:', url)
|
||||
logger.debug('OS:', pform)
|
||||
logger.debug('Extract IN:', elementum_path)
|
||||
logger.debug('URL:', url)
|
||||
if url:
|
||||
downloadtools.downloadfile(host + url, filename)
|
||||
extract()
|
||||
@@ -44,19 +44,19 @@ def download(item=None):
|
||||
def extract():
|
||||
import zipfile
|
||||
from platformcode.updater import fixZipGetHash
|
||||
support.info('Estraggo Elementum in:', elementum_path)
|
||||
logger.debug('Estraggo Elementum in:', elementum_path)
|
||||
try:
|
||||
# hash = fixZipGetHash(filename)
|
||||
# support.info(hash)
|
||||
# logger.debug(hash)
|
||||
|
||||
with zipfile.ZipFile(filetools.file_open(filename, 'rb', vfs=False)) as zip_ref:
|
||||
zip_ref.extractall(xbmc.translatePath(addon_path))
|
||||
|
||||
except Exception as e:
|
||||
support.info('Non sono riuscito ad estrarre il file zip')
|
||||
support.logger.error(e)
|
||||
logger.debug('Non sono riuscito ad estrarre il file zip')
|
||||
logger.error(e)
|
||||
import traceback
|
||||
support.logger.error(traceback.print_exc())
|
||||
logger.error(traceback.print_exc())
|
||||
|
||||
|
||||
def setting():
|
||||
@@ -74,7 +74,7 @@ def setting():
|
||||
__settings__.setSetting('do_not_disturb', 'true')
|
||||
Continue = False
|
||||
except:
|
||||
support.info('RIPROVO')
|
||||
logger.debug('RIPROVO')
|
||||
xbmc.sleep(100)
|
||||
else:
|
||||
if not filetools.exists(elementum_path):
|
||||
|
||||
@@ -161,12 +161,21 @@ def run(item=None):
|
||||
if page and int(page) > -1:
|
||||
import xbmc
|
||||
item.action = item.real_action
|
||||
if item.page:
|
||||
item.page = page
|
||||
else:
|
||||
import re
|
||||
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url)
|
||||
item.page = page
|
||||
import re
|
||||
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url)
|
||||
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
||||
elif item.action == "gotoseason":
|
||||
head = 'Seleziona la stagione'
|
||||
seasons = [str(s) for s in item.allSeasons]
|
||||
season = platformtools.dialog_select(head, seasons, item.nextSeason - 1)
|
||||
if int(season) > -1:
|
||||
import xbmc
|
||||
item.action = item.real_action
|
||||
item.nextSeason = item.allSeasons.index(season + 1)
|
||||
run(item)
|
||||
# logger.debug(item)
|
||||
# xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], new_item.tourl()))
|
||||
else:
|
||||
# Checks if channel exists
|
||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
||||
|
||||
@@ -666,8 +666,8 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
return context_commands
|
||||
# Options according to criteria, only if the item is not a tag, nor is it "Add to the video library", etc...
|
||||
if item.action and item.action not in ["add_movie_to_library", "add_serie_to_library", "buscartrailer", "actualizar_titulos"]:
|
||||
if item.nextPage:
|
||||
context_commands.append((config.get_localized_string(70511), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=gotopage&real_action='+item.action)))
|
||||
# if item.nextPage:
|
||||
# context_commands.append((config.get_localized_string(70511), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=gotopage&real_action='+item.action)))
|
||||
# Show information: if the item has a plot, we assume that it is a series, season, chapter or movie
|
||||
# if item.infoLabels['plot'] and (num_version_xbmc < 17.0 or item.contentType == 'season'):
|
||||
# context_commands.append((config.get_localized_string(60348), "Action(Info)"))
|
||||
|
||||
Reference in New Issue
Block a user