diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2008-02-12 22:16:58 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2008-02-12 22:16:58 +0000 |
| commit | c634af0fecbf66c7e0187b49e54f6501fb2e88b0 (patch) | |
| tree | c5336b3d8cbfade5a96348959614bb57f12c8ecb | |
| parent | 90f41bed3942965ff126bfb0a9bdce1c42751c1b (diff) | |
| download | enigma2-c634af0fecbf66c7e0187b49e54f6501fb2e88b0.tar.gz enigma2-c634af0fecbf66c7e0187b49e54f6501fb2e88b0.zip | |
handle broken timers.xml gracefully
| -rw-r--r-- | RecordTimer.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/RecordTimer.py b/RecordTimer.py index de4f6cc1..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)) |
