fix StreamingCommunity
This commit is contained in:
@@ -5,8 +5,8 @@
|
|||||||
import functools
|
import functools
|
||||||
import json, requests, sys
|
import json, requests, sys
|
||||||
from channels.mediasetplay import Token
|
from channels.mediasetplay import Token
|
||||||
from core import support, channeltools, httptools
|
from core import support, channeltools, httptools, jsontools, filetools
|
||||||
from platformcode import logger
|
from platformcode import logger, config, platformtools
|
||||||
|
|
||||||
|
|
||||||
# def findhost(url):
|
# def findhost(url):
|
||||||
@@ -191,7 +191,9 @@ def episodios(item):
|
|||||||
js = json.loads(support.match(item.url, patron=r'seasons="([^"]+)').match.replace('"','"'))
|
js = json.loads(support.match(item.url, patron=r'seasons="([^"]+)').match.replace('"','"'))
|
||||||
|
|
||||||
for episodes in js:
|
for episodes in js:
|
||||||
|
logger.debug(jsontools.dump(js))
|
||||||
for it in episodes['episodes']:
|
for it in episodes['episodes']:
|
||||||
|
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
item.clone(title=support.typo(str(episodes['number']) + 'x' + str(it['number']).zfill(2) + ' - ' + support.cleantitle(it['name']), 'bold'),
|
item.clone(title=support.typo(str(episodes['number']) + 'x' + str(it['number']).zfill(2) + ' - ' + support.cleantitle(it['name']), 'bold'),
|
||||||
episode=it['number'],
|
episode=it['number'],
|
||||||
@@ -233,5 +235,16 @@ def play(item):
|
|||||||
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
|
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
|
||||||
|
|
||||||
url = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(scws_id, token, expires)
|
url = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(scws_id, token, expires)
|
||||||
|
subs = []
|
||||||
|
urls = []
|
||||||
|
info = support.match(url, patron='(?:NAME="([^"]+)".*?URI="([^"]+)|RESOLUTION=\d+x(\d+).*?(http[^"\s]+))').matches
|
||||||
|
|
||||||
return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', url=url)]
|
for lang, sub, res, url in info:
|
||||||
|
if sub:
|
||||||
|
s = config.get_temp_file(lang +'.srt')
|
||||||
|
subs.append(s)
|
||||||
|
filetools.write(s, support.vttToSrt(httptools.downloadpage(support.match(sub, patron=r'(http[^\s\n]+)').match).data))
|
||||||
|
elif url:
|
||||||
|
urls.append(['hls [{}]'.format(res), url])
|
||||||
|
|
||||||
|
return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=urls, subtitle=subs, manifest='hls')]
|
||||||
|
|||||||
@@ -1594,3 +1594,30 @@ def thumb(item_itemlist_string=None, genre=False, live=False):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
return get_thumb('next.png')
|
return get_thumb('next.png')
|
||||||
|
|
||||||
|
|
||||||
|
def vttToSrt(data):
|
||||||
|
# Code adapted by VTT_TO_SRT.PY (c) Jansen A. Simanullang
|
||||||
|
ret = ''
|
||||||
|
|
||||||
|
data = re.sub(r'(\d\d:\d\d:\d\d).(\d\d\d) --> (\d\d:\d\d:\d\d).(\d\d\d)(?:[ \-\w]+:[\w\%\d:]+)*\n', r'\1,\2 --> \3,\4\n', data)
|
||||||
|
data = re.sub(r'(\d\d:\d\d).(\d\d\d) --> (\d\d:\d\d).(\d\d\d)(?:[ \-\w]+:[\w\%\d:]+)*\n', r'00:\1,\2 --> 00:\3,\4\n', data)
|
||||||
|
data = re.sub(r'(\d\d).(\d\d\d) --> (\d\d).(\d\d\d)(?:[ \-\w]+:[\w\%\d:]+)*\n', r'00:00:\1,\2 --> 00:00:\3,\4\n', data)
|
||||||
|
data = re.sub(r'WEBVTT\n', '', data)
|
||||||
|
data = re.sub(r'Kind:[ \-\w]+\n', '', data)
|
||||||
|
data = re.sub(r'Language:[ \-\w]+\n', '', data)
|
||||||
|
data = re.sub(r'<c[.\w\d]*>', '', data)
|
||||||
|
data = re.sub(r'</c>', '', data)
|
||||||
|
data = re.sub(r'<\d\d:\d\d:\d\d.\d\d\d>', '', data)
|
||||||
|
data = re.sub(r'::[\-\w]+\([\-.\w\d]+\)[ ]*{[.,:;\(\) \-\w\d]+\n }\n', '', data)
|
||||||
|
data = re.sub(r'Style:\n##\n', '', data)
|
||||||
|
|
||||||
|
lines = data.split(os.linesep)
|
||||||
|
|
||||||
|
for n, line in enumerate(lines):
|
||||||
|
if re.match(r"((\d\d:){2}\d\d),(\d{3}) --> ((\d\d:){2}\d\d),(\d{3})", line):
|
||||||
|
ret += str(n + 1) + os.linesep + line + os.linesep
|
||||||
|
else:
|
||||||
|
ret += line + os.linesep
|
||||||
|
|
||||||
|
return ret
|
||||||
@@ -1363,6 +1363,10 @@ def get_video_seleccionado(item, seleccion, video_urls, autoplay=False):
|
|||||||
def set_player(item, xlistitem, mediaurl, view, strm):
|
def set_player(item, xlistitem, mediaurl, view, strm):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
item.options = {'strm':False}
|
item.options = {'strm':False}
|
||||||
|
if item.subtitle:
|
||||||
|
if type(item.subtitle) != list: item.subtitle = [item.subtitle]
|
||||||
|
item.subtitle.reverse()
|
||||||
|
xlistitem.setSubtitles(item.subtitle)
|
||||||
|
|
||||||
# Moved del conector "torrent" here
|
# Moved del conector "torrent" here
|
||||||
if item.server == "torrent":
|
if item.server == "torrent":
|
||||||
@@ -1371,9 +1375,6 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
|||||||
# If it is a strm file, play is not necessary
|
# If it is a strm file, play is not necessary
|
||||||
elif strm:
|
elif strm:
|
||||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xlistitem)
|
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xlistitem)
|
||||||
if item.subtitle:
|
|
||||||
xbmc.sleep(2000)
|
|
||||||
xbmc_player.setSubtitles(item.subtitle)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if type(item.player_mode) == int:
|
if type(item.player_mode) == int:
|
||||||
@@ -1385,8 +1386,7 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
|||||||
logger.info("mediaurl=" + mediaurl)
|
logger.info("mediaurl=" + mediaurl)
|
||||||
prevent_busy()
|
prevent_busy()
|
||||||
if player_mode in [0,1]:
|
if player_mode in [0,1]:
|
||||||
if player_mode in [1]:
|
xlistitem.addStreamInfo('video', {'duration':240})
|
||||||
xlistitem.setProperty('StartOffset','{}'.format(resume_playback(get_played_time(item))))
|
|
||||||
|
|
||||||
logger.info('Player Mode:',['Direct', 'Bookmark'][player_mode])
|
logger.info('Player Mode:',['Direct', 'Bookmark'][player_mode])
|
||||||
# Add the listitem to a playlist
|
# Add the listitem to a playlist
|
||||||
@@ -1411,12 +1411,6 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
|||||||
download_and_play.download_and_play(mediaurl, "download_and_play.tmp", config.get_setting("downloadpath"))
|
download_and_play.download_and_play(mediaurl, "download_and_play.tmp", config.get_setting("downloadpath"))
|
||||||
return
|
return
|
||||||
|
|
||||||
# ALL LOOKING TO REMOVE VIEW
|
|
||||||
if item.subtitle and view:
|
|
||||||
logger.info("External subtitles: " + item.subtitle)
|
|
||||||
xbmc.sleep(2000)
|
|
||||||
xbmc_player.setSubtitles(item.subtitle)
|
|
||||||
|
|
||||||
# if it is a video library file send to mark as seen
|
# if it is a video library file send to mark as seen
|
||||||
if strm or item.strm_path: item.options['strm'] = True
|
if strm or item.strm_path: item.options['strm'] = True
|
||||||
|
|
||||||
@@ -1426,13 +1420,14 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
|||||||
|
|
||||||
# for cases where the audio playback window appears in place of the video one
|
# for cases where the audio playback window appears in place of the video one
|
||||||
if item.focusOnVideoPlayer:
|
if item.focusOnVideoPlayer:
|
||||||
from core.support import dbg;dbg()
|
|
||||||
while is_playing() and xbmcgui.getCurrentWindowId() != 12006:
|
while is_playing() and xbmcgui.getCurrentWindowId() != 12006:
|
||||||
continue
|
continue
|
||||||
xbmc.sleep(500)
|
xbmc.sleep(500)
|
||||||
xbmcgui.Window(12005).show()
|
xbmcgui.Window(12005).show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def add_next_to_playlist(item):
|
def add_next_to_playlist(item):
|
||||||
import threading
|
import threading
|
||||||
from core import filetools, videolibrarytools
|
from core import filetools, videolibrarytools
|
||||||
|
|||||||
Reference in New Issue
Block a user