X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6fe312265800a19033b0638f4ae4fb47b14c75b3..4fa71397e7c6cd74314e3088be74212d7b492ba4:/RecordTimer.py diff --git a/RecordTimer.py b/RecordTimer.py index 0f425681..cf900170 100644 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -393,8 +393,22 @@ class RecordTimer(timer.Timer): 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)) @@ -502,6 +516,7 @@ class RecordTimer(timer.Timer): print "[Timer] Record " + str(entry) entry.Timer = self self.addTimerEntry(entry) + self.saveTimer() def isInTimer(self, eventid, begin, duration, service): time_match = 0 @@ -583,6 +598,7 @@ class RecordTimer(timer.Timer): 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()