X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=RecordTimer.py;h=cf900170c8ac65929a7e41836de789bc39f16d44;hp=0f4256813aaa052c5a30542da1489eef0fa57d70;hb=ebdbedb7b01c55a06c9fd548cc776354ced3b4cf;hpb=6fe312265800a19033b0638f4ae4fb47b14c75b3 diff --git a/RecordTimer.py b/RecordTimer.py index 0f42568..cf90017 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()