def loadTimer(self):
# TODO: PATH!
- doc = xml.dom.minidom.parse(self.Filename)
-
+ try:
+ doc = xml.dom.minidom.parse(self.Filename)
+ except xml.parsers.expat.ExpatError:
+ from Tools.Notifications import AddPopup
+ from Screens.MessageBox import MessageBox
+
+ AddPopup(_("The timer file (timers.xml) is corrupt and could not be loaded."), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed")
+
+ print "timers.xml failed to load!"
+ try:
+ import os
+ os.rename(self.Filename, self.Filename + "_old")
+ except IOError:
+ print "renaming broken timer failed"
+ return
+
root = doc.childNodes[0]
for timer in elementsWithTag(root.childNodes, "timer"):
self.record(createTimer(timer))
print "[Timer] Record " + str(entry)
entry.Timer = self
self.addTimerEntry(entry)
+ self.saveTimer()
def isInTimer(self, eventid, begin, duration, service):
time_match = 0
print "in running: ", entry in self.timer_list
# now the timer should be in the processed_timers list. remove it from there.
self.processed_timers.remove(entry)
+ self.saveTimer()
def shutdown(self):
self.saveTimer()