if maxlen:
maxlen = int(maxlen)*60
- # Read out recording path (needs my Location-select patch)
+ # Read out recording path
destination = timer.getAttribute("destination").encode("UTF-8") or None
# Read out offset
except KeyError, ke:
pass
+ # Read out recording tags (needs my enhanced tag support patch)
+ tags = []
+ for tag in timer.getElementsByTagName("tag"):
+ value = getValue(tag, None)
+ if not value:
+ continue
+
+ tags.append(value.encode("UTF-8"))
+
# Finally append tuple
self.timers.append(AutoTimerComponent(
self.uniqueTimerId,
lastBegin = lastBegin,
justplay = justplay,
avoidDuplicateDescription = avoidDuplicateDescription,
- bouquets = bouquets
+ bouquets = bouquets,
+ tags = tags
))
def getTimerList(self):
for day in timer.getIncludedDays():
list.extend([' <include where="dayofweek">', day, '</include>\n'])
+ # Tags
+ for tag in timer.tags:
+ list.extend([' <tag>', str(tag), '</tag>\n'])
+
# End of Timer
list.append(' </timer>\n\n')
if afterEvent is not None:
newEntry.afterEvent = afterEvent
- # Set custom destination directory (needs my Location-select patch)
- if timer.hasDestination():
- # TODO: add warning when patch not installed?
- newEntry.dirname = timer.destination
-
- # Make this timer a zap-timer if wanted
- newEntry.justplay = timer.justplay
+ newEntry.dirname = timer.destination
+ newEntry.justplay = timer.justplay
+ newEntry.tags = timer.tags # This needs my enhanced tag support patch to work
# Do a sanity check, although it does not do much right now
timersanitycheck = TimerSanityCheck(NavigationInstance.instance.RecordTimer.timer_list, newEntry)
def setValues(self, name, match, enabled, timespan = None, services = None, offset = None, \
afterevent = [], exclude = None, maxduration = None, destination = None, \
include = None, matchCount = 0, matchLeft = 0, matchLimit = '', matchFormatString = '', \
- lastBegin = 0, justplay = False, avoidDuplicateDescription = False, bouquets = None):
+ lastBegin = 0, justplay = False, avoidDuplicateDescription = False, bouquets = None, \
+ tags = None):
self.name = name
self.match = match
self.timespan = timespan
self.justplay = justplay
self.avoidDuplicateDescription = avoidDuplicateDescription
self.bouquets = bouquets
+ self.tags = tags or []
def calculateDayspan(self, begin, end):
if end[0] < begin[0] or (end[0] == begin[0] and end[1] <= begin[1]):
def getAvoidDuplicateDescription(self):
return self.avoidDuplicateDescription
+ def hasTags(self):
+ return len(self.tags) > 0
+
def __repr__(self):
return ''.join([
'<AutomaticTimer ',
{
"cancel": self.cancel,
"save": self.maybeSave,
+ "ok": self.ok,
"yellow": self.editFilter,
"blue": self.editServices
- }
+ }, -2
)
# Trigger change
# Avoid Duplicate Description
self.avoidDuplicateDescription = ConfigEnableDisable(default = timer.getAvoidDuplicateDescription())
+ # Custom Location
+ self.destination = ConfigSelection(choices = [timer.destination or "/hdd/movie"])
+
def refresh(self):
# First four entries are always shown
self.list = [
self.list.append(getConfigListEntry(_("Require Description to be unique"), self.avoidDuplicateDescription))
+ # We always add this option though its actually expert only
+ self.list.append(getConfigListEntry(_("Custom Location"), self.destination))
+
def reloadList(self, value):
self.refresh()
self["config"].setList(self.list)
self.bouquets = ret[1][1]
self.renameServiceButton()
+ def ok(self):
+ cur = self["config"].getCurrent()
+ cur = cur and cur[1]
+ if cur == self.destination:
+ from Screens.LocationBox import LocationBox
+
+ self.session.openWithCallback(
+ self.pathSelected,
+ LocationBox,
+ text = _("Choose target folder"),
+ filename = "",
+ currDir = self.destination.value
+ )
+
+ def pathSelected(self, res):
+ if res is not None:
+ self.destination.choices.append(res)
+ self.destination.description[res] = res
+ self.destination.value = res
+
def cancel(self):
if self["config"].isChanged():
self.session.openWithCallback(
self.timer.matchFormatString = ''
self.timer.avoidDuplicateDescription = self.avoidDuplicateDescription.value
+ self.timer.destination = self.destination.value
# Close
self.close(self.timer)
elif reason == 1:
# Stop Poller
if autopoller is not None:
- autopoller.stop()
+ # We might shutdown when configuring, timer won't be runnign then
+ try:
+ autopoller.stop()
+ except ValueError, ve:
+ pass
autopoller = None