- New id plugin.video.kodimovplus, name KodiMov+, proxy port 57031 - Takes over the login of plugin.video.movistarplus on first run - Password-less login from the Movistar home network (autologin token traded for a classic token via the new servers' initData) - Hides the channels that can't play (LALIGA, Liga de Campeones) - Adds TVG2 and TeleVigo to the TV guide list - Re-exports the TV guide channel list every 6 hours Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
import os
|
|
import time
|
|
import xbmc
|
|
import xbmcgui
|
|
from resources.lib.proxy import Proxy
|
|
from resources.lib.addon import *
|
|
from resources.lib.log import LOG
|
|
|
|
def export_epg():
|
|
from datetime import datetime, timedelta
|
|
|
|
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
|
|
|
|
channels_filename = os.path.join(profile_dir, 'channels.m3u8')
|
|
epg_filename = os.path.join(profile_dir, '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:
|
|
xbmc.executebuiltin('RunPlugin(plugin://plugin.video.kodimovplus/?action=export_epg_now)')
|
|
|
|
if __name__ == '__main__':
|
|
LOG('Service started')
|
|
proxy = Proxy()
|
|
proxy.start()
|
|
LOG('proxy_address: {}'.format(proxy.proxy_address))
|
|
|
|
if addon.getSettingBool('export_epg'):
|
|
try:
|
|
export_epg()
|
|
except:
|
|
pass
|
|
|
|
# Refreshes the TV guide channel list (new channels, new numbers) every
|
|
# 6 hours. Opening the add-on also renews the 10-day Movistar login.
|
|
next_export = time.time() + 60
|
|
monitor = xbmc.Monitor()
|
|
while not monitor.abortRequested():
|
|
if monitor.waitForAbort(1):
|
|
break
|
|
if time.time() >= next_export:
|
|
next_export = time.time() + 6 * 3600
|
|
if addon.getSettingBool('export_channels') and not addon.getSettingBool('export_epg'):
|
|
xbmc.executebuiltin('RunPlugin(plugin://plugin.video.kodimovplus/?action=export_channels_now)')
|
|
|
|
proxy.stop()
|