Version 0.11.8
This commit is contained in:
1 parent
930b238204
commit
0739cca0a9
5 files changed
+65
-24
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.movistarplus"
|
||||
name="Movistar+"
|
||||
version="0.11.6"
|
||||
version="0.11.8"
|
||||
provider-name="Paco8">
|
||||
<requires>
|
||||
<!--- <import addon="xbmc.python" version="2.25.0"/> -->
|
||||
|
||||
@@ -32,5 +32,6 @@ endpoints = {
|
||||
"setUpStream": "https://alkasvaspub.imagenio.telefonica.net/asvas/ccs/{PID}/{deviceCode}/{PLAYREADYID}/Session",
|
||||
"tearDownStream": "https://alkasvaspub.imagenio.telefonica.net/asvas/ccs/{PID}/{deviceCode}/{PLAYREADYID}/Session/{SessionID}",
|
||||
"token": "https://auth.dof6.com/auth/oauth2/token?deviceClass={deviceType}",
|
||||
"ultimasreproducciones": "https://perso.dof6.com/movistarplus/{deviceType}/users/{DIGITALPLUSUSERIDC}/viewings?profile={PROFILE}&container=trackedseries&mediaType=FOTOH&idsOnly={idsOnly}&accountNumber={ACCOUNTNUMBER}&version=8&start={start}&end={end}&mdrm={mdrm}&tlsstream=true&demarcation={demarcation}"
|
||||
"ultimasreproducciones": "https://perso.dof6.com/movistarplus/{deviceType}/users/{DIGITALPLUSUSERIDC}/viewings?profile={PROFILE}&container=trackedseries&mediaType=FOTOH&idsOnly={idsOnly}&accountNumber={ACCOUNTNUMBER}&version=8&start={start}&end={end}&mdrm={mdrm}&tlsstream=true&demarcation={demarcation}",
|
||||
"watermarks": "https://ottcache.dof6.com/movistarplus/{deviceType}/channels/{uid}/watermarks?profile={profile}&mdrm=true"
|
||||
}
|
||||
@@ -661,6 +661,11 @@ class Movistar(object):
|
||||
t['session_request'] = '{"contentID":"'+ t['id'] +'", "streamType":"CHN"}'
|
||||
t['subscribed'] = self.is_subscribed_channel(c.get('tvProducts', []))
|
||||
t['info']['playcount'] = 1 # Set as watched
|
||||
t['uid'] = c.get('Uid')
|
||||
if False and 'links' in c:
|
||||
for l in c['links']:
|
||||
if l['rel'] == 'watermarks':
|
||||
t['watermark_url'] = l['href']
|
||||
# epg
|
||||
#if add_epg_info:
|
||||
# program = c['Pases'][0]
|
||||
@@ -1378,8 +1383,8 @@ class Movistar(object):
|
||||
if only_subscribed and not t['subscribed']: continue
|
||||
url = t['stream']
|
||||
if 'cas_id' in t: url += '&cas_id=' + t['cas_id']
|
||||
item = '#EXTINF:-1 tvg-name="{name}" tvg-id="{id}" tvg-logo="{logo}" tvg-chno="{preset}" group-title="Movistar+",{name}\n{stream}\n\n'.format(
|
||||
name=t['name'], id=t['id'], logo=t['logo'], preset=t['preset'], stream=url)
|
||||
item = '#EXTINF:-1 tvg-name="{name}" tvg-id="{id}" tvg-logo="{logo}" tvg-chno="{preset}" {catchup} group-title="Movistar+",{name}\n{stream}\n\n'.format(
|
||||
name=t['name'], id=t['id'], logo=t['logo'], preset=t['preset'], stream=url, catchup='catchup="default" catchup-source="{catchup-id}" catchup-days="7"')
|
||||
items.append(item)
|
||||
res = '#EXTM3U\n## Movistar+\n{}'.format(''.join(items))
|
||||
with io.open(filename, 'w', encoding='utf-8', newline='') as handle:
|
||||
@@ -1479,7 +1484,7 @@ class Movistar(object):
|
||||
if url:
|
||||
url = url.replace('&', '&')
|
||||
res.append('<programme start="{}" stop="{}" channel="{}"'.format(start, stop, ch['id']) +
|
||||
#(' catchup-id="{}"'.format(url) if url else "") +
|
||||
(' catchup-id="{}"'.format(url) if url else "") +
|
||||
'>\n' +
|
||||
' <title>{}</title>\n'.format(html_escape(e['title'])) +
|
||||
' <sub-title>{}</sub-title>\n'.format(html_escape(e['subtitle'])))
|
||||
@@ -1589,3 +1594,21 @@ class Movistar(object):
|
||||
content = unicode(content, 'utf-8')
|
||||
with io.open(filename, 'w', encoding='utf-8') as handle:
|
||||
handle.write(content)
|
||||
|
||||
def get_watermarks(self, uid, test=False):
|
||||
if test:
|
||||
now = datetime.utcnow()
|
||||
watermarks = []
|
||||
start = now + timedelta(seconds=20)
|
||||
for i in range(5):
|
||||
stop = start + timedelta(seconds=18)
|
||||
watermarks.append({
|
||||
'start': start.strftime('%Y-%m-%dT%H:%M:%SZ'),
|
||||
'stop': stop.strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||
})
|
||||
start = start + timedelta(minutes=1)
|
||||
return watermarks
|
||||
else:
|
||||
url = self.endpoints['watermarks'].format(deviceType='webplayer', uid=uid, profile='OTT')
|
||||
data = self.net.load_data(url)
|
||||
return data.get('watermarks', [])
|
||||
+34
-19
@@ -8,6 +8,8 @@ import sys
|
||||
import json
|
||||
import io
|
||||
import os.path
|
||||
from datetime import datetime, timedelta
|
||||
from .timeconv import isodate2date
|
||||
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
@@ -96,13 +98,12 @@ def play(params):
|
||||
# url = url.replace('DASH_WPC_WIDEVINE', 'DASH_TV_WIDEVINE')
|
||||
|
||||
# U7D from start and end times
|
||||
if stype == 'tv' and all(param in params for param in ['cas_id', 'start_time', 'end_time']):
|
||||
from datetime import datetime
|
||||
start = datetime.utcfromtimestamp(int(params['start_time']))
|
||||
end = datetime.utcfromtimestamp(int(params['end_time']))
|
||||
catchup_url = 'https://stover-wp0.cdn.telefonica.com/{cas_id}/vxfmt=dp/Manifest.mpd?device_profile=DASH_TV_WIDEVINE&start_time={start_time}&end_time={end_time}'
|
||||
url = catchup_url.format(cas_id=params['cas_id'], start_time=start.strftime('%Y-%m-%dT%H:%M:%SZ'), end_time=end.strftime('%Y-%m-%dT%H:%M:%SZ'))
|
||||
LOG('url from capchup: {}'.format(url))
|
||||
#if stype == 'tv' and all(param in params for param in ['cas_id', 'start_time', 'end_time']):
|
||||
# start = datetime.utcfromtimestamp(int(params['start_time']))
|
||||
# end = datetime.utcfromtimestamp(int(params['end_time']))
|
||||
# catchup_url = 'https://stover-wp0.cdn.telefonica.com/{cas_id}/vxfmt=dp/Manifest.mpd?device_profile=DASH_TV_WIDEVINE&start_time={start_time}&end_time={end_time}'
|
||||
# url = catchup_url.format(cas_id=params['cas_id'], start_time=start.strftime('%Y-%m-%dT%H:%M:%SZ'), end_time=end.strftime('%Y-%m-%dT%H:%M:%SZ'))
|
||||
# LOG('url from capchup: {}'.format(url))
|
||||
|
||||
|
||||
# Read the proxy address
|
||||
@@ -126,7 +127,14 @@ def play(params):
|
||||
cdn_token = m.cache.load('cdn.conf', 60)
|
||||
if not cdn_token:
|
||||
cdn_token = m.get_cdntoken()
|
||||
if not cdn_token:
|
||||
time.sleep(2)
|
||||
cdn_token = m.get_cdntoken()
|
||||
if cdn_token:
|
||||
m.cache.save_file('cdn.conf', cdn_token)
|
||||
else:
|
||||
show_notification('Ha pasado algo')
|
||||
return
|
||||
#LOG('cdn_token: {}'.format(cdn_token))
|
||||
manifest_headers += '&x-tcdn-token=' + cdn_token
|
||||
|
||||
@@ -239,10 +247,12 @@ def play(params):
|
||||
xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
|
||||
|
||||
LOG('**** session_opened: {}'.format(session_opened))
|
||||
is_sport_channel = (stype == 'tv' and channel_id in ['MLIGA', 'DAZNLI', 'MLIG1', 'CHAPIO', 'CHAP1', 'CHAP2', 'MLIGUH', 'CHAUHD', 'CHUHD1'])
|
||||
if session_opened or is_sport_channel:
|
||||
if is_sport_channel:
|
||||
last_time = 0 #time.time()
|
||||
watermarks = []
|
||||
if stype == 'tv' and 'uid' in params:
|
||||
watermarks = m.get_watermarks(params['uid'])
|
||||
LOG('watermarks: {}'.format(watermarks))
|
||||
|
||||
if session_opened or watermarks:
|
||||
window = xbmcgui.Window(12005)
|
||||
label = xbmcgui.ControlLabel(0, 0, 400, 20, m.account['id'], textColor='0xFFFFFFFF', alignment=6)
|
||||
from .player import MyPlayer
|
||||
@@ -251,10 +261,15 @@ def play(params):
|
||||
while not monitor.abortRequested() and player.running:
|
||||
monitor.waitForAbort(10)
|
||||
#LOG('**** waiting')
|
||||
if is_sport_channel and player.isPlaying():
|
||||
now = time.time()
|
||||
if now - last_time >= 15*60:
|
||||
last_time = now
|
||||
if player.isPlaying() and watermarks:
|
||||
now = isodate2date(datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ'))
|
||||
for wm in list(watermarks):
|
||||
start = isodate2date(wm['start'])
|
||||
stop = isodate2date(wm['stop'])
|
||||
if now >= start:
|
||||
watermarks.remove(wm)
|
||||
if now < stop:
|
||||
duration = (stop - start).total_seconds()
|
||||
#show_notification(m.account['id'], xbmcgui.NOTIFICATION_INFO)
|
||||
w = window.getWidth()
|
||||
h = window.getHeight()
|
||||
@@ -263,7 +278,7 @@ def play(params):
|
||||
pos_y = h-200
|
||||
label.setPosition(pos_x, pos_y)
|
||||
window.addControl(label)
|
||||
time.sleep(20)
|
||||
time.sleep(duration)
|
||||
window.removeControl(label)
|
||||
if session_opened:
|
||||
d = m.delete_session()
|
||||
@@ -383,6 +398,7 @@ def add_videos(category, ctype, videos, ref=None, url_next=None, url_prev=None,
|
||||
|
||||
url = get_url(action='play', id=t['id'], url=t['url'], session_request=t['session_request'], stype=t['stream_type'])
|
||||
if 'show_id' in t: url += '&show_id={}'.format(t['show_id'])
|
||||
if 'uid' in t: url += '&uid={}'.format(t['uid'])
|
||||
xbmcplugin.addDirectoryItem(_handle, url, list_item, False)
|
||||
elif t['type'] == 'series':
|
||||
list_item = xbmcgui.ListItem(label = title_name)
|
||||
@@ -480,7 +496,6 @@ def list_profiles(params):
|
||||
|
||||
def list_epg(params):
|
||||
LOG('list_epg: {}'.format(params))
|
||||
from datetime import datetime, timedelta
|
||||
from .timeconv import my_strftime
|
||||
if 'id' in params:
|
||||
if not 'date' in params:
|
||||
@@ -725,7 +740,7 @@ def create_iptv_settings():
|
||||
show_notification(addon.getLocalizedString(30319), xbmcgui.NOTIFICATION_INFO)
|
||||
output_file = 'instance-settings-91.xml' if kodi_version > 19 else 'settings.xml'
|
||||
epg_url = None
|
||||
if addon.getSettingBool('use_external_epg'):
|
||||
if False: #addon.getSettingBool('use_external_epg'):
|
||||
epg_url = addon.getSetting('epg_url')
|
||||
try:
|
||||
pvr_addon = xbmcaddon.Addon('pvr.iptvsimple')
|
||||
@@ -752,7 +767,7 @@ def export_epg_now():
|
||||
show_notification(addon.getLocalizedString(30310), xbmcgui.NOTIFICATION_INFO)
|
||||
m.export_channels_to_m3u8(channels_filename, only_subscribed)
|
||||
|
||||
if not addon.getSettingBool('use_external_epg'):
|
||||
if True: #not addon.getSettingBool('use_external_epg'):
|
||||
show_notification(addon.getLocalizedString(30311), xbmcgui.NOTIFICATION_INFO)
|
||||
m.export_epg_to_xml(epg_filename, addon.getSettingInt('export_days'), report_progress, only_subscribed)
|
||||
|
||||
|
||||
@@ -50,9 +50,11 @@
|
||||
<setting label="30316" type="action" id="create_iptv_settings" action="RunPlugin(plugin://plugin.video.movistarplus/?action=create_iptv_settings)" option="close"/>
|
||||
|
||||
<setting type="sep"/>
|
||||
<!--
|
||||
<setting label="30317" type="bool" id="use_external_epg" default="true"/>
|
||||
<setting label="30318" id="epg_url" type="text" default="https://raw.githubusercontent.com/davidmuma/EPG_dobleM/master/guiafanart_color.xml.gz" enable="eq(-1,true)"/>
|
||||
<setting type="sep"/>
|
||||
-->
|
||||
|
||||
<setting label="30305" type="bool" id="export_epg" default="false"/>
|
||||
<setting label="30315" type="number" id="export_days" default="2" enable="eq(-1,true)"/>
|
||||
|
||||
Reference in new issue
Block a user