smaller optimizations
[vuplus_dvbapp-plugin] / autotimer / src / plugin.py
index 47c90b2..bfd2c61 100644 (file)
@@ -24,6 +24,7 @@ config.plugins.autotimer.editor = ConfigSelection(choices = [
                ("wizard", _("Wizard"))
        ], default = "wizard"
 )
+config.plugins.autotimer.disabled_on_conflict = ConfigEnableDisable(default = False)
 
 autotimer = None
 autopoller = None
@@ -72,14 +73,12 @@ def main(session, **kwargs):
                from AutoTimer import AutoTimer
                autotimer = AutoTimer()
 
-       from xml.parsers.expat import ExpatError
-
        try:
                autotimer.readXml()
-       except ExpatError, ee:
+       except SyntaxError, se:
                session.open(
                        MessageBox,
-                       "Your config file is not well-formed.\nError parsing in line: %s" % (ee.lineno),
+                       _("Your config file is not well-formed:\n%s") % (str(se)),
                        type = MessageBox.TYPE_ERROR,
                        timeout = 10
                )
@@ -108,11 +107,14 @@ def editCallback(session):
                ret = autotimer.parseEPG()
                session.open(
                        MessageBox,
-                       "Found a total of %d matching Events.\n%d Timer were added and %d modified.." % (ret[0], ret[1], ret[2]),
+                       _("Found a total of %d matching Events.\n%d Timer were added and %d modified.") % (ret[0], ret[1], ret[2]),
                        type = MessageBox.TYPE_INFO,
                        timeout = 10
                )
 
+               # Save xml
+               autotimer.writeXml()
+
        # Start autopoller again if wanted
        if config.plugins.autotimer.autopoll.value:
                if autopoller is None:
@@ -122,9 +124,6 @@ def editCallback(session):
        # Remove instance if not running in background
        else:
                autopoller = None
-
-               # Save xml (as long as we did not cancel)
-               session and autotimer.writeXml()
                autotimer = None
 
 # Movielist