X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/878c28f3ac56f6dce9647993278e36cacb994bcc..abea0c85ea0e0f9e7197664b70753fbe5f110b8d:/RecordTimer.py diff --git a/RecordTimer.py b/RecordTimer.py index cf49df23..c3b948d2 100644 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -25,6 +25,7 @@ class RecordTimerEntry(timer.TimerEntry): else: self.epg_data = "" + self.dontSave = False self.description = description self.timer = None self.record_service = None @@ -85,9 +86,12 @@ def createTimer(xml): end = int(xml.getAttribute("end")) serviceref = ServiceReference(str(xml.getAttribute("serviceref"))) description = xml.getAttribute("description") + repeated = xml.getAttribute("repeated") epgdata = xml.getAttribute("epgdata") #filename = xml.getAttribute("filename") - return RecordTimerEntry(begin, end, serviceref, epgdata, description) + entry = RecordTimerEntry(begin, end, serviceref, epgdata, description) + entry.repeated = int(repeated) + return entry class RecordTimer(timer.Timer): def __init__(self): @@ -101,7 +105,6 @@ class RecordTimer(timer.Timer): print "unable to load timers from file!" def loadTimer(self): - # TODO: PATH! doc = xml.dom.minidom.parse(self.Filename) @@ -116,20 +119,26 @@ class RecordTimer(timer.Timer): root_element.appendChild(doc.createTextNode("\n")) for timer in self.timer_list + self.processed_timers: + # some timers (instant records) don't want to be saved. + # skip them + if timer.dontSave: + continue t = doc.createTextNode("\t") root_element.appendChild(t) t = doc.createElement('timer') t.setAttribute("begin", str(timer.begin)) t.setAttribute("end", str(timer.end)) t.setAttribute("serviceref", str(timer.service_ref)) + t.setAttribute("repeated", str(timer.repeated)) #t.setAttribute("epgdata", timer.) t.setAttribute("description", timer.description) root_element.appendChild(t) t = doc.createTextNode("\n") root_element.appendChild(t) - + file = open(self.Filename, "w") doc.writexml(codecs.getwriter('UTF-8')(file)) + file.write("\n") file.close() def record(self, entry): @@ -143,12 +152,13 @@ class RecordTimer(timer.Timer): elif entry.state != timer.TimerEntry.StateEnded: entry.activate(timer.TimerEntry.EventAbort) self.timer_list.remove(entry) + self.calcNextActivation() print "timer did not yet start - removing" else: print "timer did already end - doing nothing." - - self.calcNextActivation() - + + # now the timer should be in the processed_timers list. remove it from there. + self.processed_timers.remove(entry) def shutdown(self): self.saveTimer()