- Fix Ricerca Globale in caso di Torrent
- Fix Wstream - Fix SupervVideo - Fix TVDB - IP diretto per alcuni siti - Altri Fix per Kodi 19
This commit is contained in:
@@ -51,7 +51,7 @@ def peliculas(item):
|
||||
|
||||
if item.args == 'search':
|
||||
patronBlock = r'<div class="search-page">(?P<block>.*?)<footer class="main">'
|
||||
patron = r'<img src="(?P<thumb>[^"]+)" alt="[^"]+" />[^>]+>(?P<type>[^<]+)</span>.*?<a href="(?P<url>[^"]+)">(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?</a>[^>]+>[^>]+>(?:<span class="rating">IMDb\s*(?P<rating>[^>]+)</span>)?.?(?:<span class="year">(?P<year>[0-9]+)</span>)?[^>]+>[^>]+><p>(?P<plot>.*?)</p>'
|
||||
patron = r'<img src="(?P<thumb>[^"]+)" alt="[^"]+" ?/?>[^>]+>(?P<type>[^<]+)</span>.*?<a href="(?P<url>[^"]+)">(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?</a>[^>]+>[^>]+>(?:<span class="rating">IMDb\s*(?P<rating>[^>]+)</span>)?.?(?:<span class="year">(?P<year>[0-9]+)</span>)?.*?<p>(?P<plot>.*?)</p>'
|
||||
|
||||
typeContentDict={'movie': ['film'], 'tvshow': ['tv']}
|
||||
typeActionDict={'findvideos': ['film'], 'episodios': ['tv']}
|
||||
|
||||
@@ -36,6 +36,20 @@ default_headers["Accept-Language"] = "it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3"
|
||||
default_headers["Accept-Charset"] = "UTF-8"
|
||||
default_headers["Accept-Encoding"] = "gzip"
|
||||
|
||||
# direct IP access for some hosts
|
||||
directIP = {
|
||||
'akki.monster': '31.220.1.77',
|
||||
'akvi.club': '31.220.1.77',
|
||||
'akvi.icu': '31.220.1.77',
|
||||
'akvideo.stream': '31.220.1.77',
|
||||
'vcrypt.net': '31.220.1.77',
|
||||
'vcrypt.pw': '31.220.1.77',
|
||||
'vidtome.host': '94.75.219.1"',
|
||||
'nored.icu': '31.220.1.77',
|
||||
'wstream.icu': '31.220.1.77',
|
||||
'wstream.video': '31.220.1.77',
|
||||
}
|
||||
|
||||
# Maximum wait time for downloadpage, if nothing is specified
|
||||
HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = config.get_setting('httptools_timeout', default=15)
|
||||
if HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT == 0: HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = None
|
||||
@@ -267,7 +281,9 @@ def downloadpage(url, **opt):
|
||||
|
||||
"""
|
||||
url = scrapertools.unescape(url)
|
||||
domain = urlparse.urlparse(url).netloc
|
||||
parse = urlparse.urlparse(url)
|
||||
domain = parse.netloc
|
||||
|
||||
from lib import requests
|
||||
session = requests.session()
|
||||
|
||||
@@ -284,6 +300,10 @@ def downloadpage(url, **opt):
|
||||
else:
|
||||
req_headers = dict(opt['headers'])
|
||||
|
||||
if domain in directIP.keys() and not opt.get('disable_directIP', False):
|
||||
req_headers['Host'] = domain
|
||||
url = urlparse.urlunparse(parse._replace(netloc=directIP.get(domain)))
|
||||
|
||||
if opt.get('random_headers', False) or HTTPTOOLS_DEFAULT_RANDOM_HEADERS:
|
||||
req_headers['User-Agent'] = random_useragent()
|
||||
url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]")
|
||||
|
||||
@@ -523,7 +523,7 @@ def scrape(func):
|
||||
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
|
||||
if patronNext and inspect.stack()[1][3] not in ['newest'] and inspect.stack()[2][3] not in ['get_channel_results']:
|
||||
if patronNext and inspect.stack()[1][3] not in ['newest'] and len(inspect.stack()) > 2 and inspect.stack()[2][3] not in ['get_channel_results']:
|
||||
nextPage(itemlist, item, data, patronNext, function)
|
||||
|
||||
# if function == 'episodios':
|
||||
|
||||
@@ -25,10 +25,10 @@ BASE_URL_TRANSLATE = 'https://translate.google.com/translate?hl=it&sl=en&tl=it&u
|
||||
|
||||
|
||||
def checker_url(html, url):
|
||||
grep_regex = re.findall(r'href="|src="|value="|((?:http[s]://|ftp[s]://)+\.*([-a-zA-Z0-9\.]+)([-a-zA-Z0-9\.]){1,}([-a-zA-Z0-9_\.\#\@\:%_/\?\=\~\&\-\//\!\'\;\(\)\s\^\:blank:\:punct:\:xdigit:\:space:\$]+))', html) # noqa: E501
|
||||
grep_regex = re.findall(r'(?:href="|src="|value=")([^"]+)', html) # noqa: E501
|
||||
for url_result_regex in grep_regex:
|
||||
if url in url_result_regex[0]:
|
||||
return url_result_regex[0].replace('&', '&')
|
||||
if url in url_result_regex:
|
||||
return url_result_regex.replace('&', '&')
|
||||
|
||||
|
||||
def process_request_proxy(url):
|
||||
@@ -60,7 +60,7 @@ def process_request_proxy(url):
|
||||
)
|
||||
|
||||
url_request_proxy = checker_url(
|
||||
request_final.text, BASE_URL_PROXY + '/translate_c?depth=1')
|
||||
request_final.text, 'translate.google')
|
||||
|
||||
logger.debug(url_request_proxy)
|
||||
|
||||
|
||||
@@ -493,7 +493,8 @@ class UnshortenIt(object):
|
||||
return uri, str(e)
|
||||
|
||||
def _unshorten_vcrypt(self, uri):
|
||||
uri = uri.replace('.net', '.pw')
|
||||
httptools.set_cookies({'domain': 'vcrypt.net', 'name': 'saveMe', 'value': '1'})
|
||||
httptools.set_cookies({'domain': 'vcrypt.pw', 'name': 'saveMe', 'value': '1'})
|
||||
try:
|
||||
headers = {}
|
||||
if 'myfoldersakstream.php' in uri or '/verys/' in uri:
|
||||
@@ -531,9 +532,9 @@ class UnshortenIt(object):
|
||||
spl = uri.split('/')
|
||||
spl[3] += '1'
|
||||
if spl[3] == 'wss1':
|
||||
spl[4] = b64encode(spl[4])
|
||||
spl[4] = b64encode(spl[4].encode('utf-8')).decode('utf-8')
|
||||
uri = '/'.join(spl)
|
||||
r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False)
|
||||
r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False, verify=False)
|
||||
if 'Wait 1 hour' in r.data:
|
||||
uri = ''
|
||||
logger.error('IP bannato da vcrypt, aspetta un ora')
|
||||
@@ -543,7 +544,6 @@ class UnshortenIt(object):
|
||||
if uri == prev_uri:
|
||||
logger.info('Use Cloudscraper')
|
||||
uri = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False, cf=True).headers['location']
|
||||
# from core.support import dbg;dbg()
|
||||
if "snip." in uri:
|
||||
if 'out_generator' in uri:
|
||||
uri = re.findall('url=(.*)$', uri)[0]
|
||||
@@ -552,7 +552,7 @@ class UnshortenIt(object):
|
||||
splitted = path.split('/')
|
||||
splitted[1] = 'outlink'
|
||||
new_uri = httptools.downloadpage(uri, follow_redirects=False, post={'url': splitted[2]}).headers['location']
|
||||
if new_uri != uri:
|
||||
if new_uri and new_uri != uri:
|
||||
uri = new_uri
|
||||
else:
|
||||
uri = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment, follow_redirects=False, post={'url': splitted[2]}).headers['location']
|
||||
|
||||
@@ -310,6 +310,396 @@ class autorenumber():
|
||||
|
||||
|
||||
def SelectreNumeration(opt, itemlist, manual=False):
|
||||
class SelectreNumerationWindow(xbmcgui.WindowXMLDialog):
|
||||
def start(self, opt):
|
||||
self.episodes = opt.Episodes if opt.Episodes else {}
|
||||
self.dictSeries = opt.dictSeries
|
||||
self.item = opt.item
|
||||
self.title = opt.title
|
||||
self.season = opt.s
|
||||
self.episode = opt.e
|
||||
self.mode = opt.Mode
|
||||
self.sp = opt.sp
|
||||
self.manual = opt.manual
|
||||
self.offset = 0
|
||||
self.Exit = False
|
||||
|
||||
self.itemlist = opt.itemlist
|
||||
self.count = 1
|
||||
self.specials = {}
|
||||
self.items = []
|
||||
self.selected = []
|
||||
self.seasons = {}
|
||||
|
||||
self.doModal()
|
||||
return self.season, self.episode, self.mode, self.specials, self.seasons, self.Exit
|
||||
|
||||
def onInit(self):
|
||||
# Compatibility with Kodi 18
|
||||
if config.get_platform(True)['num_version'] < 18: self.setCoordinateResolution(2)
|
||||
fanart = self.item.fanart
|
||||
thumb = self.item.thumbnail
|
||||
self.getControl(SELECT).setVisible(False)
|
||||
self.getControl(SPECIALS).setVisible(False)
|
||||
self.getControl(MANUAL).setVisible(False)
|
||||
# MANUAL
|
||||
if self.manual:
|
||||
self.getControl(MANUAL).setVisible(True)
|
||||
self.getControl(MPOSTER).setImage(thumb)
|
||||
if fanart: self.getControl(MBACKGROUND).setImage(fanart)
|
||||
self.getControl(INFO).setLabel(typo(config.get_localized_string(70822) + self.title, 'bold'))
|
||||
|
||||
self.mode = True
|
||||
|
||||
se = '1'
|
||||
ep = '1'
|
||||
position = 0
|
||||
for i, item in enumerate(self.itemlist):
|
||||
title = match(item.title, patron=r'(\d+)').match.lstrip('0')
|
||||
it = xbmcgui.ListItem(title)
|
||||
if int(title) <= len(self.episodes):
|
||||
se, ep = self.episodes[title].split('x')
|
||||
else:
|
||||
if position == 0: position = i
|
||||
ep = str(int(ep) + 1)
|
||||
it.setProperties({'season': se, "episode": ep})
|
||||
self.items.append(it)
|
||||
self.makerenumber()
|
||||
self.addseasons()
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
self.getControl(MLIST).addItems(self.items)
|
||||
self.setFocusId(MLIST)
|
||||
self.getControl(MLIST).selectItem(position)
|
||||
# MAIN / SPECIALS
|
||||
else:
|
||||
for item in self.itemlist:
|
||||
if not match(item.title, patron=r'[Ss]?(\d+)(?:x|_|\s+)[Ee]?[Pp]?(\d+)').match:
|
||||
title = match(item.title, patron=r'(\d+)').match.lstrip('0')
|
||||
it = xbmcgui.ListItem(title)
|
||||
self.items.append(it)
|
||||
|
||||
self.getControl(POSTER).setImage(thumb)
|
||||
self.getControl(MPOSTER).setImage(thumb)
|
||||
if fanart:
|
||||
self.getControl(BACKGROUND).setImage(fanart)
|
||||
self.getControl(MBACKGROUND).setImage(fanart)
|
||||
self.getControl(INFO).setLabel(typo(config.get_localized_string(70824) + self.title, 'bold'))
|
||||
self.getControl(LIST).addItems(self.items)
|
||||
|
||||
if self.sp:
|
||||
self.getControl(SPECIALS).setVisible(True)
|
||||
self.setFocusId(OK)
|
||||
else:
|
||||
self.getControl(SELECT).setVisible(True)
|
||||
|
||||
self.getControl(S).setLabel(str(self.season))
|
||||
self.getControl(E).setLabel(str(self.episode))
|
||||
|
||||
self.setFocusId(O)
|
||||
|
||||
def onFocus(self, focus):
|
||||
if focus in [S]:
|
||||
self.getControl(108).setLabel(typo(config.get_localized_string(70825), 'bold'))
|
||||
elif focus in [E]:
|
||||
self.getControl(108).setLabel(typo(config.get_localized_string(70826), 'bold'))
|
||||
elif focus in [O]:
|
||||
self.getControl(108).setLabel(typo(config.get_localized_string(70001), 'bold'))
|
||||
elif focus in [SS]:
|
||||
self.getControl(108).setLabel(typo(config.get_localized_string(70827), 'bold'))
|
||||
elif focus in [M]:
|
||||
self.getControl(108).setLabel(typo(config.get_localized_string(70828), 'bold'))
|
||||
elif focus in [D]:
|
||||
self.getControl(108).setLabel(typo(config.get_localized_string(70829) + self.title, 'bold'))
|
||||
elif focus in [C]:
|
||||
self.getControl(108).setLabel(typo(config.get_localized_string(70002), 'bold'))
|
||||
|
||||
def onAction(self, action):
|
||||
action = action.getId()
|
||||
focus = self.getFocusId()
|
||||
# SEASON SELECT
|
||||
if 100 < focus < 200:
|
||||
s = int(self.getControl(S).getLabel())
|
||||
e = int(self.getControl(E).getLabel())
|
||||
if action in [RIGHT]:
|
||||
if focus in [C]:
|
||||
self.setFocusId(S)
|
||||
else:
|
||||
self.setFocusId(focus + 1)
|
||||
elif action in [LEFT]:
|
||||
if focus in [S]:
|
||||
self.setFocusId(C)
|
||||
else:
|
||||
self.setFocusId(focus - 1)
|
||||
elif action in [UP]:
|
||||
if focus in [S]:
|
||||
s += 1
|
||||
self.getControl(S).setLabel(str(s))
|
||||
elif focus in [E]:
|
||||
e += 1
|
||||
self.getControl(E).setLabel(str(e))
|
||||
elif action in [DOWN]:
|
||||
if focus in [S]:
|
||||
if s > 0: s -= 1
|
||||
self.getControl(S).setLabel(str(s))
|
||||
elif focus in [E]:
|
||||
if e > 0: e -= 1
|
||||
self.getControl(E).setLabel(str(e))
|
||||
# MANUAL
|
||||
if focus in [MS, ME]:
|
||||
s = int(self.getControl(MLIST).getSelectedItem().getProperty('season'))
|
||||
e = int(self.getControl(MLIST).getSelectedItem().getProperty('episode'))
|
||||
pos = self.getControl(MLIST).getSelectedPosition()
|
||||
# Set Season
|
||||
if focus in [MS] and action in [UP]:
|
||||
s += 1
|
||||
elif focus in [MS] and action in [DOWN] and s > 0:
|
||||
s -= 1
|
||||
# Set Episode
|
||||
if focus in [ME] and action in [UP]:
|
||||
e += 1
|
||||
elif focus in [ME] and action in [DOWN] and e > 0:
|
||||
e -= 1
|
||||
if action in [UP, DOWN]:
|
||||
if s != self.season: e = 1
|
||||
self.season = s
|
||||
self.episode = e
|
||||
self.makerenumber(pos)
|
||||
self.addseasons()
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
self.getControl(MLIST).reset()
|
||||
self.getControl(MLIST).addItems(self.items)
|
||||
self.getControl(MLIST).selectItem(pos)
|
||||
if focus in [MSEASONS]:
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
|
||||
# EXIT
|
||||
if action in [EXIT, BACKSPACE]:
|
||||
self.Exit = True
|
||||
self.close()
|
||||
|
||||
def onClick(self, control_id):
|
||||
## FIRST SECTION
|
||||
if control_id in [S]:
|
||||
selected = platformtools.dialog_numeric(0, config.get_localized_string(70825),
|
||||
self.getControl(S).getLabel())
|
||||
if selected: s = self.getControl(S).setLabel(selected)
|
||||
elif control_id in [E]:
|
||||
selected = platformtools.dialog_numeric(0, config.get_localized_string(70826),
|
||||
self.getControl(E).getLabel())
|
||||
if selected: e = self.getControl(E).setLabel(selected)
|
||||
# OPEN SPECIALS OR OK
|
||||
if control_id in [O, SS]:
|
||||
s = self.getControl(S).getLabel()
|
||||
e = self.getControl(E).getLabel()
|
||||
self.season = int(s)
|
||||
self.episode = int(e)
|
||||
if control_id in [O]:
|
||||
self.close()
|
||||
elif control_id in [SS]:
|
||||
self.getControl(SELECT).setVisible(False)
|
||||
self.getControl(SPECIALS).setVisible(True)
|
||||
self.setFocusId(OK)
|
||||
# OPEN MANUAL
|
||||
elif control_id in [M]:
|
||||
self.getControl(INFO).setLabel(typo(config.get_localized_string(70823) + self.title, 'bold'))
|
||||
self.mode = True
|
||||
if self.episodes:
|
||||
items = []
|
||||
se = '1'
|
||||
ep = '1'
|
||||
for item in self.items:
|
||||
if int(item.getLabel()) <= len(self.episodes) - 1:
|
||||
se, ep = self.episodes[item.getLabel()].split('x')
|
||||
else:
|
||||
ep = str(int(ep) + 1)
|
||||
item.setProperties({'season': se, "episode": ep})
|
||||
items.append(item)
|
||||
self.seasons[item.getLabel()] = '%sx%s' % (se, ep)
|
||||
self.items = items
|
||||
else:
|
||||
self.makerenumber()
|
||||
self.addseasons()
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
self.getControl(MLIST).addItems(self.items)
|
||||
self.getControl(SELECT).setVisible(False)
|
||||
self.getControl(MANUAL).setVisible(True)
|
||||
self.setFocusId(OK)
|
||||
# CLOSE
|
||||
elif control_id in [C]:
|
||||
self.Exit = True
|
||||
self.close()
|
||||
# DELETE
|
||||
if control_id in [D]:
|
||||
self.Exit = True
|
||||
self.dictSeries.pop(self.title)
|
||||
write(self.item, self.dictSeries)
|
||||
self.close()
|
||||
|
||||
## SPECIAL SECTION
|
||||
# ADD TO SPECIALS
|
||||
p1 = self.getControl(SELECTED).getSelectedPosition()
|
||||
if control_id in [LIST]:
|
||||
item = self.getControl(LIST).getSelectedItem()
|
||||
it = xbmcgui.ListItem(str(len(self.selected) + 1))
|
||||
it.setProperty('title', item.getLabel())
|
||||
self.selected.append(it)
|
||||
index = self.getControl(SELECTED).getSelectedPosition()
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
self.getControl(SELECTED).selectItem(index)
|
||||
|
||||
index = self.getControl(LIST).getSelectedPosition()
|
||||
self.items.pop(index)
|
||||
self.getControl(LIST).reset()
|
||||
self.getControl(LIST).addItems(self.items)
|
||||
if index == len(self.items): index -= 1
|
||||
self.getControl(LIST).selectItem(index)
|
||||
# MOVE SPECIALS
|
||||
elif control_id in [SU]:
|
||||
p2 = p1 - 1
|
||||
if p2 > -1:
|
||||
self.selected[p1], self.selected[p2] = self.selected[p2], self.selected[p1]
|
||||
for i, it in enumerate(self.selected):
|
||||
it.setLabel(str(i + 1))
|
||||
break
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
self.getControl(SELECTED).selectItem(p2)
|
||||
|
||||
elif control_id in [SD]:
|
||||
p2 = p1 + 1
|
||||
if p2 < len(self.selected):
|
||||
self.selected[p1], self.selected[p2] = self.selected[p2], self.selected[p1]
|
||||
for i, it in enumerate(self.selected):
|
||||
it.setLabel(str(i + 1))
|
||||
break
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
self.getControl(SELECTED).selectItem(p2)
|
||||
# REMOVE FROM SPECIALS
|
||||
elif control_id in [SR]:
|
||||
item = self.getControl(SELECTED).getSelectedItem()
|
||||
it = xbmcgui.ListItem(item.getProperty('title'))
|
||||
if int(item.getProperty('title')) < int(self.items[-1].getLabel()):
|
||||
for i, itm in enumerate(self.items):
|
||||
if int(itm.getLabel()) > int(item.getProperty('title')):
|
||||
self.items.insert(i, it)
|
||||
break
|
||||
else:
|
||||
self.items.append(it)
|
||||
self.getControl(LIST).reset()
|
||||
self.getControl(LIST).addItems(self.items)
|
||||
index = self.getControl(SELECTED).getSelectedPosition()
|
||||
self.selected.pop(index)
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
|
||||
if index == len(self.selected): index -= 1
|
||||
self.getControl(SELECTED).selectItem(index)
|
||||
# RELOAD SPECIALS
|
||||
if control_id in [SELECTED]:
|
||||
epnumber = platformtools.dialog_numeric(0, config.get_localized_string(60386))
|
||||
it = self.getControl(SELECTED).getSelectedItem()
|
||||
it.setLabel(str(epnumber))
|
||||
self.selected.sort(key=lambda it: int(it.getLabel()))
|
||||
for i, it in enumerate(self.selected):
|
||||
if it.getLabel() == epnumber: pos = i
|
||||
self.selected.sort(key=lambda it: int(it.getLabel()))
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
self.getControl(SELECTED).selectItem(pos)
|
||||
break
|
||||
if len(self.selected) > 0:
|
||||
self.getControl(SPECIALCOMMANDS).setVisible(True)
|
||||
else:
|
||||
self.getControl(SPECIALCOMMANDS).setVisible(False)
|
||||
|
||||
## MANUAL SECTION
|
||||
# SELECT SEASON EPISODE (MANUAL)
|
||||
if control_id in [MS, ME]:
|
||||
s = int(self.getControl(MLIST).getSelectedItem().getProperty('season'))
|
||||
e = int(self.getControl(MLIST).getSelectedItem().getProperty('episode'))
|
||||
pos = self.getControl(MLIST).getSelectedPosition()
|
||||
if control_id in [MS]:
|
||||
selected = platformtools.dialog_numeric(0, config.get_localized_string(70825), str(s))
|
||||
if selected: s = int(selected)
|
||||
elif control_id in [ME]:
|
||||
selected = platformtools.dialog_numeric(0, config.get_localized_string(70826), str(e))
|
||||
if selected: e = int(selected)
|
||||
if s != self.season or e != self.episode:
|
||||
self.season = s
|
||||
self.episode = 1 if s != self.season else e
|
||||
self.makerenumber(pos)
|
||||
self.addseasons()
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
self.getControl(MLIST).reset()
|
||||
self.getControl(MLIST).addItems(self.items)
|
||||
self.getControl(MLIST).selectItem(pos)
|
||||
# OK
|
||||
if control_id in [OK]:
|
||||
for it in self.selected:
|
||||
self.specials[int(it.getProperty('title'))] = '0x' + it.getLabel()
|
||||
self.close()
|
||||
# CLOSE
|
||||
elif control_id in [CLOSE]:
|
||||
self.Exit = True
|
||||
self.close()
|
||||
|
||||
def makerenumber(self, pos=0):
|
||||
items = []
|
||||
currentSeason = self.items[pos].getProperty('season')
|
||||
previousSeason = self.items[pos - 1 if pos > 0 else 0].getProperty('season')
|
||||
prevEpisode = self.items[pos - 1 if pos > 0 else 0].getProperty('episode')
|
||||
if currentSeason != str(self.season):
|
||||
if str(self.season) == previousSeason:
|
||||
prevEpisode = int(prevEpisode) + 1
|
||||
else:
|
||||
prevEpisode = 1
|
||||
else:
|
||||
prevEpisode = self.episode
|
||||
|
||||
for i, item in enumerate(self.items):
|
||||
if (i >= pos and item.getProperty('season') == currentSeason) or not item.getProperty('season'):
|
||||
if i > pos: prevEpisode += 1
|
||||
item.setProperties({'season': self.season, 'episode': prevEpisode})
|
||||
items.append(item)
|
||||
self.seasons[item.getLabel()] = '%sx%s' % (item.getProperty('season'), item.getProperty('episode'))
|
||||
self.items = items
|
||||
logger.debug('SELF', self.seasons)
|
||||
|
||||
def addseasons(self):
|
||||
seasonlist = []
|
||||
seasons = []
|
||||
self.episodes = {}
|
||||
for ep, value in self.seasons.items():
|
||||
season = value.split('x')[0]
|
||||
if season not in seasonlist:
|
||||
item = xbmcgui.ListItem(season)
|
||||
seasonlist.append(season)
|
||||
seasons.append(item)
|
||||
if season in seasonlist:
|
||||
if season not in self.episodes:
|
||||
self.episodes[season] = []
|
||||
item = xbmcgui.ListItem('%s - Ep. %s' % (value, ep))
|
||||
item.setProperty('episode', ep)
|
||||
self.episodes[season].append(item)
|
||||
logger.log('EPISODES', self.episodes[season])
|
||||
self.episodes[season].sort(key=lambda it: int(it.getProperty('episode')))
|
||||
|
||||
seasons.sort(key=lambda it: int(it.getLabel()))
|
||||
self.getControl(MSEASONS).reset()
|
||||
self.getControl(MSEASONS).addItems(seasons)
|
||||
|
||||
opt.itemlist = itemlist
|
||||
opt.manual = manual
|
||||
return SelectreNumerationWindow('Renumber.xml', path).start(opt)
|
||||
@@ -365,375 +755,3 @@ EXIT = 10
|
||||
BACKSPACE = 92
|
||||
|
||||
path = config.get_runtime_path()
|
||||
|
||||
class SelectreNumerationWindow(xbmcgui.WindowXMLDialog):
|
||||
def start(self, opt):
|
||||
self.episodes = opt.Episodes if opt.Episodes else {}
|
||||
self.dictSeries = opt.dictSeries
|
||||
self.item = opt.item
|
||||
self.title = opt.title
|
||||
self.season = opt.s
|
||||
self.episode = opt.e
|
||||
self.mode = opt.Mode
|
||||
self.sp = opt.sp
|
||||
self.manual = opt.manual
|
||||
self.offset = 0
|
||||
self.Exit = False
|
||||
|
||||
self.itemlist = opt.itemlist
|
||||
self.count = 1
|
||||
self.specials = {}
|
||||
self.items = []
|
||||
self.selected = []
|
||||
self.seasons = {}
|
||||
|
||||
self.doModal()
|
||||
return self.season, self.episode, self.mode, self.specials, self.seasons, self.Exit
|
||||
|
||||
def onInit(self):
|
||||
# Compatibility with Kodi 18
|
||||
if config.get_platform(True)['num_version'] < 18: self.setCoordinateResolution(2)
|
||||
fanart = self.item.fanart
|
||||
thumb = self.item.thumbnail
|
||||
self.getControl(SELECT).setVisible(False)
|
||||
self.getControl(SPECIALS).setVisible(False)
|
||||
self.getControl(MANUAL).setVisible(False)
|
||||
# MANUAL
|
||||
if self.manual:
|
||||
self.getControl(MANUAL).setVisible(True)
|
||||
self.getControl(MPOSTER).setImage(thumb)
|
||||
if fanart: self.getControl(MBACKGROUND).setImage(fanart)
|
||||
self.getControl(INFO).setLabel(typo(config.get_localized_string(70822) + self.title,'bold'))
|
||||
|
||||
self.mode = True
|
||||
|
||||
se = '1'
|
||||
ep = '1'
|
||||
position = 0
|
||||
for i, item in enumerate(self.itemlist):
|
||||
title = match(item.title, patron=r'(\d+)').match.lstrip('0')
|
||||
it = xbmcgui.ListItem(title)
|
||||
if int(title) <= len(self.episodes):
|
||||
se, ep = self.episodes[title].split('x')
|
||||
else:
|
||||
if position == 0: position = i
|
||||
ep = str(int(ep) + 1)
|
||||
it.setProperties({'season':se, "episode":ep})
|
||||
self.items.append(it)
|
||||
self.makerenumber()
|
||||
self.addseasons()
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
self.getControl(MLIST).addItems(self.items)
|
||||
self.setFocusId(MLIST)
|
||||
self.getControl(MLIST).selectItem(position)
|
||||
# MAIN / SPECIALS
|
||||
else:
|
||||
for item in self.itemlist:
|
||||
if not match(item.title, patron=r'[Ss]?(\d+)(?:x|_|\s+)[Ee]?[Pp]?(\d+)').match:
|
||||
title = match(item.title, patron=r'(\d+)').match.lstrip('0')
|
||||
it = xbmcgui.ListItem(title)
|
||||
self.items.append(it)
|
||||
|
||||
self.getControl(POSTER).setImage(thumb)
|
||||
self.getControl(MPOSTER).setImage(thumb)
|
||||
if fanart:
|
||||
self.getControl(BACKGROUND).setImage(fanart)
|
||||
self.getControl(MBACKGROUND).setImage(fanart)
|
||||
self.getControl(INFO).setLabel(typo(config.get_localized_string(70824) + self.title, 'bold'))
|
||||
self.getControl(LIST).addItems(self.items)
|
||||
|
||||
if self.sp:
|
||||
self.getControl(SPECIALS).setVisible(True)
|
||||
self.setFocusId(OK)
|
||||
else:
|
||||
self.getControl(SELECT).setVisible(True)
|
||||
|
||||
self.getControl(S).setLabel(str(self.season))
|
||||
self.getControl(E).setLabel(str(self.episode))
|
||||
|
||||
self.setFocusId(O)
|
||||
|
||||
def onFocus(self, focus):
|
||||
if focus in [S]: self.getControl(108).setLabel(typo(config.get_localized_string(70825), 'bold'))
|
||||
elif focus in [E]: self.getControl(108).setLabel(typo(config.get_localized_string(70826), 'bold'))
|
||||
elif focus in [O]: self.getControl(108).setLabel(typo(config.get_localized_string(70001), 'bold'))
|
||||
elif focus in [SS]: self.getControl(108).setLabel(typo(config.get_localized_string(70827), 'bold'))
|
||||
elif focus in [M]: self.getControl(108).setLabel(typo(config.get_localized_string(70828), 'bold'))
|
||||
elif focus in [D]: self.getControl(108).setLabel(typo(config.get_localized_string(70829) + self.title, 'bold'))
|
||||
elif focus in [C]: self.getControl(108).setLabel(typo(config.get_localized_string(70002), 'bold'))
|
||||
|
||||
|
||||
def onAction(self, action):
|
||||
action = action.getId()
|
||||
focus = self.getFocusId()
|
||||
# SEASON SELECT
|
||||
if 100 < focus < 200:
|
||||
s = int(self.getControl(S).getLabel())
|
||||
e = int(self.getControl(E).getLabel())
|
||||
if action in [RIGHT]:
|
||||
if focus in [C]: self.setFocusId(S)
|
||||
else: self.setFocusId(focus + 1)
|
||||
elif action in [LEFT]:
|
||||
if focus in [S]: self.setFocusId(C)
|
||||
else: self.setFocusId(focus - 1)
|
||||
elif action in [UP]:
|
||||
if focus in [S]:
|
||||
s += 1
|
||||
self.getControl(S).setLabel(str(s))
|
||||
elif focus in [E]:
|
||||
e += 1
|
||||
self.getControl(E).setLabel(str(e))
|
||||
elif action in [DOWN]:
|
||||
if focus in [S]:
|
||||
if s > 0: s -= 1
|
||||
self.getControl(S).setLabel(str(s))
|
||||
elif focus in [E]:
|
||||
if e > 0: e -= 1
|
||||
self.getControl(E).setLabel(str(e))
|
||||
# MANUAL
|
||||
if focus in [MS, ME]:
|
||||
s = int(self.getControl(MLIST).getSelectedItem().getProperty('season'))
|
||||
e = int(self.getControl(MLIST).getSelectedItem().getProperty('episode'))
|
||||
pos = self.getControl(MLIST).getSelectedPosition()
|
||||
# Set Season
|
||||
if focus in [MS] and action in [UP]: s += 1
|
||||
elif focus in [MS] and action in [DOWN] and s > 0: s -= 1
|
||||
# Set Episode
|
||||
if focus in [ME] and action in [UP]: e += 1
|
||||
elif focus in [ME] and action in [DOWN] and e > 0: e -= 1
|
||||
if action in [UP, DOWN]:
|
||||
if s != self.season: e = 1
|
||||
self.season = s
|
||||
self.episode = e
|
||||
self.makerenumber(pos)
|
||||
self.addseasons()
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
self.getControl(MLIST).reset()
|
||||
self.getControl(MLIST).addItems(self.items)
|
||||
self.getControl(MLIST).selectItem(pos)
|
||||
if focus in [MSEASONS]:
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
|
||||
# EXIT
|
||||
if action in [EXIT, BACKSPACE]:
|
||||
self.Exit = True
|
||||
self.close()
|
||||
|
||||
def onClick(self, control_id):
|
||||
## FIRST SECTION
|
||||
if control_id in [S]:
|
||||
selected = platformtools.dialog_numeric(0, config.get_localized_string(70825), self.getControl(S).getLabel())
|
||||
if selected: s = self.getControl(S).setLabel(selected)
|
||||
elif control_id in [E]:
|
||||
selected = platformtools.dialog_numeric(0, config.get_localized_string(70826), self.getControl(E).getLabel())
|
||||
if selected: e = self.getControl(E).setLabel(selected)
|
||||
# OPEN SPECIALS OR OK
|
||||
if control_id in [O, SS]:
|
||||
s = self.getControl(S).getLabel()
|
||||
e = self.getControl(E).getLabel()
|
||||
self.season = int(s)
|
||||
self.episode = int(e)
|
||||
if control_id in [O]:
|
||||
self.close()
|
||||
elif control_id in [SS]:
|
||||
self.getControl(SELECT).setVisible(False)
|
||||
self.getControl(SPECIALS).setVisible(True)
|
||||
self.setFocusId(OK)
|
||||
# OPEN MANUAL
|
||||
elif control_id in [M]:
|
||||
self.getControl(INFO).setLabel(typo(config.get_localized_string(70823) + self.title, 'bold'))
|
||||
self.mode = True
|
||||
if self.episodes:
|
||||
items = []
|
||||
se = '1'
|
||||
ep = '1'
|
||||
for item in self.items:
|
||||
if int(item.getLabel()) <= len(self.episodes) - 1:
|
||||
se, ep = self.episodes[item.getLabel()].split('x')
|
||||
else:
|
||||
ep = str(int(ep) + 1)
|
||||
item.setProperties({'season':se, "episode":ep})
|
||||
items.append(item)
|
||||
self.seasons[item.getLabel()] = '%sx%s' %(se, ep)
|
||||
self.items = items
|
||||
else:
|
||||
self.makerenumber()
|
||||
self.addseasons()
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
self.getControl(MLIST).addItems(self.items)
|
||||
self.getControl(SELECT).setVisible(False)
|
||||
self.getControl(MANUAL).setVisible(True)
|
||||
self.setFocusId(OK)
|
||||
# CLOSE
|
||||
elif control_id in [C]:
|
||||
self.Exit = True
|
||||
self.close()
|
||||
# DELETE
|
||||
if control_id in [D]:
|
||||
self.Exit = True
|
||||
self.dictSeries.pop(self.title)
|
||||
write(self.item, self.dictSeries)
|
||||
self.close()
|
||||
|
||||
## SPECIAL SECTION
|
||||
# ADD TO SPECIALS
|
||||
p1 = self.getControl(SELECTED).getSelectedPosition()
|
||||
if control_id in [LIST]:
|
||||
item = self.getControl(LIST).getSelectedItem()
|
||||
it = xbmcgui.ListItem(str(len(self.selected) + 1))
|
||||
it.setProperty('title', item.getLabel())
|
||||
self.selected.append(it)
|
||||
index = self.getControl(SELECTED).getSelectedPosition()
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
self.getControl(SELECTED).selectItem(index)
|
||||
|
||||
index = self.getControl(LIST).getSelectedPosition()
|
||||
self.items.pop(index)
|
||||
self.getControl(LIST).reset()
|
||||
self.getControl(LIST).addItems(self.items)
|
||||
if index == len(self.items): index -= 1
|
||||
self.getControl(LIST).selectItem(index)
|
||||
# MOVE SPECIALS
|
||||
elif control_id in [SU]:
|
||||
p2 = p1 - 1
|
||||
if p2 > -1:
|
||||
self.selected[p1], self.selected[p2] = self.selected[p2], self.selected[p1]
|
||||
for i, it in enumerate(self.selected):
|
||||
it.setLabel(str(i+1))
|
||||
break
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
self.getControl(SELECTED).selectItem(p2)
|
||||
|
||||
elif control_id in [SD]:
|
||||
p2 = p1 + 1
|
||||
if p2 < len(self.selected):
|
||||
self.selected[p1], self.selected[p2] = self.selected[p2], self.selected[p1]
|
||||
for i, it in enumerate(self.selected):
|
||||
it.setLabel(str(i+1))
|
||||
break
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
self.getControl(SELECTED).selectItem(p2)
|
||||
# REMOVE FROM SPECIALS
|
||||
elif control_id in [SR]:
|
||||
item = self.getControl(SELECTED).getSelectedItem()
|
||||
it = xbmcgui.ListItem(item.getProperty('title'))
|
||||
if int(item.getProperty('title')) < int(self.items[-1].getLabel()):
|
||||
for i, itm in enumerate(self.items):
|
||||
if int(itm.getLabel()) > int(item.getProperty('title')):
|
||||
self.items.insert(i, it)
|
||||
break
|
||||
else:
|
||||
self.items.append(it)
|
||||
self.getControl(LIST).reset()
|
||||
self.getControl(LIST).addItems(self.items)
|
||||
index = self.getControl(SELECTED).getSelectedPosition()
|
||||
self.selected.pop(index)
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
|
||||
if index == len(self.selected): index -= 1
|
||||
self.getControl(SELECTED).selectItem(index)
|
||||
# RELOAD SPECIALS
|
||||
if control_id in [SELECTED]:
|
||||
epnumber = platformtools.dialog_numeric(0, config.get_localized_string(60386))
|
||||
it = self.getControl(SELECTED).getSelectedItem()
|
||||
it.setLabel(str(epnumber))
|
||||
self.selected.sort(key=lambda it: int(it.getLabel()))
|
||||
for i, it in enumerate(self.selected):
|
||||
if it.getLabel() == epnumber: pos = i
|
||||
self.selected.sort(key=lambda it: int(it.getLabel()))
|
||||
self.getControl(SELECTED).reset()
|
||||
self.getControl(SELECTED).addItems(self.selected)
|
||||
self.getControl(SELECTED).selectItem(pos)
|
||||
break
|
||||
if len(self.selected) > 0: self.getControl(SPECIALCOMMANDS).setVisible(True)
|
||||
else: self.getControl(SPECIALCOMMANDS).setVisible(False)
|
||||
|
||||
## MANUAL SECTION
|
||||
# SELECT SEASON EPISODE (MANUAL)
|
||||
if control_id in [MS, ME]:
|
||||
s = int(self.getControl(MLIST).getSelectedItem().getProperty('season'))
|
||||
e = int(self.getControl(MLIST).getSelectedItem().getProperty('episode'))
|
||||
pos = self.getControl(MLIST).getSelectedPosition()
|
||||
if control_id in [MS]:
|
||||
selected = platformtools.dialog_numeric(0, config.get_localized_string(70825), str(s))
|
||||
if selected: s = int(selected)
|
||||
elif control_id in [ME]:
|
||||
selected = platformtools.dialog_numeric(0, config.get_localized_string(70826), str(e))
|
||||
if selected: e = int(selected)
|
||||
if s != self.season or e != self.episode:
|
||||
self.season = s
|
||||
self.episode = 1 if s != self.season else e
|
||||
self.makerenumber(pos)
|
||||
self.addseasons()
|
||||
season = self.getControl(MSEASONS).getSelectedItem().getLabel()
|
||||
self.getControl(MSEP).reset()
|
||||
self.getControl(MSEP).addItems(self.episodes[season])
|
||||
self.getControl(MLIST).reset()
|
||||
self.getControl(MLIST).addItems(self.items)
|
||||
self.getControl(MLIST).selectItem(pos)
|
||||
# OK
|
||||
if control_id in [OK]:
|
||||
for it in self.selected:
|
||||
self.specials[int(it.getProperty('title'))] = '0x' + it.getLabel()
|
||||
self.close()
|
||||
# CLOSE
|
||||
elif control_id in [CLOSE]:
|
||||
self.Exit = True
|
||||
self.close()
|
||||
|
||||
|
||||
def makerenumber(self, pos = 0):
|
||||
items = []
|
||||
currentSeason = self.items[pos].getProperty('season')
|
||||
previousSeason = self.items[pos - 1 if pos > 0 else 0].getProperty('season')
|
||||
prevEpisode = self.items[pos - 1 if pos > 0 else 0].getProperty('episode')
|
||||
if currentSeason != str(self.season):
|
||||
if str(self.season) == previousSeason:
|
||||
prevEpisode = int(prevEpisode) + 1
|
||||
else:
|
||||
prevEpisode = 1
|
||||
else: prevEpisode = self.episode
|
||||
|
||||
for i, item in enumerate(self.items):
|
||||
if (i >= pos and item.getProperty('season') == currentSeason) or not item.getProperty('season'):
|
||||
if i > pos: prevEpisode += 1
|
||||
item.setProperties({'season':self.season, 'episode':prevEpisode})
|
||||
items.append(item)
|
||||
self.seasons[item.getLabel()] = '%sx%s' % (item.getProperty('season'), item.getProperty('episode'))
|
||||
self.items = items
|
||||
logger.debug('SELF',self.seasons)
|
||||
|
||||
def addseasons(self):
|
||||
seasonlist = []
|
||||
seasons = []
|
||||
self.episodes = {}
|
||||
for ep, value in self.seasons.items():
|
||||
season = value.split('x')[0]
|
||||
if season not in seasonlist:
|
||||
item = xbmcgui.ListItem(season)
|
||||
seasonlist.append(season)
|
||||
seasons.append(item)
|
||||
if season in seasonlist:
|
||||
if season not in self.episodes:
|
||||
self.episodes[season] = []
|
||||
item = xbmcgui.ListItem('%s - Ep. %s' % (value, ep))
|
||||
item.setProperty('episode', ep)
|
||||
self.episodes[season].append(item)
|
||||
logger.log('EPISODES',self.episodes[season])
|
||||
self.episodes[season].sort(key=lambda it: int(it.getProperty('episode')))
|
||||
|
||||
seasons.sort(key=lambda it: int(it.getLabel()))
|
||||
self.getControl(MSEASONS).reset()
|
||||
self.getControl(MSEASONS).addItems(seasons)
|
||||
@@ -672,7 +672,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||
if mpd:
|
||||
if not install_inputstream():
|
||||
return
|
||||
xlistitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
|
||||
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
||||
xlistitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
|
||||
if item.drm and item.license:
|
||||
install_widevine()
|
||||
@@ -1110,9 +1110,7 @@ def play_torrent(item, xlistitem, mediaurl):
|
||||
selection = 0
|
||||
|
||||
if selection >= 0:
|
||||
|
||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xlistitem)
|
||||
time.sleep(1)
|
||||
prevent_busy(item)
|
||||
|
||||
mediaurl = urllib.quote_plus(item.url)
|
||||
torr_client = torrent_options[selection][0]
|
||||
@@ -1131,8 +1129,9 @@ def play_torrent(item, xlistitem, mediaurl):
|
||||
|
||||
torrent.mark_auto_as_watched(item)
|
||||
|
||||
while is_playing() and not xbmc.Monitor().abortRequested():
|
||||
time.sleep(3)
|
||||
if not item.globalsearch:
|
||||
while is_playing() and not xbmc.Monitor().abortRequested():
|
||||
time.sleep(3)
|
||||
|
||||
|
||||
def resume_playback(played_time):
|
||||
|
||||
@@ -64,7 +64,7 @@ class InfoWindow(xbmcgui.WindowXMLDialog):
|
||||
|
||||
def onClick(self, control_id):
|
||||
if control_id == SELECT:
|
||||
self.response = self.results[self.getControl(SELECT).getSelectedPosition()]
|
||||
self.response = self.results[int(self.getControl(SELECT).getSelectedItem().getProperty('position'))]
|
||||
self.close()
|
||||
elif control_id == CLOSE:
|
||||
self.close()
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "https?://(?:akvideo\\.stream|akvi\\.club)/[^\\s]+[/=]([$0-9]+)(?:[\\s<]|$|\\.html)",
|
||||
"pattern": "https?://(?:akvideo\\.stream|akvi\\.club|akvi\\.icu|akki\\.monster)/[^\\s]+[/=]([$0-9]+)(?:[\\s<]|$|\\.html)",
|
||||
"url": "http://akvideo.stream/swembedid/\\1"
|
||||
},
|
||||
{
|
||||
"pattern": "https?://(?:akvideo\\.stream|akvi\\.club)/(?:embed-|video/|video\\.php\\?file_code=)?([a-z0-9]+)(?:[\\s<]|$|\\.html)",
|
||||
"pattern": "https?://(?:akvideo\\.stream|akvi\\.club|akvi\\.icu|akki\\.monster)/(?:embed-|video/|video\\.php\\?file_code=)?([a-z0-9]+)(?:[\\s<]|$|\\.html)",
|
||||
"url": "http://akvi.club/embed-\\1.html"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -12,6 +12,9 @@ def test_video_exists(page_url):
|
||||
logger.debug("(page_url='%s')" % page_url)
|
||||
global data
|
||||
data = httptools.downloadpage(page_url, cookies=False).data
|
||||
if 'Video embed restricted for this domain'in data:
|
||||
headers = {'Referer':''}
|
||||
data = httptools.downloadpage(page_url, headers=headers, cookies=False).data
|
||||
if 'File is no longer available as it expired or has been deleted' in data:
|
||||
return False, config.get_localized_string(70449) % "SuperVideo"
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
"find_videos": {
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "(?:wstream\\.video)(?!<)(?:=|/)(?:video[a-zA-Z0-9.?_]*|embed[a-zA-Z0-9]*|)?(?!api|swembedid)(?:-|/|=)?(?:[a-z0-9A-Z]+/)?([a-z0-9A-Z]+)",
|
||||
"pattern": "(?:wstream\\.video|wstream\\.icu)(?!<)(?:=|/)(?:video[a-zA-Z0-9.?_]*|embed[a-zA-Z0-9]*|)?(?!api|swembedid|swvideoid)(?:-|/|=)?(?:[a-z0-9A-Z]+/)?([a-z0-9A-Z]+)",
|
||||
"url": "http://wstream.video/video.php?file_code=\\1"
|
||||
},
|
||||
{
|
||||
"pattern": "(?:wstream\\.video)/((?:api/vcmod/fastredirect/streaming\\.php\\?id=|swembedid/)[$0-9]+)",
|
||||
"pattern": "(?:wstream\\.video|wstream\\.icu)/((?:api/vcmod/fastredirect/streaming\\.php\\?id=|swembedid|swvideoid/)[$0-9]+)",
|
||||
"url": "http://wstream.video/\\1"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -18,24 +18,20 @@ errorsStr = ['Sorry this file is not longer available', 'Sorry this video is una
|
||||
|
||||
def test_video_exists(page_url):
|
||||
global headers
|
||||
real_host = '116.202.226.34'
|
||||
headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0'],
|
||||
['Host', scrapertools.get_domain_from_url(page_url)]]
|
||||
headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0']]
|
||||
|
||||
logger.debug("(page_url='%s')" % page_url)
|
||||
if 'wstream' in page_url:
|
||||
resp = httptools.downloadpage(page_url.replace(headers[1][1], real_host), headers=headers, verify=False)
|
||||
else:
|
||||
resp = httptools.downloadpage(page_url, headers=headers, verify=False)
|
||||
disable_directIP = False
|
||||
if 'swvideoid' in page_url: disable_directIP = True
|
||||
resp = httptools.downloadpage(page_url, headers=headers, verify=False, disable_directIP=disable_directIP)
|
||||
|
||||
global data, real_url
|
||||
data = resp.data
|
||||
|
||||
page_url = resp.url.replace(headers[1][1], real_host)
|
||||
if '/streaming.php' in page_url in page_url:
|
||||
code = httptools.downloadpage(page_url, headers=headers, follow_redirects=False, only_headers=True, verify=False).headers['location'].split('/')[-1].replace('.html', '')
|
||||
# logger.debug('WCODE=' + code)
|
||||
page_url = 'https://' + real_host + '/video.php?file_code=' + code
|
||||
page_url = 'https://wstream.video/video.php?file_code=' + code
|
||||
data = httptools.downloadpage(page_url, headers=headers, follow_redirects=True, verify=False).data
|
||||
|
||||
if 'nored.icu' in str(headers):
|
||||
@@ -45,7 +41,7 @@ def test_video_exists(page_url):
|
||||
dec = ''
|
||||
for v in var.split(','):
|
||||
dec += chr(int(v) - int(value))
|
||||
page_url = 'https://' + real_host + '/video.php?file_code=' + scrapertools.find_single_match(dec, "src='([^']+)").split('/')[-1].replace('.html','')
|
||||
page_url = 'https://wstream.video/video.php?file_code=' + scrapertools.find_single_match(dec, "src='([^']+)").split('/')[-1].replace('.html','')
|
||||
headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0'],['Host', 'wstream.video']]
|
||||
new_data = httptools.downloadpage(page_url, headers=headers, follow_redirects=True, verify=False).data
|
||||
logger.debug('NEW DATA: \n' + new_data)
|
||||
@@ -102,7 +98,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
|
||||
sitekey = scrapertools.find_multiple_matches(data, """data-sitekey=['"] *([^"']+)""")
|
||||
if sitekey: sitekey = sitekey[-1]
|
||||
captcha = platformtools.show_recaptcha(sitekey, page_url.replace('116.202.226.34', headers[1][1]).replace('nored.icu', headers[1][1])) if sitekey else ''
|
||||
captcha = platformtools.show_recaptcha(sitekey, page_url) if sitekey else ''
|
||||
|
||||
possibleParam = scrapertools.find_multiple_matches(data,r"""<input.*?(?:name=["']([^'"]+).*?value=["']([^'"]*)['"]>|>)""")
|
||||
if possibleParam and possibleParam[0][0]:
|
||||
@@ -118,7 +114,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(707434))
|
||||
return []
|
||||
|
||||
headers.append(['Referer', real_url.replace('116.202.226.34', headers[1][1]).replace('nored.icu', headers[1][1])])
|
||||
headers.append(['Referer', real_url])
|
||||
_headers = urllib.urlencode(dict(headers))
|
||||
|
||||
post_data = scrapertools.find_single_match(data, r"<script type='text/javascript'>(eval.function.p,a,c,k,e,.*?)\s*</script>")
|
||||
|
||||
96
service.py
96
service.py
@@ -47,9 +47,9 @@ def update(path, p_dialog, i, t, serie, overwrite):
|
||||
url = module.host + urlsplit(url).path
|
||||
serie.url = url
|
||||
|
||||
###### Redirección al canal NewPct1.py si es un clone, o a otro canal y url si ha intervención judicial
|
||||
###### Redirection to the NewPct1.py channel if it is a clone, or to another channel and url if there has been judicial intervention
|
||||
try:
|
||||
head_nfo, it = videolibrarytools.read_nfo(nfo_file) #Refresca el .nfo para recoger actualizaciones
|
||||
head_nfo, it = videolibrarytools.read_nfo(nfo_file) # Refresh the .nfo to collect updates
|
||||
if it.emergency_urls:
|
||||
serie.emergency_urls = it.emergency_urls
|
||||
serie.category = category
|
||||
@@ -75,7 +75,7 @@ def update(path, p_dialog, i, t, serie, overwrite):
|
||||
|
||||
try:
|
||||
if int(overwrite) == 3:
|
||||
# Sobrescribir todos los archivos (tvshow.nfo, 1x01.nfo, 1x01 [canal].json, 1x01.strm, etc...)
|
||||
# Overwrite all files (tvshow.nfo, 1x01.nfo, 1x01 [channel] .json, 1x01.strm, etc ...)
|
||||
insertados, sobreescritos, fallidos, notusedpath = videolibrarytools.save_tvshow(serie, itemlist)
|
||||
#serie= videolibrary.check_season_playcount(serie, serie.contentSeason)
|
||||
#if filetools.write(path + '/tvshow.nfo', head_nfo + it.tojson()):
|
||||
@@ -104,9 +104,9 @@ def update(path, p_dialog, i, t, serie, overwrite):
|
||||
else:
|
||||
logger.debug("Channel %s not active is not updated" % serie.channel)
|
||||
|
||||
#Sincronizamos los episodios vistos desde la videoteca de Kodi con la de Alfa
|
||||
# Synchronize the episodes seen from the Kodi video library with that of KoD
|
||||
try:
|
||||
if config.is_xbmc(): #Si es Kodi, lo hacemos
|
||||
if config.is_xbmc(): # If it's Kodi, we do it
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.mark_content_as_watched_on_kod(filetools.join(path,'tvshow.nfo'))
|
||||
except:
|
||||
@@ -151,27 +151,27 @@ def check_for_update(overwrite=True):
|
||||
logger.debug("serie=" + serie.contentSerieName)
|
||||
p_dialog.update(int(math.ceil((i + 1) * t)), heading, serie.contentSerieName)
|
||||
|
||||
#Verificamos el estado del serie.library_playcounts de la Serie por si está incompleto
|
||||
# Check the status of the series.library_playcounts of the Series in case it is incomplete
|
||||
try:
|
||||
estado = False
|
||||
#Si no hemos hecho la verificación o no tiene playcount, entramos
|
||||
# If we have not done the verification or do not have a playcount, we enter
|
||||
estado = config.get_setting("verify_playcount", "videolibrary")
|
||||
if not estado or estado == False or not serie.library_playcounts: #Si no se ha pasado antes, lo hacemos ahora
|
||||
serie, estado = videolibrary.verify_playcount_series(serie, path) #También se pasa si falta un PlayCount por completo
|
||||
if not estado or estado == False or not serie.library_playcounts: # If it hasn't happened before, we do it now
|
||||
serie, estado = videolibrary.verify_playcount_series(serie, path) # Also happens if a PlayCount is missing completely
|
||||
except:
|
||||
logger.error(traceback.format_exc())
|
||||
else:
|
||||
if estado: #Si ha tenido éxito la actualización...
|
||||
estado_verify_playcount_series = True #... se marca para cambiar la opción de la Videoteca
|
||||
if estado: # If the update was successful ...
|
||||
estado_verify_playcount_series = True # ... is checked to change the Video Library option
|
||||
|
||||
interval = int(serie.active) # Podria ser del tipo bool
|
||||
interval = int(serie.active) # Could be the bool type
|
||||
|
||||
if not serie.active:
|
||||
# si la serie no esta activa descartar
|
||||
# if the series is not active discard
|
||||
if not overwrite:
|
||||
#Sincronizamos los episodios vistos desde la videoteca de Kodi con la de Alfa, aunque la serie esté desactivada
|
||||
# Synchronize the episodes seen from the Kodi video library with that of Alpha, even if the series is deactivated
|
||||
try:
|
||||
if config.is_xbmc(): #Si es Kodi, lo hacemos
|
||||
if config.is_xbmc(): # If it's Kodi, we do it
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.mark_content_as_watched_on_kod(filetools.join(path,'tvshow.nfo'))
|
||||
except:
|
||||
@@ -179,7 +179,7 @@ def check_for_update(overwrite=True):
|
||||
|
||||
continue
|
||||
|
||||
# obtenemos las fecha de actualizacion y de la proxima programada para esta serie
|
||||
# Obtain the update date and the next scheduled for this series
|
||||
update_next = serie.update_next
|
||||
if update_next:
|
||||
y, m, d = update_next.split('-')
|
||||
@@ -194,33 +194,33 @@ def check_for_update(overwrite=True):
|
||||
else:
|
||||
update_last = hoy
|
||||
|
||||
# si la serie esta activa ...
|
||||
# if the series is active ...
|
||||
if overwrite or config.get_setting("updatetvshows_interval", "videolibrary") == 0:
|
||||
# ... forzar actualizacion independientemente del intervalo
|
||||
# ... force update regardless of interval
|
||||
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
|
||||
if not serie_actualizada:
|
||||
update_next = hoy + datetime.timedelta(days=interval)
|
||||
|
||||
elif interval == 1 and update_next <= hoy:
|
||||
# ...actualizacion diaria
|
||||
# ...daily update
|
||||
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
|
||||
if not serie_actualizada and update_last <= hoy - datetime.timedelta(days=7):
|
||||
# si hace una semana q no se actualiza, pasar el intervalo a semanal
|
||||
# if it hasn't been updated for a week, change the interval to weekly
|
||||
interval = 7
|
||||
update_next = hoy + datetime.timedelta(days=interval)
|
||||
|
||||
elif interval == 7 and update_next <= hoy:
|
||||
# ...actualizacion semanal
|
||||
# ... weekly update
|
||||
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
|
||||
if not serie_actualizada:
|
||||
if update_last <= hoy - datetime.timedelta(days=14):
|
||||
# si hace 2 semanas q no se actualiza, pasar el intervalo a mensual
|
||||
# if it has not been updated for 2 weeks, change the interval to monthly
|
||||
interval = 30
|
||||
|
||||
update_next += datetime.timedelta(days=interval)
|
||||
|
||||
elif interval == 30 and update_next <= hoy:
|
||||
# ...actualizacion mensual
|
||||
# ... monthly update
|
||||
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
|
||||
if not serie_actualizada:
|
||||
update_next += datetime.timedelta(days=interval)
|
||||
@@ -229,7 +229,7 @@ def check_for_update(overwrite=True):
|
||||
update_last = hoy
|
||||
update_next = hoy + datetime.timedelta(days=interval)
|
||||
|
||||
head_nfo, serie = videolibrarytools.read_nfo(tvshow_file) #Vuelve a leer el.nfo, que ha sido modificado
|
||||
head_nfo, serie = videolibrarytools.read_nfo(tvshow_file) # Reread the .nfo, which has been modified
|
||||
if interval != int(serie.active) or update_next.strftime('%Y-%m-%d') != serie.update_next or update_last.strftime('%Y-%m-%d') != serie.update_last:
|
||||
serie.update_last = update_last.strftime('%Y-%m-%d')
|
||||
if update_next > hoy:
|
||||
@@ -241,18 +241,18 @@ def check_for_update(overwrite=True):
|
||||
|
||||
if serie_actualizada:
|
||||
if config.get_setting("search_new_content", "videolibrary") == 0:
|
||||
# Actualizamos la videoteca de Kodi: Buscar contenido en la carpeta de la serie
|
||||
# We update the Kodi video library: Find content in the series folder
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.update(folder=filetools.basename(path))
|
||||
else:
|
||||
update_when_finished = True
|
||||
|
||||
if estado_verify_playcount_series: #Si se ha cambiado algún playcount, ...
|
||||
estado = config.set_setting("verify_playcount", True, "videolibrary") #... actualizamos la opción de Videolibrary
|
||||
if estado_verify_playcount_series: # If any playcount has been changed, ...
|
||||
estado = config.set_setting("verify_playcount", True, "videolibrary") # ... we update the Videolibrary option
|
||||
|
||||
if config.get_setting("search_new_content", "videolibrary") == 1 and update_when_finished:
|
||||
# Actualizamos la videoteca de Kodi: Buscar contenido en todas las series
|
||||
# We update the Kodi video library: Find content in all series
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.update()
|
||||
@@ -308,17 +308,21 @@ def get_ua_list():
|
||||
# https://github.com/alfa-addon/addon/blob/master/plugin.video.alfa/platformcode/updater.py#L273
|
||||
logger.info()
|
||||
url = "http://omahaproxy.appspot.com/all?csv=1"
|
||||
current_ver = config.get_setting("chrome_ua_version", default="").split(".")
|
||||
data = httptools.downloadpage(url, alfa_s=True).data
|
||||
new_ua_ver = scrapertools.find_single_match(data, "win64,stable,([^,]+),")
|
||||
|
||||
if not current_ver:
|
||||
config.set_setting("chrome_ua_version", new_ua_ver)
|
||||
else:
|
||||
for pos, val in enumerate(new_ua_ver.split('.')):
|
||||
if int(val) > int(current_ver[pos]):
|
||||
config.set_setting("chrome_ua_version", new_ua_ver)
|
||||
break
|
||||
try:
|
||||
current_ver = config.get_setting("chrome_ua_version", default="").split(".")
|
||||
data = httptools.downloadpage(url, alfa_s=True).data
|
||||
new_ua_ver = scrapertools.find_single_match(data, "win64,stable,([^,]+),")
|
||||
|
||||
if not current_ver:
|
||||
config.set_setting("chrome_ua_version", new_ua_ver)
|
||||
else:
|
||||
for pos, val in enumerate(new_ua_ver.split('.')):
|
||||
if int(val) > int(current_ver[pos]):
|
||||
config.set_setting("chrome_ua_version", new_ua_ver)
|
||||
break
|
||||
except:
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
def run_threaded(job_func, args):
|
||||
@@ -361,11 +365,10 @@ class AddonMonitor(xbmc.Monitor):
|
||||
xbmc_videolibrary.update_sources(settings_post.get('downloadpath', None),
|
||||
self.settings_pre.get('downloadpath', None))
|
||||
|
||||
# si se ha cambiado la ruta de la videoteca llamamos a comprobar directorios para que lo cree y pregunte
|
||||
# automaticamente si configurar la videoteca
|
||||
if self.settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \
|
||||
self.settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \
|
||||
self.settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None):
|
||||
# If the path of the video library has been changed, we call to check directories so that it creates it and automatically asks if to configure the video library
|
||||
if self.settings_pre.get("videolibrarypath", None) and self.settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \
|
||||
self.settings_pre.get("folder_movies", None) and self.settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \
|
||||
self.settings_pre.get("folder_tvshows", None) and self.settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None):
|
||||
videolibrary.move_videolibrary(self.settings_pre.get("videolibrarypath", ''),
|
||||
settings_post.get("videolibrarypath", ''),
|
||||
self.settings_pre.get("folder_movies", ''),
|
||||
@@ -373,7 +376,7 @@ class AddonMonitor(xbmc.Monitor):
|
||||
self.settings_pre.get("folder_tvshows", ''),
|
||||
settings_post.get("folder_tvshows", ''))
|
||||
|
||||
# si se ha puesto que se quiere autoconfigurar y se había creado el directorio de la videoteca
|
||||
# if you want to autoconfigure and the video library directory had been created
|
||||
if not self.settings_pre.get("videolibrary_kodi", None) and settings_post.get("videolibrary_kodi", None):
|
||||
xbmc_videolibrary.ask_set_content(silent=True)
|
||||
elif self.settings_pre.get("videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None):
|
||||
@@ -451,7 +454,10 @@ if __name__ == "__main__":
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
try:
|
||||
schedule.run_pending()
|
||||
except:
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
if monitor.waitForAbort(1): # every second
|
||||
break
|
||||
|
||||
@@ -397,7 +397,8 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
|
||||
for result in results:
|
||||
resultsList += result.tourl() + '|'
|
||||
item.setProperty('items',resultsList)
|
||||
self.channels[int(self.results[name])].setProperty('results', str(len(resultsList).split('|') - 1))
|
||||
logger.log(self.channels[int(self.results[name])])
|
||||
self.channels[int(self.results[name])].setProperty('results', str(len(resultsList.split('|')) - 1))
|
||||
pos = self.CHANNELS.getSelectedPosition()
|
||||
self.CHANNELS.reset()
|
||||
self.CHANNELS.addItems(self.channels)
|
||||
@@ -745,9 +746,10 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
|
||||
server.window = True
|
||||
server.globalsearch = True
|
||||
platformtools.prevent_busy(server)
|
||||
run(server)
|
||||
Thread(target=run, args=[server]).start()
|
||||
# run(server)
|
||||
try:
|
||||
while not xbmc.Player().getTime() > 0:
|
||||
while not platformtools.is_playing() or not xbmc.Player().getTime() > 0:
|
||||
xbmc.sleep(500)
|
||||
self.close()
|
||||
xbmc.sleep(500)
|
||||
|
||||
Reference in New Issue
Block a user