# GUI (Components)
from Components.ActionMap import ActionMap
-from Components.Button import Button
+from Components.Sources.StaticText import StaticText
# Configuration
from Components.config import getConfigListEntry, ConfigEnableDisable, \
# Workaround some characters currently not "typeable" using NumericalTextInput
mapping = self.mapping
- if len(mapping):
+ if mapping:
if "&" not in mapping[0]:
mapping[0] += "&"
if ";" not in mapping[0]:
timer.getIncludedDescription(),
timer.getIncludedDays()
)
- if len(excludes[0]) or len(excludes[1]) \
- or len(excludes[2]) or len(excludes[3]) \
- or len(includes[0]) or len(includes[1]) \
- or len(includes[2]) or len(includes[3]):
+ if excludes[0] or excludes[1] \
+ or excludes[2] or excludes[3] \
+ or includes[0] or includes[1] \
+ or includes[2] or includes[3]:
self.filterSet = True
else:
self.filterSet = False
# See if services are restricted
self.services = timer.services
self.bouquets = timer.bouquets
- if len(self.services) or len(self.bouquets):
+ if self.services or self.bouquets:
self.serviceRestriction = True
else:
self.serviceRestriction = False
self.searchType = NoSave(ConfigSelection(choices = [("partial", _("partial match")), ("exact", _("exact match"))], default = timer.searchType))
self.searchCase = NoSave(ConfigSelection(choices = [("sensitive", _("case-sensitive search")), ("insensitive", _("case-insensitive search"))], default = timer.searchCase))
+ # Alternatives override
+ self.overrideAlternatives = NoSave(ConfigYesNo(default = timer.overrideAlternatives))
+
# Justplay
self.justplay = NoSave(ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[int(timer.justplay)]))
def pathSelected(self, res):
if res is not None:
- if res not in self.destination.choices:
- self.destination.choices.append(res)
- self.destination.description[res] = res
+ # I'm pretty sure this will always fail
+ if config.movielist.videodirs.value != self.destination.choices:
+ self.destination.setChoices(config.movielist.videodirs.value, default = res)
self.destination.value = res
def chooseDestination(self):
class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
"""Edit AutoTimer"""
- skin = """<screen name="AutoTimerEdit" title="Edit AutoTimer" position="75,155" size="565,280">
+ skin = """<screen name="AutoTimerEditor" title="Edit AutoTimer" position="center,center" size="565,280">
<widget name="config" position="5,5" size="555,225" scrollbarMode="showOnDemand" />
- <ePixmap position="0,235" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
- <ePixmap position="140,235" zPosition="4" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
- <ePixmap position="280,235" zPosition="4" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
- <ePixmap position="420,235" zPosition="4" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
- <widget name="key_red" position="0,235" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_green" position="140,235" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_yellow" position="280,235" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_blue" position="420,235" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <ePixmap position="0,235" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+ <ePixmap position="140,235" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+ <ePixmap position="280,235" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
+ <ePixmap position="420,235" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_green" render="Label" position="140,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_yellow" render="Label" position="280,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_blue" render="Label" position="420,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
</screen>"""
def __init__(self, session, timer, editingDefaults = False):
ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changed)
# Initialize Buttons
- self["key_red"] = Button(_("Cancel"))
- self["key_green"] = Button(_("OK"))
- self["key_yellow"] = Button()
- self["key_blue"] = Button()
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("OK"))
+ self["key_yellow"] = StaticText()
+ self["key_blue"] = StaticText()
# Set Button texts
self.renameServiceButton()
for x in self.onChangedEntry:
try:
x()
- except:
+ except Exception:
pass
def getCurrentEntry(self):
getConfigListEntry(_("Search Type"), self.searchType),
getConfigListEntry(_("Search strictness"), self.searchCase),
getConfigListEntry(_("Timer Type"), self.justplay),
+ getConfigListEntry(_("Override found with alternative Service"), self.overrideAlternatives),
getConfigListEntry(_("Only match during Timespan"), self.timespan)
))
self.bouquets = ret[1][1]
self.renameServiceButton()
+ def keyLeft(self):
+ cur = self["config"].getCurrent()
+ cur = cur and cur[1]
+ if cur == self.tags:
+ self.chooseTags()
+ else:
+ ConfigListScreen.keyLeft(self)
+
+ def keyRight(self):
+ cur = self["config"].getCurrent()
+ cur = cur and cur[1]
+ if cur == self.tags:
+ self.chooseTags()
+ else:
+ ConfigListScreen.keyRight(self)
+
def ok(self):
cur = self["config"].getCurrent()
cur = cur and cur[1]
self.timer.searchType = self.searchType.value
self.timer.searchCase = self.searchCase.value
+ # Alternatives
+ self.timer.overrideAlternatives = self.overrideAlternatives.value
+
# Enabled
self.timer.enabled = self.enabled.value
class AutoTimerFilterEditor(Screen, ConfigListScreen):
"""Edit AutoTimer Filter"""
- skin = """<screen name="AutoFilterEditor" title="Edit AutoTimer Filters" position="75,150" size="565,245">
- <widget name="config" position="5,5" size="555,200" scrollbarMode="showOnDemand" />
- <ePixmap position="5,205" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
- <ePixmap position="145,205" zPosition="4" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
- <ePixmap position="285,205" zPosition="4" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
- <ePixmap position="425,205" zPosition="4" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
- <widget name="key_red" position="5,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_green" position="145,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_yellow" position="285,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_blue" position="425,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ skin = """<screen name="AutoTimerFilterEditor" title="Edit AutoTimer Filters" position="center,center" size="565,280">
+ <widget name="config" position="5,5" size="555,225" scrollbarMode="showOnDemand" />
+ <ePixmap position="0,235" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+ <ePixmap position="140,235" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+ <ePixmap position="280,235" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
+ <ePixmap position="420,235" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_green" render="Label" position="140,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_yellow" render="Label" position="280,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_blue" render="Label" position="420,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
</screen>"""
def __init__(self, session, filterset, excludes, includes):
ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changed)
# Initialize Buttons
- self["key_red"] = Button(_("Cancel"))
- self["key_green"] = Button(_("Save"))
- self["key_yellow"] = Button(_("delete"))
- self["key_blue"] = Button(_("New"))
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("Save"))
+ self["key_yellow"] = StaticText(_("delete"))
+ self["key_blue"] = StaticText(_("New"))
# Define Actions
self["actions"] = ActionMap(["SetupActions", "ColorActions"],
for x in self.onChangedEntry:
try:
x()
- except:
+ except Exception:
pass
def getCurrentEntry(self):
class AutoTimerServiceEditor(Screen, ConfigListScreen):
"""Edit allowed Services of a AutoTimer"""
- skin = """<screen name="AutoTimerServiceEditor" title="Edit AutoTimer Services" position="75,150" size="565,245">
- <widget name="config" position="5,5" size="555,200" scrollbarMode="showOnDemand" />
- <ePixmap position="5,205" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
- <ePixmap position="145,205" zPosition="4" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
- <ePixmap position="285,205" zPosition="4" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
- <ePixmap position="425,205" zPosition="4" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
- <widget name="key_red" position="5,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_green" position="145,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_yellow" position="285,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_blue" position="425,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ skin = """<screen name="AutoTimerServiceEditor" title="Edit AutoTimer Services" position="center,center" size="565,280">
+ <widget name="config" position="5,5" size="555,225" scrollbarMode="showOnDemand" />
+ <ePixmap position="0,235" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+ <ePixmap position="140,235" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+ <ePixmap position="280,235" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
+ <ePixmap position="420,235" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_green" render="Label" position="140,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_yellow" render="Label" position="280,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+ <widget source="key_blue" render="Label" position="420,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
</screen>"""
def __init__(self, session, servicerestriction, servicelist, bouquetlist):
ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changed)
# Initialize Buttons
- self["key_red"] = Button(_("Cancel"))
- self["key_green"] = Button(_("OK"))
- self["key_yellow"] = Button(_("delete"))
- self["key_blue"] = Button(_("New"))
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("OK"))
+ self["key_yellow"] = StaticText(_("delete"))
+ self["key_blue"] = StaticText(_("New"))
# Define Actions
self["actions"] = ActionMap(["SetupActions", "ColorActions"],
for x in self.onChangedEntry:
try:
x()
- except:
+ except Exception:
pass
def getCurrentEntry(self):
)
def finishedServiceSelection(self, *args):
- if len(args):
+ if args:
list = self["config"].getList()
sname = args[0].toString()
- if self.typeSelection.value == "channels":
- # strip all after last : when adding a channel
+ if self.typeSelection.value == "channels" and not (args[0].flags & eServiceReference.isGroup):
+ # strip all after last : when adding a (non alternative) channel
pos = sname.rfind(':')
if pos != -1:
+ if sname[pos-1] == ':'
+ pos -= 1
sname = sname[:pos+1]
list.append(getConfigListEntry(_("Record on"), NoSave(ConfigSelection(choices = [(sname, ServiceReference(args[0]).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))]))))
self.services
))
+def addAutotimerFromSearchString(session, match):
+ from AutoTimerComponent import AutoTimerComponent
+ from AutoTimerImporter import AutoTimerImporter
+ from plugin import autotimer
+
+ # Create instance if needed
+ if autotimer is None:
+ from AutoTimer import AutoTimer
+ autotimer = AutoTimer()
+ autotimer.readXml()
+
+ session.openWithCallback(
+ importerCallback,
+ AutoTimerImporter,
+ AutoTimerComponent(
+ autotimer.getUniqueId(),
+ match,
+ '', # Match
+ True # Enabled
+ ),
+ match, # Proposed Match
+ None, # Proposed Begin
+ None, # Proposed End
+ None, # Proposed Disabled
+ None, # Proposed ServiceReference
+ None, # Proposed afterEvent
+ None, # Proposed justplay
+ None, # Proposed dirname, can we get anything useful here?
+ [] # Proposed tags
+ )
+
def addAutotimerFromEvent(session, evt = None, service = None):
from AutoTimerComponent import AutoTimerComponent
from AutoTimerImporter import AutoTimerImporter
sref = None
if service is not None:
service = str(service)
- # strip all after last :
- pos = service.rfind(':')
- if pos != -1:
- service = service[:pos+1]
-
- sref = ServiceReference(service)
+ myref = eServiceReference(service)
+ if not (myref.flags & eServiceReference.isGroup):
+ # strip all after last :
+ pos = service.rfind(':')
+ if pos != -1:
+ if service[pos-1] == ':'
+ pos -= 1
+ service = service[:pos+1]
+
+ sref = ServiceReference(myref)
if evt:
# timespan defaults to +- 1h
begin = evt.getBeginTime()-3600
# strip all after last :
pos = sref.rfind(':')
if pos != -1:
+ if sref[pos-1] == ':'
+ pos -= 1
sref = sref[:pos+1]
sref = ServiceReference(sref)