Version 0.6.5

This commit is contained in:
Paco8 committed 2023-02-27 15:50:32 +01:00
1 parent f8892a15e0
commit 9908271e9d
8 files changed
+158 -39

No files matched your search

+19 -19
View File
@@ -69,31 +69,31 @@ El plugin modifica los subtítulos de la TV a la carta para que aparezcan correc
---
## Soporte para IPTV
Se ha añadido soporte para IPTV Manager. Esto permite ver los canales en un entorno más parecido a un receptor de TV, y hacer zapping con los botones arriba y abajo y OK. Unas capturas:
Opcionalmente es posible configurar el plugin para IPTV. Esto permite ver los canales en un entorno más parecido a un receptor de TV, y hacer zapping con los botones arriba y abajo y OK. Unas capturas:
<img src="https://github.com/Paco8/plugin.video.movistarplus/raw/main/resources/screen4.jpg" width="600"/>
<img src="https://github.com/Paco8/plugin.video.movistarplus/raw/main/resources/screen5.jpg" width="600"/>
A continuación van las instrucciones para configurarlo, pero **todo esto es opcional, el addon se puede usar perfectamente sin IPTV**.
A continuación van las instrucciones para configurarlo. Es necesario instalar el plugin `IPTV Simple Client`. Se encargará de mostrar los canales y la guía en el apartado TV de Kodi.
Este plugin lo puedes encontrar en Addons, Mis addons, Clientes PVR, con el nombre **PVR IPTV Simple Client**. En el caso de que ya estuviera instalado pero desactivarlo hay que activarlo.
Es necesario instalar y configurar otros dos addons: ITPV Manager y IPTV Simple Client. El primero se ocupará de obtener periódicamente el listado de canales de Movistarplus y la programación de los canales, y se la proporcionará a IPTV Simple Client, que es el addon que se encarga de mostrar los canales y la guía en la sección TV de Kodi.
Una vez instalado IPTV Simple Client vamos a los ajustes de Movistarplus.
- Abre los ajustes del addon y ve a la sección "IPTV Manager".
- Selecciona la opción "Instalar IPTV Manager". Acepta el diálogo para instalar el addon y sus dependencias.
- Vuelve a los ajustes Movistarplus, sección "IPTV Manager" y activa la opción "Habilitar integración con IPTV Manager".
- Selecciona la opción "Opciones de IPTV Manager".
- En la nueva ventana selecciona la sección "IPTV Simple" y dale a "Configure IPTV Simple automatically".
- Ve a la sección "Channels" y selecciona "Refresh channels and guide now".
- En la sección **IPTV** activamos la opción **Exportar automáticamente canales y guía para IPTV**.
- En la opción **Guardar en esta carpeta** tenemos que seleccionar una carpeta donde se guardará esa información. Puedes usar la carpeta `download` o cualquier otra, o crear una nueva.
- Hecho esto salimos de Kodi y volvemos a entrar.
- Esperamos unos segundos hasta que aparezca una notificación en la parte superior izquierda indicando que Movistarplus ha exportado los canales y la guía.
- Entramos otra vez en los ajustes de Movistarplus.
- En la sección **IPTV** seleccionamos **Abrir la configuración de IPTV Simple**.
- (**Kodi 20**) Seleccionamos "Añadir configuración de Addon". En nombre le ponemos por ejemplo `Movistarplus`.
- En la nueva ventana que se abre seleccionamos en Ubicación "Local path".
- En "Ruta a la lista M3U" nos vamos a la carpeta que habíamos elegido para exportar los datos de Movistarplus y seleccionamos el fichero `movistar-channels.m3u8`
- Ahora vamos a la sección **EPG**, y en Ubucación seleccionamos "Local path".
- En "Ruta XMLTV" nos vamos a la carpeta que habíamos elegido para exportar los datos de Movistarplus y seleccionamos el fichero `movistar-epg.xml`
- (Opcionalmente) En la sección **Catchup** activamos la opción "Enable catchup".
- Aceptamos los cambios.
- (**Kodi 20**) Cuando vuelva a salir otra vez la ventana "Ajustes y configuraciones de Addon" pulsamos en Cancelar.
- Reiniciamos Kodi.
Si todo ha ido bien ahora en la sección TV de Kodi podrás acceder a los canales y a la guía de Movistarplus.
**NOTA sobre Kodi 20**
En el momento de escribir estas líneas la configuración automática de **IPTV Simple** no se realiza correctamente en Kodi 20, debidos a cambios en este addon. Y hay que realizarla a mano:
- Entra en los ajustes del addon IPTV Manager y selecciona la opción "IPTV Simple".
- Dale a la opción "Open IPTV Simple settings".
- En la nueva ventana, en Ubicación seleciona "Ruta remota".
- En la opción "URL a la lista M3U", introduce esto: `special://profile/addon_data/service.iptv.manager/playlist.m3u8`
- En la sección "Opciones EPG", en Ubicación selecciona "Ruta remota".
- En "URL XMLTV" introduce esto: `special://profile/addon_data/service.iptv.manager/epg.xml`
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.movistarplus"
name="Movistar+"
version="0.5.20"
version="0.6.5"
provider-name="Paco8">
<requires>
<!--- <import addon="xbmc.python" version="2.25.0"/> -->
@@ -288,3 +288,31 @@ msgstr ""
msgctxt "#30303"
msgid "IPTV Manager settings"
msgstr ""
msgctxt "#30304"
msgid "IPTV"
msgstr ""
msgctxt "#30305"
msgid "Export channels and EPG for IPTV automatically"
msgstr ""
msgctxt "#30306"
msgid "Save to this folder (requires restart)"
msgstr ""
msgctxt "#30307"
msgid "Install IPTV Simple add-on"
msgstr ""
msgctxt "#30308"
msgid "Open IPTV Simple settings"
msgstr ""
msgctxt "#30310"
msgid "Exporting channels"
msgstr ""
msgctxt "#30311"
msgid "Exporting EPG"
msgstr ""
@@ -288,3 +288,27 @@ msgstr "Habilitar integración con IPTV Manager"
msgctxt "#30303"
msgid "IPTV Manager settings"
msgstr "Opciones de IPTV Manager"
msgctxt "#30305"
msgid "Export channels and EPG for IPTV automatically"
msgstr "Exportar automáticamente canales y guía para IPTV"
msgctxt "#30306"
msgid "Save to this folder (requires restart)"
msgstr "Guardar en esta carpeta (requiere reinicio)"
msgctxt "#30307"
msgid "Install IPTV Simple add-on"
msgstr "Instalar el addon IPTV Simple"
msgctxt "#30308"
msgid "Open IPTV Simple settings"
msgstr "Abrir la configuración de IPTV Simple"
msgctxt "#30310"
msgid "Exporting channels"
msgstr "Exportando canales"
msgctxt "#30311"
msgid "Exporting EPG"
msgstr "Exportando guía"
+25 -12
View File
@@ -1021,13 +1021,13 @@ class Movistar(object):
from urllib.parse import urlencode
else:
from urllib import urlencode
now = time.time()*1000
#now = time.time()*1000
res = {}
epg = self.get_epg()
channels = self.get_channels(False)
for channel in channels:
if not channel['subscribed']: continue
id = channel['id']
if not channel['subscribed'] or not id in epg: continue
res[id] = []
for e in epg[id]:
t = {}
@@ -1036,8 +1036,9 @@ class Movistar(object):
t['start'] = datetime.utcfromtimestamp(e['start']/1000).strftime('%Y-%m-%dT%H:%M:%SZ')
t['stop'] = datetime.utcfromtimestamp(e['end']/1000).strftime('%Y-%m-%dT%H:%M:%SZ')
aired = (e['end'] <= now)
if aired:
#aired = (e['end'] <= now)
#if aired:
if True:
program_id = str(e['show_id'])
url = 'https://grmovistar.imagenio.telefonica.net/asfe/rest/tvMediaURLs?tvProgram.id='+ program_id +'&svc=startover'
session_request = '{"contentID":' + program_id +',"streamType":"CUTV"}'
@@ -1076,19 +1077,31 @@ class Movistar(object):
epg = self.export_epg()
for ch in channels:
if not ch['id'] in epg: continue
for e in epg[ch['id']]:
start = datetime.strptime(e['start'], "%Y-%m-%dT%H:%M:%SZ").strftime("%Y%m%d%H%M%S +0000")
stop = datetime.strptime(e['stop'], "%Y-%m-%dT%H:%M:%SZ").strftime("%Y%m%d%H%M%S +0000")
url = e.get('stream', None)
if url:
url = url.replace('&', '&amp;')
res.append('<programme start="{}" stop="{}" channel="{}"'.format(start, stop, ch['id']) +
(' catchup-id="{}"'.format(url) if url else "") +
'>\n' +
' <title>{}</title>\n'.format(e['title']) +
' <sub-title>{}</sub-title>'.format(e['subtitle']) +
'</programme>\n')
url = url.replace('&', '&amp;')
res.append('<programme start="{}" stop="{}" channel="{}"'.format(start, stop, ch['id']) +
(' catchup-id="{}"'.format(url) if url else "") +
'>\n' +
' <title>{}</title>\n'.format(e['title']) +
' <sub-title>{}</sub-title>\n'.format(e['subtitle']))
if 'image' in e:
res.append(' <icon src="{}"/>\n'.format(e['image']))
if 'description' in e:
res.append(' <desc>{}</desc>\n'.format(e['description']))
if 'credits' in e and len(e['credits']) > 0:
res.append(' <credits>\n');
for c in e['credits']:
if c['type'] == 'director':
res.append(' <director>{}</director>\n'.format(c['name']))
elif c['type'] == 'actor':
res.append(' <actor>{}</actor>\n'.format(c['name']))
res.append(' </credits>\n');
res.append('</programme>\n')
res.append('</tv>\n')
with io.open(filename, 'w', encoding='utf-8', newline='') as handle:
handle.write(''.join(res))
+6 -5
View File
@@ -237,8 +237,8 @@ def add_videos(category, ctype, videos, ref=None, url_next=None, url_prev=None):
list_item.setInfo('video', t['info'])
list_item.setArt(t['art'])
if t.get('stream_type') == 'u7d' and not t.get('aired', False):
record_program_action = (addon.getLocalizedString(30171), "RunPlugin(" + get_url(action='add_recording', id=t['id']) + ")")
if t.get('stream_type') == 'u7d' and 'show_id' in t and not t.get('aired', False):
record_program_action = (addon.getLocalizedString(30171), "RunPlugin(" + get_url(action='add_recording', id=t['show_id']) + ")")
list_item.addContextMenuItems([record_program_action])
if 'rec' in t:
@@ -478,15 +478,16 @@ def list_users():
def iptv(params):
LOG('iptv: params: {}'.format(params))
if m.logged:
try:
#try:
if True:
from .iptvmanager import IPTVManager
port = int(params['port'])
if params['action'] == 'iptv-channels':
IPTVManager(port).send_channels(m)
elif params['action'] == 'iptv-epg':
IPTVManager(port).send_epg(m)
except:
pass
#except:
# pass
def router(paramstring):
"""
+11 -2
View File
@@ -6,8 +6,8 @@
<setting id="use_ttml2ssa" type="bool" label="$ADDON[script.module.ttml2ssa 32202]" default="false"/>
<setting id="ssa_settings" type="action" label="$ADDON[script.module.ttml2ssa 32201]" option="close" action="Addon.OpenSettings(script.module.ttml2ssa)" enable="eq(-1,true)" subsetting="true"/>
<setting label="30019" type="action" id="is_settings" action="Addon.OpenSettings(inputstream.adaptive)" enable="System.HasAddon(inputstream.adaptive)" option="close"/>
<setting id="reuse_devices" type="bool" label="30023" default="false" visible="true"/>
<setting id="open_session" type="bool" label="30022" default="true" visible="true"/>
<setting id="reuse_devices" type="bool" label="30023" default="false" visible="false"/>
<setting id="open_session" type="bool" label="30022" default="true" visible="false"/>
<setting type="sep"/>
<setting id="profile_id" type="labelenum" label="Profile ID" values="Auto|OTT|NODTH"/>
</category>
@@ -21,12 +21,21 @@
<setting label="30010" type="labelenum" id="drm_type" values="Widevine|Playready"/>
</category>
-->
<!--
<category label="30300">
<setting label="30300" type="lsep"/>
<setting label="30301" type="action" action="InstallAddon(service.iptv.manager)" option="close" visible="!System.HasAddon(service.iptv.manager)"/>
<setting label="30302" type="bool" id="iptv.enabled" default="true" visible="System.HasAddon(service.iptv.manager)" />
<setting label="30303" type="action" action="Addon.OpenSettings(service.iptv.manager)" enable="eq(-1,true)" option="close" visible="System.HasAddon(service.iptv.manager)" subsetting="true"/>
<setting id="iptv.channels_uri" default="plugin://plugin.video.movistarplus/iptv/channels" visible="false"/>
<setting id="iptv.epg_uri" default="plugin://plugin.video.movistarplus/iptv/epg" visible="false"/>
</category>
-->
<category label="30304">
<setting label="30305" type="bool" id="export_epg" default="false"/>
<setting label="30306" type="folder" id="epg_folder" source="" default="" option="writeable" enable="eq(-1,true)" subsetting="true"/>
<setting label="30307" type="action" action="InstallAddon(pvr.iptvsimple)" option="close" visible="!System.HasAddon(pvr.iptvsimple)" enable="eq(-2,true)" subsetting="true"/>
<setting label="30308" type="action" action="Addon.OpenSettings(pvr.iptvsimple)" option="close" visible="System.HasAddon(pvr.iptvsimple)" enable="eq(-3,true)" subsetting="true"/>
</category>
</settings>
+44
View File
@@ -5,11 +5,49 @@ from __future__ import unicode_literals
import os
import xbmc
import xbmcgui
from resources.lib.proxy import Proxy
from resources.lib.addon import *
from resources.lib.log import LOG
from resources.lib.cache import Cache
def export_epg():
from datetime import datetime, timedelta
from resources.lib.gui import show_notification
def needs_update(filename):
if os.path.exists(filename):
file_modification_time = datetime.fromtimestamp(os.path.getmtime(filename))
return datetime.now() - file_modification_time > timedelta(hours=6)
return True
folder = addon.getSetting('epg_folder')
if sys.version_info[0] > 2:
folder = bytes(folder, 'utf-8')
LOG('folder for channels and epg: {}'.format(folder))
if not folder or not os.path.isdir(folder): return
channels_filename = os.path.join(folder, b"movistar-channels.m3u8")
epg_filename = os.path.join(folder, b"movistar-epg.xml")
LOG('channels filename: {}'.format(channels_filename))
LOG('epg filename: {}'.format(epg_filename))
channels_needs_update = needs_update(channels_filename)
epg_needs_update = needs_update(epg_filename)
LOG('channels_needs_update: {} epg_needs_update: {}'.format(channels_needs_update, epg_needs_update))
if channels_needs_update or epg_needs_update:
from resources.lib.movistar import Movistar
reuse_devices = addon.getSettingBool('reuse_devices')
m = Movistar(profile_dir, reuse_devices)
if not m.logged: return
if channels_needs_update:
show_notification(addon.getLocalizedString(30310), xbmcgui.NOTIFICATION_INFO)
m.export_channels_to_m3u8(channels_filename)
if epg_needs_update:
show_notification(addon.getLocalizedString(30311), xbmcgui.NOTIFICATION_INFO)
m.export_epg_to_xml(epg_filename)
if __name__ == '__main__':
LOG('Service started')
proxy = Proxy()
@@ -18,6 +56,12 @@ if __name__ == '__main__':
cache = Cache(profile_dir)
cache.save_file('proxy.conf', proxy.proxy_address)
if addon.getSettingBool('export_epg'):
try:
export_epg()
except:
pass
monitor = xbmc.Monitor()
while not monitor.abortRequested():
if monitor.waitForAbort(1):