Skip to content

Commit

Permalink
[autotimer] update support alternatives services
Browse files Browse the repository at this point in the history
-also correct a very ancient error in "Fast Scan"
  • Loading branch information
Dima73 authored and WanWizard committed Nov 13, 2024
1 parent 1c2d9e4 commit af9de31
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 57 deletions.
3 changes: 3 additions & 0 deletions autotimer/po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -1296,3 +1296,6 @@ msgstr "переключение"

msgid "zap and record"
msgstr "переключение и запись"

msgid "In case of changes, a GUI restart is required to apply the changes."
msgstr "В случае изменений, для применения потребуется рестарт GUI."
153 changes: 98 additions & 55 deletions autotimer/src/AutoTimerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class AutoTimerComponent(object):
def __init__(self, id, name, match, enabled, *args, **kwargs):
self.id = id
self._afterevent = []
self.alternativeServices = None
self.setValues(name, match, enabled, *args, **kwargs)

"""
Expand Down Expand Up @@ -119,6 +120,7 @@ def setBouquets(self, bouquets):
self._bouquets = bouquets
else:
self._bouquets = []
self.alternativeServices = None

bouquets = property(lambda self: self._bouquets, setBouquets)

Expand Down Expand Up @@ -175,6 +177,7 @@ def setServices(self, services):
self._services = services
else:
self._services = []
self.alternativeServices = None

services = property(lambda self: self._services, setServices)

Expand Down Expand Up @@ -443,10 +446,9 @@ def checkServices(self, check_service):
if mylist is not None:
while True:
s = mylist.getNext()
# TODO: I wonder if its sane to assume we get services here (and not just new lists)
# We can ignore markers & directorys here because they won't match any event's service :-)
if s.valid():
# strip all after last :
if s.flags & (eServiceReference.isMarker | eServiceReference.isDirectory | eServiceReference.isNumberedMarker):
continue
value = s.toString()
pos = value.rfind(':')
if pos != -1:
Expand All @@ -472,29 +474,51 @@ def checkServices(self, check_service):

def getAlternative(self, override_service):
services = self.services
if services:
bouquets = self.bouquets
if services or bouquets:
serviceHandler = eServiceCenter.getInstance()

for service in services:
myref = eServiceReference(str(service))
if myref.flags & eServiceReference.isGroup:
mylist = serviceHandler.list(myref)
if mylist is not None:
while True:
s = mylist.getNext()
if s.valid():
# strip all after last :
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]

if value == override_service:
return service
else:
break
if self.alternativeServices is None:
self.alternativeServices = []
if services:
for service in services:
myref = eServiceReference(str(service))
if myref.flags & eServiceReference.isGroup:
if service not in self.alternativeServices:
self.alternativeServices.append(service)
if bouquets:
for bouquet in bouquets:
myref = eServiceReference(str(bouquet))
mylist = serviceHandler.list(myref)
if mylist is not None:
while True:
s = mylist.getNext()
if s.valid():
if s.flags & eServiceReference.isGroup:
value = s.toString()
if value not in self.alternativeServices:
self.alternativeServices.append(value)
else:
break
if self.alternativeServices:
for alternative in self.alternativeServices:
myref = eServiceReference(str(alternative))
if myref.flags & eServiceReference.isGroup:
mylist = serviceHandler.list(myref)
if mylist is not None:
while True:
s = mylist.getNext()
if s.valid():
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]

if value == override_service:
return alternative
else:
break
return override_service

def checkTimespan(self, begin):
Expand Down Expand Up @@ -703,8 +727,7 @@ def getFastServices(self):
if myref.flags & eServiceReference.isGroup:
addbouquets.append(service)
else:
comp = service.split(':')
append(':'.join(comp[3:]))
append(':'.join(service.split(':')[3:]))

serviceHandler = eServiceCenter.getInstance()
for bouquet in bouquets + addbouquets:
Expand All @@ -713,19 +736,17 @@ def getFastServices(self):
if mylist is not None:
while True:
s = mylist.getNext()
# TODO: I wonder if its sane to assume we get services here (and not just new lists)
# We can ignore markers & directorys here because they won't match any event's service :-)
if s.valid():
# strip all after last :
if s.flags & (eServiceReference.isMarker | eServiceReference.isDirectory | eServiceReference.isNumberedMarker):
continue
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]

comp = value.split(':')
append(':'.join(value[3:]))
append(':'.join(value.split(':')[3:]))
else:
break
self._fastServices = fastServices
Expand All @@ -743,30 +764,52 @@ def checkServices(self, check_service):

def getAlternative(self, override_service):
services = self.services
if services:
override = ':'.join(override_service.split(':')[3:])
bouquets = self.bouquets
if services or bouquets:
serviceHandler = eServiceCenter.getInstance()

for service in services:
myref = eServiceReference(str(service))
if myref.flags & eServiceReference.isGroup:
mylist = serviceHandler.list(myref)
if mylist is not None:
while True:
s = mylist.getNext()
if s.valid():
# strip all after last :
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]

if ':'.join(value.split(':')[3:]) == override:
return service
else:
break
if self.alternativeServices is None:
self.alternativeServices = []
if services:
for service in services:
myref = eServiceReference(str(service))
if myref.flags & eServiceReference.isGroup:
if service not in self.alternativeServices:
self.alternativeServices.append(service)
if bouquets:
for bouquet in bouquets:
myref = eServiceReference(str(bouquet))
mylist = serviceHandler.list(myref)
if mylist is not None:
while True:
s = mylist.getNext()
if s.valid():
if s.flags & eServiceReference.isGroup:
value = s.toString()
if value not in self.alternativeServices:
self.alternativeServices.append(value)
else:
break
if self.alternativeServices:
override = ':'.join(override_service.split(':')[3:])
for alternative in self.alternativeServices:
myref = eServiceReference(str(alternative))
if myref.flags & eServiceReference.isGroup:
mylist = serviceHandler.list(myref)
if mylist is not None:
while True:
s = mylist.getNext()
if s.valid():
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]

if ':'.join(value.split(':')[3:]) == override:
return alternative
else:
break
return override_service


Expand Down
2 changes: 1 addition & 1 deletion autotimer/src/AutoTimerSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self, session):
getConfigListEntry(_("Show notification on similars"), config.plugins.autotimer.notifsimilar, _("By enabling this you will be notified about similar timers added during automated polling. There is no intelligence involved, so it might bother you about the same conflict over and over.")),
getConfigListEntry(_("Show notification on added timers"), config.plugins.autotimer.notiftimers, _("By enabling this you will be notified about timer(s) added during automated polling. Just not in standby mode.")),
getConfigListEntry(_("Editor for new AutoTimers"), config.plugins.autotimer.editor, _("The editor to be used for new AutoTimers. This can either be the Wizard or the classic editor.")),
getConfigListEntry(_("Support \"Fast Scan\"?"), config.plugins.autotimer.fastscan, _("When supporting \"Fast Scan\" the service type is ignored. You don't need to enable this unless your Image supports \"Fast Scan\" and you are using it.")),
getConfigListEntry(_("Support \"Fast Scan\"?"), config.plugins.autotimer.fastscan, _("When supporting \"Fast Scan\" the service type is ignored. You don't need to enable this unless your Image supports \"Fast Scan\" and you are using it.") + _("In case of changes, a GUI restart is required to apply the changes.")),
getConfigListEntry(_("Skip poll during records"), config.plugins.autotimer.skip_during_records, _("If enabled, the polling will be skipped if a recording is in progress.")),
getConfigListEntry(_("Only poll while in standby"), config.plugins.autotimer.onlyinstandby, _("When this is enabled AutoTimer will ONLY check for new events whilst in stanadby.")),
getConfigListEntry(_("Style auto timers list"), config.plugins.autotimer.style_autotimerslist, _("If the style is advanced, you will see more information about each auto timer. This change will not take effect until the plugin has started again.")),
Expand Down
2 changes: 1 addition & 1 deletion autotimer/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
autotimer = AutoTimer()
autopoller = None

AUTOTIMER_VERSION = "4.6.9"
AUTOTIMER_VERSION = "4.7.0"

try:
from Plugins.SystemPlugins.MPHelp import registerHelp, XMLHelpReader
Expand Down

0 comments on commit af9de31

Please sign in to comment.