Version 0.8.16
This commit is contained in:
1 parent
00713ab826
commit
bde972d7cd
6 files changed
+70
-12
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.8.14"
|
||||
version="0.8.16"
|
||||
provider-name="Paco8">
|
||||
<requires>
|
||||
<!--- <import addon="xbmc.python" version="2.25.0"/> -->
|
||||
|
||||
@@ -494,6 +494,21 @@ msgctxt "#30312"
|
||||
msgid "Export channels and EPG now"
|
||||
msgstr ""
|
||||
|
||||
# For Movistar only
|
||||
msgctxt "#30313"
|
||||
msgid "The EPG export has finished."
|
||||
msgstr ""
|
||||
|
||||
# For Movistar only
|
||||
msgctxt "#30314"
|
||||
msgid "Exporting {}"
|
||||
msgstr ""
|
||||
|
||||
# For Movistar only
|
||||
msgctxt "#30315"
|
||||
msgid "Number of days"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30320"
|
||||
msgid "Rating: {}"
|
||||
msgstr ""
|
||||
|
||||
@@ -459,6 +459,21 @@ msgctxt "#30312"
|
||||
msgid "Export channels and EPG now"
|
||||
msgstr "Exportar los canales y la guía ahora"
|
||||
|
||||
# For Movistar only
|
||||
msgctxt "#30313"
|
||||
msgid "The EPG export has finished."
|
||||
msgstr "Se ha terminado de exportar la EPG."
|
||||
|
||||
# For Movistar only
|
||||
msgctxt "#30314"
|
||||
msgid "Exporting {}"
|
||||
msgstr "Exportando {}"
|
||||
|
||||
# For Movistar only
|
||||
msgctxt "#30315"
|
||||
msgid "Number of days"
|
||||
msgstr "Número de días"
|
||||
|
||||
msgctxt "#30320"
|
||||
msgid "Rating: {}"
|
||||
msgstr "Calificación: {}"
|
||||
|
||||
+33
-10
@@ -11,7 +11,7 @@ import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from .endpoints import endpoints
|
||||
from .log import LOG, print_json
|
||||
@@ -472,14 +472,17 @@ class Movistar(object):
|
||||
return data
|
||||
|
||||
def get_epg(self, date=None, duration=2, channels=None):
|
||||
if channels:
|
||||
if channels or date:
|
||||
if not date:
|
||||
today = datetime.today()
|
||||
date = today.strftime('%Y-%m-%dT00:00:00')
|
||||
ch_data = self.load_epg_data(date, duration, channels)
|
||||
if not ch_data or 'error' in ch_data: return {}
|
||||
data = []
|
||||
data.append(ch_data)
|
||||
epg_data = self.load_epg_data(date, duration, channels if channels else '')
|
||||
if not epg_data or 'error' in epg_data: return {}
|
||||
if channels:
|
||||
data = []
|
||||
data.append(epg_data)
|
||||
else:
|
||||
data = epg_data
|
||||
else:
|
||||
cache_filename = 'epg_{}.json'.format(self.quality)
|
||||
content = self.cache.load(cache_filename, 6*60)
|
||||
@@ -1288,14 +1291,15 @@ class Movistar(object):
|
||||
with io.open(filename, 'w', encoding='utf-8', newline='') as handle:
|
||||
handle.write(res)
|
||||
|
||||
def export_epg(self):
|
||||
def export_epg(self, date=None, duration=2):
|
||||
if sys.version_info[0] >= 3:
|
||||
from urllib.parse import urlencode
|
||||
else:
|
||||
from urllib import urlencode
|
||||
#now = time.time()*1000
|
||||
|
||||
res = {}
|
||||
epg = self.get_epg()
|
||||
epg = self.get_epg(date, duration)
|
||||
channels = self.get_channels()
|
||||
for channel in channels:
|
||||
id = channel['id']
|
||||
@@ -1334,7 +1338,7 @@ class Movistar(object):
|
||||
res[id].append(t)
|
||||
return res
|
||||
|
||||
def export_epg_to_xml(self, filename):
|
||||
def export_epg_to_xml(self, filename, ndays=3, report_func=None):
|
||||
if sys.version_info[0] < 3:
|
||||
# Python 2
|
||||
from cgi import escape as html_escape
|
||||
@@ -1354,7 +1358,26 @@ class Movistar(object):
|
||||
' <icon src="{}"/>\n'.format(t['logo']) +
|
||||
'</channel>\n')
|
||||
|
||||
epg = self.export_epg()
|
||||
if True:
|
||||
epg = {}
|
||||
today = datetime.today()
|
||||
total_items = 0
|
||||
for i in range(0, ndays, 1):
|
||||
date = today + timedelta(days=i)
|
||||
strdate = date.strftime('%Y-%m-%dT00:00:00')
|
||||
LOG('epg: {}'.format(strdate))
|
||||
if report_func:
|
||||
report_func(strdate.split('T')[0])
|
||||
e = self.export_epg(strdate, 1)
|
||||
LOG('epg: channels: {}'.format(len(e)))
|
||||
for ch in e:
|
||||
if not ch in epg: epg[ch] = []
|
||||
total_items += len(e[ch])
|
||||
epg[ch].extend(e[ch])
|
||||
LOG('epg: total items: {}'.format(total_items))
|
||||
else:
|
||||
epg = self.export_epg()
|
||||
|
||||
for ch in channels:
|
||||
if not ch['id'] in epg: continue
|
||||
for e in epg[ch['id']]:
|
||||
|
||||
@@ -622,6 +622,9 @@ def iptv(params):
|
||||
# pass
|
||||
|
||||
def export_epg_now():
|
||||
def report_progress(message):
|
||||
show_notification(addon.getLocalizedString(30314).format(message), xbmcgui.NOTIFICATION_INFO)
|
||||
|
||||
if not m.logged: return
|
||||
folder = addon.getSetting('epg_folder')
|
||||
if sys.version_info[0] > 2:
|
||||
@@ -632,7 +635,8 @@ def export_epg_now():
|
||||
show_notification(addon.getLocalizedString(30310), xbmcgui.NOTIFICATION_INFO)
|
||||
m.export_channels_to_m3u8(channels_filename)
|
||||
show_notification(addon.getLocalizedString(30311), xbmcgui.NOTIFICATION_INFO)
|
||||
m.export_epg_to_xml(epg_filename)
|
||||
m.export_epg_to_xml(epg_filename, addon.getSettingInt('export_days'), report_progress)
|
||||
show_notification(addon.getLocalizedString(30313), xbmcgui.NOTIFICATION_INFO)
|
||||
|
||||
def to_wishlist(params):
|
||||
stype = params['stype']
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<category label="30304">
|
||||
<setting label="30306" type="folder" id="epg_folder" source="" default="" option="writeable"/>
|
||||
<setting label="30305" type="bool" id="export_epg" default="false" enable="!eq(-1,)"/>
|
||||
<setting label="30315" type="number" id="export_days" default="3"/>
|
||||
<setting label="30308" type="action" action="Addon.OpenSettings(pvr.iptvsimple)" option="close" visible="System.HasAddon(pvr.iptvsimple)" 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="30312" type="action" id="export_epg_now" action="RunPlugin(plugin://plugin.video.movistarplus/?action=export_epg_now)" option="close" enable="!eq(-4,)"/>
|
||||
|
||||
Reference in new issue
Block a user