KoD 0.7.1
- A grande richiesta, è ora possibile riprodurre in automatico l'episodio successivo di una serie in libreria - aggiunta la possibilità di nascondere la lista dei server, quando si usa l'autoplay - aggiunto canale pufimovies.com - fix vari
This commit is contained in:
@@ -547,11 +547,9 @@ def episodios(item):
|
||||
if pagination and i >= pag * pagination: break # pagination
|
||||
match = []
|
||||
if episode.has_key('number'):
|
||||
match = support.match(episode['number'], r'(?P<season>\d+)x(?P<episode>\d+)')[0]
|
||||
if match:
|
||||
match = match[0]
|
||||
match = support.match(episode['number'], patron=r'(?P<season>\d+)x(?P<episode>\d+)').match
|
||||
if not match and episode.has_key('title'):
|
||||
match = support.match(episode['title'], r'(?P<season>\d+)x(?P<episode>\d+)')[0]
|
||||
match = support.match(episode['title'], patron=r'(?P<season>\d+)x(?P<episode>\d+)').match
|
||||
if match: match = match[0]
|
||||
if match:
|
||||
episode_number = match[1]
|
||||
@@ -561,7 +559,7 @@ def episodios(item):
|
||||
season_number = episode['season'] if episode.has_key('season') else season if season else 1
|
||||
episode_number = episode['number'] if episode.has_key('number') else ''
|
||||
if not episode_number.isdigit():
|
||||
episode_number = support.match(episode['title'], r'(?P<episode>\d+)')[0][0]
|
||||
episode_number = support.match(episode['title'], patron=r'(?P<episode>\d+)').match
|
||||
ep = int(episode_number) if episode_number else ep
|
||||
if not episode_number:
|
||||
episode_number = str(ep).zfill(2)
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import xbmc, xbmcgui, os
|
||||
from platformcode import config, platformtools, logger
|
||||
from time import time, sleep
|
||||
from core import scrapertools
|
||||
from core import jsontools, filetools
|
||||
from lib.concurrent import futures
|
||||
|
||||
PLAYER_STOP = 13
|
||||
ND = 'NextDialogCompact.xml' if config.get_setting('next_ep_type') else 'NextDialog.xml'
|
||||
|
||||
def check(item):
|
||||
return True if config.get_setting('next_ep') > 0 and item.contentType != 'movie' else False
|
||||
|
||||
|
||||
def return_item(item):
|
||||
logger.info()
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
future = executor.submit(next_ep, item)
|
||||
item = future.result()
|
||||
return item
|
||||
|
||||
def run(item):
|
||||
logger.info()
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
future = executor.submit(next_ep, item)
|
||||
item = future.result()
|
||||
if item.next_ep:
|
||||
from platformcode.launcher import play_from_library
|
||||
return play_from_library(item)
|
||||
|
||||
|
||||
def videolibrary(item):
|
||||
from threading import Thread
|
||||
item.videolibrary = True
|
||||
Thread(target=next_ep, args=[item]).start()
|
||||
|
||||
|
||||
def next_ep(item):
|
||||
logger.info()
|
||||
condition = config.get_setting('next_ep')
|
||||
item.next_ep = False
|
||||
item.show_server = True
|
||||
|
||||
VL = True if item.videolibrary else False
|
||||
|
||||
time_over = False
|
||||
time_limit = time() + 30
|
||||
time_steps = [20,30,40,50,60]
|
||||
TimeFromEnd = time_steps[config.get_setting('next_ep_seconds')]
|
||||
|
||||
# wait until the video plays
|
||||
while not platformtools.is_playing() and time() < time_limit:
|
||||
sleep(1)
|
||||
|
||||
while platformtools.is_playing() and time_over == False:
|
||||
try:
|
||||
Total = xbmc.Player().getTotalTime()
|
||||
Actual = xbmc.Player().getTime()
|
||||
Difference = Total - Actual
|
||||
if Total > TimeFromEnd >= Difference:
|
||||
time_over = True
|
||||
except:
|
||||
break
|
||||
|
||||
if time_over:
|
||||
if condition == 1: # hide server afther x second
|
||||
item.show_server = False
|
||||
elif condition == 2: # play next fileif exist
|
||||
|
||||
# check i next file exist
|
||||
current_filename = os.path.basename(item.strm_path)
|
||||
base_path = os.path.basename(os.path.normpath(os.path.dirname(item.strm_path)))
|
||||
path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"),base_path)
|
||||
fileList = []
|
||||
for file in os.listdir(path):
|
||||
if file.endswith('.strm'):
|
||||
fileList.append(file)
|
||||
|
||||
fileList.sort()
|
||||
|
||||
nextIndex = fileList.index(current_filename) + 1
|
||||
if nextIndex == 0 or nextIndex == len(fileList):
|
||||
next_file = None
|
||||
else:
|
||||
next_file = fileList[nextIndex]
|
||||
|
||||
# start next episode window afther x time
|
||||
if next_file:
|
||||
from core.item import Item
|
||||
season_ep = next_file.split('.')[0]
|
||||
season = season_ep.split('x')[0]
|
||||
episode = season_ep.split('x')[1]
|
||||
next_ep = '%sx%s' % (season, episode)
|
||||
item = Item(
|
||||
action= 'play_from_library',
|
||||
channel= 'videolibrary',
|
||||
contentEpisodeNumber= episode,
|
||||
contentSeason= season,
|
||||
contentTitle= next_ep,
|
||||
contentType= 'tvshow',
|
||||
infoLabels= {'episode': episode, 'mediatype': 'tvshow', 'season': season, 'title': next_ep},
|
||||
strm_path= filetools.join(base_path, next_file))
|
||||
|
||||
global ITEM
|
||||
ITEM = item
|
||||
|
||||
nextDialog = NextDialog(ND, config.get_runtime_path())
|
||||
nextDialog.show()
|
||||
while platformtools.is_playing() and not nextDialog.is_still_watching():
|
||||
xbmc.sleep(100)
|
||||
pass
|
||||
|
||||
nextDialog.close()
|
||||
logger.info('Next Episode: ' +str(nextDialog.stillwatching))
|
||||
|
||||
if nextDialog.stillwatching or nextDialog.continuewatching:
|
||||
item.next_ep = True
|
||||
xbmc.Player().stop()
|
||||
if VL:
|
||||
sleep(1)
|
||||
xbmc.executebuiltin('Action(Back)')
|
||||
sleep(0.5)
|
||||
from platformcode.launcher import play_from_library
|
||||
return play_from_library(item)
|
||||
else:
|
||||
item.show_server = False
|
||||
if VL:
|
||||
sleep(1)
|
||||
xbmc.executebuiltin('Action(Back)')
|
||||
sleep(0.5)
|
||||
return None
|
||||
|
||||
return item
|
||||
|
||||
|
||||
class NextDialog(xbmcgui.WindowXMLDialog):
|
||||
item = None
|
||||
cancel = False
|
||||
stillwatching = False
|
||||
continuewatching = True
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
logger.info()
|
||||
self.action_exitkeys_id = [10, 13]
|
||||
self.progress_control = None
|
||||
self.item = ITEM
|
||||
|
||||
def set_still_watching(self, stillwatching):
|
||||
self.stillwatching = stillwatching
|
||||
|
||||
def set_continue_watching(self, continuewatching):
|
||||
self.continuewatching = continuewatching
|
||||
|
||||
def is_still_watching(self):
|
||||
return self.stillwatching
|
||||
|
||||
def onFocus(self, controlId):
|
||||
pass
|
||||
|
||||
def doAction(self):
|
||||
pass
|
||||
|
||||
def closeDialog(self):
|
||||
self.close()
|
||||
|
||||
def onClick(self, controlId):
|
||||
if controlId == 3012: # Still watching
|
||||
self.set_still_watching(True)
|
||||
self.set_continue_watching(False)
|
||||
self.close()
|
||||
elif controlId == 3013: # Cancel
|
||||
self.set_continue_watching(False)
|
||||
self.close()
|
||||
|
||||
def onAction(self, action):
|
||||
logger.info()
|
||||
if action == PLAYER_STOP:
|
||||
self.set_continue_watching(False)
|
||||
self.close()
|
||||
@@ -40,7 +40,7 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
|
||||
def __init__(self, domain, CF=False, *args, **kwargs):
|
||||
self.conn = sql.connect(db)
|
||||
self.cur = self.conn.cursor()
|
||||
self.ssl_context = CustomContext(ssl.PROTOCOL_TLS, domain)
|
||||
self.ssl_context = CustomContext(ssl.PROTOCOL_TLS if 'PROTOCOL_TLS' in ssl.__dict__ else ssl.PROTOCOL_SSLv3, domain)
|
||||
self.CF = CF # if cloudscrape is in action
|
||||
self.cipherSuite = kwargs.pop('cipherSuite', ssl._DEFAULT_CIPHERS)
|
||||
|
||||
@@ -99,7 +99,7 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
|
||||
domain = parse.netloc
|
||||
else:
|
||||
raise requests.exceptions.URLRequired
|
||||
self.ssl_context = CustomContext(ssl.PROTOCOL_TLS, domain)
|
||||
self.ssl_context = CustomContext(ssl.PROTOCOL_TLS if 'PROTOCOL_TLS' in ssl.__dict__ else ssl.PROTOCOL_SSLv3, domain)
|
||||
if self.CF:
|
||||
self.ssl_context.options |= (ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1)
|
||||
self.ssl_context.set_ciphers(self.cipherSuite)
|
||||
|
||||
@@ -558,6 +558,7 @@ def findvideos(item):
|
||||
server.channel = "videolibrary"
|
||||
server.nfo = item.nfo
|
||||
server.strm_path = item.strm_path
|
||||
server.play_from = item.play_from
|
||||
|
||||
#### Compatibilidad con Kodi 18: evita que se quede la ruedecedita dando vueltas en enlaces Directos
|
||||
if server.action == 'play':
|
||||
@@ -576,7 +577,10 @@ def findvideos(item):
|
||||
|
||||
# return sorted(itemlist, key=lambda it: it.title.lower())
|
||||
autoplay.play_multi_channel(item, itemlist)
|
||||
|
||||
from inspect import stack
|
||||
from specials import nextep
|
||||
if nextep.check(item) and stack()[1][3] == 'run':
|
||||
nextep.videolibrary(item)
|
||||
return itemlist
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user