1.0.0+kodimov.11: Movistar's channel numbers with more than one IPTV Simple instance

- Kodi only lets "use channel numbers from backend" be read or changed while
  it applies: one PVR instance loaded, or several and "always" on. With a
  second instance (Radios de Vigo, a leftover empty one) it refused the
  setting the TV guide setup made, and numbered the channels 1, 2, 3...
- The service now checks it every 30 minutes and after the setup: if the
  setting is hidden it turns "always" on, and it turns the setting on once
  (marker file numbers-set). It never turns anything off, and turning it off
  by hand afterwards is respected. Existing setups are put right this way.
- KodiMov+ and Radios de Vigo take turns to restart IPTV Simple, through the
  pvr.iptvsimple.restarting property of Kodi's home window.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
XoséandClaude Fable 5.2 committed 2026-11-13 13:41:35 +01:00
1 parent e72e3d4902
commit b3bc561c35
5 files changed
+84 -5

No files matched your search

+1
View File
@@ -15,6 +15,7 @@ What it adds:
- **Hides channels it can't play**: Movistar marks football and premium sports with `QMWatermark`; M+ Deportes, DAZN and DAZN Baloncesto play and are kept, the rest of the marked ones are hidden unless they come through the new servers (`resources/lib/kodimov.py`). - **Hides channels it can't play**: Movistar marks football and premium sports with `QMWatermark`; M+ Deportes, DAZN and DAZN Baloncesto play and are kept, the rest of the marked ones are hidden unless they come through the new servers (`resources/lib/kodimov.py`).
- **Extra free channels** in the TV guide list: TVG2 (10) and TeleVigo (15). - **Extra free channels** in the TV guide list: TVG2 (10) and TeleVigo (15).
- **The TV guide stays current**: channel list and programme guide re-exported every 6 hours, numbered with Movistar's own dial numbers. Listings come from Movistar (with catch-up links) for its channels and from the public EPG_dobleM guide for the extras. - **The TV guide stays current**: channel list and programme guide re-exported every 6 hours, numbered with Movistar's own dial numbers. Listings come from Movistar (with catch-up links) for its channels and from the public EPG_dobleM guide for the extras.
- **Gets along with Radios de Vigo** (`service.radios.vigo`), which keeps its own IPTV Simple instance for the Radio section. Kodi only lets *Use channel numbers from backend* be changed while it applies (one PVR instance loaded, or several and *always* on), so with a second instance it had refused the setting. Both add-ons now check it every so often: if it is hidden they turn *always* on, and they turn the setting itself on once; neither ever turns anything off, and turning it off by hand afterwards is respected. They also take turns to restart IPTV Simple, through the `pvr.iptvsimple.restarting` property of Kodi's home window.
- Fixes the programme guide export of upstream 1.0.0 (the amazon.tv guide is a flat list). - Fixes the programme guide export of upstream 1.0.0 (the amazon.tv guide is a flat list).
- Its own proxy port (57031), so it can run next to the original. - Its own proxy port (57031), so it can run next to the original.
+3 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.kodimovplus" <addon id="plugin.video.kodimovplus"
name="KodiMov+" name="KodiMov+"
version="1.0.0+kodimov.10" version="1.0.0+kodimov.11"
provider-name="Paco8, xocko"> provider-name="Paco8, xocko">
<requires> <requires>
<!--- <import addon="xbmc.python" version="2.25.0"/> --> <!--- <import addon="xbmc.python" version="2.25.0"/> -->
@@ -21,7 +21,8 @@
<summary lang="es_ES">Movistar+ para Kodi, con inicio de sesión automático desde la red de Movistar</summary> <summary lang="es_ES">Movistar+ para Kodi, con inicio de sesión automático desde la red de Movistar</summary>
<description lang="en_GB">Fork of Paco8's Movistar+ add-on (plugin.video.movistarplus). Logs in by itself from the Movistar home network, keeps the channel list and numbers up to date, plays the LALIGA, DAZN LALIGA and Liga de Campeones channels through Movistar's new servers (from the Movistar home network), hides the channels it can't play, adds free Galician channels (TVG2, TeleVigo) and writes a programme guide for every channel. Requires a Movistar+ subscription.</description> <description lang="en_GB">Fork of Paco8's Movistar+ add-on (plugin.video.movistarplus). Logs in by itself from the Movistar home network, keeps the channel list and numbers up to date, plays the LALIGA, DAZN LALIGA and Liga de Campeones channels through Movistar's new servers (from the Movistar home network), hides the channels it can't play, adds free Galician channels (TVG2, TeleVigo) and writes a programme guide for every channel. Requires a Movistar+ subscription.</description>
<description lang="es_ES">Fork del addon Movistar+ de Paco8 (plugin.video.movistarplus). Inicia sesión solo desde la red de Movistar, mantiene la lista y los números de los canales al día, reproduce los canales de LALIGA, DAZN LALIGA y Liga de Campeones a través de los servidores nuevos de Movistar (desde la red de Movistar de casa), oculta los canales que no puede reproducir, añade canales gallegos gratuitos (TVG2, TeleVigo) y genera la guía de programación de todos los canales. Se necesita estar abonado a Movistar+.</description> <description lang="es_ES">Fork del addon Movistar+ de Paco8 (plugin.video.movistarplus). Inicia sesión solo desde la red de Movistar, mantiene la lista y los números de los canales al día, reproduce los canales de LALIGA, DAZN LALIGA y Liga de Campeones a través de los servidores nuevos de Movistar (desde la red de Movistar de casa), oculta los canales que no puede reproducir, añade canales gallegos gratuitos (TVG2, TeleVigo) y genera la guía de programación de todos los canales. Se necesita estar abonado a Movistar+.</description>
<news>1.0.0+kodimov.10: the LALIGA, DAZN LALIGA and Liga de Campeones channels are back, live and catch-up, on boxes connected to the Movistar home network (their streams are now served only through Movistar's new servers). New setting to always play at the best quality, up to 1080p, instead of the 576p Kodi stays at on automatic (off by default). The "Error 4027" message no longer pops up when the add-on recovers from it by itself. <news>1.0.0+kodimov.11: Movistar's channel numbers also show on boxes with more than one IPTV Simple instance (Radios de Vigo, a leftover empty one), where Kodi had refused the setting and numbered the channels 1, 2, 3...; existing TV guide setups are put right by themselves. KodiMov+ and Radios de Vigo no longer restart IPTV Simple at the same time.
1.0.0+kodimov.10: the LALIGA, DAZN LALIGA and Liga de Campeones channels are back, live and catch-up, on boxes connected to the Movistar home network (their streams are now served only through Movistar's new servers). New setting to always play at the best quality, up to 1080p, instead of the 576p Kodi stays at on automatic (off by default). The "Error 4027" message no longer pops up when the add-on recovers from it by itself.
1.0.0+kodimov.9: after Kodi starts or the add-on updates, a new programme guide shows up in Kodi within a couple of minutes instead of at the next hourly reload (only while nothing is playing). 1.0.0+kodimov.9: after Kodi starts or the add-on updates, a new programme guide shows up in Kodi within a couple of minutes instead of at the next hourly reload (only while nothing is playing).
1.0.0+kodimov.8: the programme guide refresh no longer fails at random inside Kodi, and a failed refresh is tried again half an hour later instead of 6 hours later. 1.0.0+kodimov.8: the programme guide refresh no longer fails at random inside Kodi, and a failed refresh is tried again half an hour later instead of 6 hours later.
1.0.0+kodimov.7: the programme guide has the synopsis, picture, genre, year and age rating of each programme. IPTV Simple now reloads the guide every hour instead of once a day, so a new guide shows up in Kodi by itself (existing TV guide setups are switched over once). 1.0.0+kodimov.7: the programme guide has the synopsis, picture, genre, year and age rating of each programme. IPTV Simple now reloads the guide every hour instead of once a day, so a new guide shows up in Kodi by itself (existing TV guide setups are switched over once).
+68
View File
@@ -494,13 +494,81 @@ def reload_iptv_guide(pvr_dir, addon_id):
restart_iptv_simple() restart_iptv_simple()
# IPTV Simple is shared with other add-ons (Radios de Vigo keeps its own
# instance for the Radio section). Restarting it restarts every instance, so
# the add-ons take turns: whoever restarts it says so in this property of
# Kodi's home window (the time it started), and the others wait.
IPTV_RESTART_PROPERTY = 'pvr.iptvsimple.restarting'
def restart_iptv_simple(): def restart_iptv_simple():
"""Restarts IPTV Simple so it loads its instance settings again.""" """Restarts IPTV Simple so it loads its instance settings again."""
import xbmc import xbmc
import xbmcgui
window = xbmcgui.Window(10000)
for _ in range(40): # another add-on is restarting it: wait (a turn older than 20 s is stale)
try:
busy = 0 <= time.time() - float(window.getProperty(IPTV_RESTART_PROPERTY) or 0) < 20
except ValueError:
busy = False
if not busy: break
xbmc.sleep(1000)
window.setProperty(IPTV_RESTART_PROPERTY, str(time.time()))
try:
for enabled in (False, True): for enabled in (False, True):
xbmc.executeJSONRPC(json.dumps({'jsonrpc': '2.0', 'id': 1, 'method': 'Addons.SetAddonEnabled', xbmc.executeJSONRPC(json.dumps({'jsonrpc': '2.0', 'id': 1, 'method': 'Addons.SetAddonEnabled',
'params': {'addonid': 'pvr.iptvsimple', 'enabled': enabled}})) 'params': {'addonid': 'pvr.iptvsimple', 'enabled': enabled}}))
xbmc.sleep(3000) xbmc.sleep(3000)
finally:
window.clearProperty(IPTV_RESTART_PROPERTY)
def has_iptv_instance(pvr_dir, addon_id):
"""True if an IPTV Simple instance reads this add-on's channel list."""
import glob
for filename in glob.glob(os.path.join(pvr_dir, 'instance-settings-*.xml')):
try:
with io.open(filename, 'r', encoding='utf-8') as f:
if 'plugin.video.{}/channels.m3u8'.format(addon_id) in f.read(): return True
except (IOError, OSError):
pass
return False
def ensure_channel_numbers(marker):
"""Makes Kodi show the channel numbers of the list (Movistar's dial
numbers) instead of 1, 2, 3...
Kodi only lets "use channel numbers from backend" be read or changed while
it applies: with exactly one PVR instance loaded, or with several and the
"always" setting on. Radios de Vigo adds an instance of IPTV Simple and
some boxes carry a leftover empty one, so the setting can stop applying
after it was turned on. This is called now and then and puts it right:
- hidden: turns "always" on, which brings the stored value back;
- off and never turned on by this add-on (no marker file): turns it on;
- off after this add-on turned it on once: the user's choice, left alone.
It never turns anything off, so it can't undo what Radios de Vigo needs.
Returns True when Kodi is using the numbers of the list."""
import xbmc
def rpc(method, **params):
try:
return json.loads(xbmc.executeJSONRPC(json.dumps({'jsonrpc': '2.0', 'id': 1, 'method': method, 'params': params})))
except ValueError:
return {}
def numbers():
return (rpc('Settings.GetSettingValue', setting='pvrmanager.usebackendchannelnumbers').get('result') or {}).get('value')
value = numbers()
if value is None:
rpc('Settings.SetSettingValue', setting='pvrmanager.usebackendchannelnumbersalways', value=True)
value = numbers()
if value is None: return False # IPTV Simple isn't loaded right now: try later
if value is False and not os.path.exists(marker):
rpc('Settings.SetSettingValue', setting='pvrmanager.usebackendchannelnumbers', value=True)
value = numbers()
if value is True and not os.path.exists(marker):
write_if_changed(marker, '1')
LOG('ensure_channel_numbers: on')
return value is True
def extra_channels_xmltv(session): def extra_channels_xmltv(session):
+7 -3
View File
@@ -794,11 +794,15 @@ def create_iptv_settings():
save_iptv_settings(filename, 'KodiMov+', 'kodimovplus', epg_url) save_iptv_settings(filename, 'KodiMov+', 'kodimovplus', epg_url)
# IPTV Simple now reads epg.xml, so the service must keep it up to date. # IPTV Simple now reads epg.xml, so the service must keep it up to date.
addon.setSettingBool('auto_export_epg', True) addon.setSettingBool('auto_export_epg', True)
# Show Movistar's own channel numbers instead of 1, 2, 3...
xbmc.executeJSONRPC(json.dumps({'jsonrpc': '2.0', 'id': 1, 'method': 'Settings.SetSettingValue',
'params': {'setting': 'pvrmanager.usebackendchannelnumbers', 'value': True}}))
# Restart IPTV Simple so it loads the new instance and channel list. # Restart IPTV Simple so it loads the new instance and channel list.
kodimov.restart_iptv_simple() kodimov.restart_iptv_simple()
# Show Movistar's own channel numbers instead of 1, 2, 3... Kodi only
# accepts it once IPTV Simple is back; the service keeps trying otherwise.
numbers_set = os.path.join(profile_dir, 'numbers-set')
if os.path.exists(numbers_set): os.remove(numbers_set)
for _ in range(5):
if kodimov.ensure_channel_numbers(numbers_set): break
xbmc.sleep(2000)
except: except:
show_notification(addon.getLocalizedString(30324)) show_notification(addon.getLocalizedString(30324))
+5
View File
@@ -35,6 +35,7 @@ if __name__ == '__main__':
pvr_dir = translatePath(xbmcaddon.Addon('pvr.iptvsimple').getAddonInfo('profile')) pvr_dir = translatePath(xbmcaddon.Addon('pvr.iptvsimple').getAddonInfo('profile'))
restart_iptv = kodimov.set_iptv_refresh(pvr_dir, 'kodimovplus') restart_iptv = kodimov.set_iptv_refresh(pvr_dir, 'kodimovplus')
except RuntimeError: # IPTV Simple not installed or disabled except RuntimeError: # IPTV Simple not installed or disabled
pvr_dir = None
restart_iptv = False restart_iptv = False
player = xbmc.Player() player = xbmc.Player()
monitor = xbmc.Monitor() monitor = xbmc.Monitor()
@@ -47,6 +48,10 @@ if __name__ == '__main__':
if time.time() >= next_check: if time.time() >= next_check:
next_check = time.time() + 30 * 60 next_check = time.time() + 30 * 60
exporting = False exporting = False
# Movistar's channel numbers in Kodi's TV section, also when another
# add-on (Radios de Vigo) adds its own IPTV Simple instance
if pvr_dir and kodimov.has_iptv_instance(pvr_dir, 'kodimovplus'):
kodimov.ensure_channel_numbers(os.path.join(profile_dir, 'numbers-set'))
age_limit, max_age = max_age, 6 * 3600 - 120 age_limit, max_age = max_age, 6 * 3600 - 120
# After Kodi starts (or this add-on updates) also get the new guide into Kodi now # After Kodi starts (or this add-on updates) also get the new guide into Kodi now
reload_guide = '&reload_guide=1' if age_limit == 0 else '' reload_guide = '&reload_guide=1' if age_limit == 0 else ''