else:
delay = config.plugins.autotimer.interval.value*3600
- self.timer.callback.append(self.query)
+ if self.query not in self.timer.callback:
+ self.timer.callback.append(self.query)
self.timer.startLongTimer(delay)
def stop(self):
- self.timer.callback.remove(self.query)
+ if self.query in self.timer.callback:
+ self.timer.callback.remove(self.query)
self.timer.stop()
def query(self):
traceback.print_exc(file=sys.stdout)
self.timer.startLongTimer(config.plugins.autotimer.interval.value*3600)
+
if config.plugins.autotimer.refresh.value == "none" or newEntry.repeated:
raise AutoTimerIgnoreTimerException("Won't modify existing timer because either no modification allowed or repeated timer")
- try:
- if newEntry.isAutoTimer:
+ if hasattr(newEntry, "isAutoTimer"):
print "[AutoTimer] Modifying existing AutoTimer!"
- except AttributeError, ae:
+ else:
if config.plugins.autotimer.refresh.value != "all":
raise AutoTimerIgnoreTimerException("Won't modify existing timer because it's no timer set by us")
print "[AutoTimer] Warning, we're messing with a timer which might not have been set by us"
func(newEntry)
return (total, new, modified, timers)
+
)
def __eq__(self, other):
- try:
+ if hasattr(other, "id"):
return self.id == other.id
- except AttributeError:
- return False
+ return False
def __lt__(self, other):
- try:
+ if hasattr(other, "name"):
return self.name.lower() < other.name.lower()
- except:
- return False
+ return False
def __ne__(self, other):
return not self.__eq__(other)
]),
")>"
])
+
ret = ""
# How many definitions are present
- try:
- childNodes = definitions.childNodes
- except:
+ if isinstance(definitions, list):
Len = len(definitions)
if Len > 0:
childNodes = definitions[Len-1].childNodes
else:
childNodes = []
+ else:
+ childNodes = definitions.childNodes
# Iterate through nodes of last one
for node in childNodes:
try:
value = idx[value]
- start = element.getAttribute("from")
- end = element.getAttribute("to")
- if start and end:
- start = [int(x) for x in start.split(':')]
- end = [int(x) for x in end.split(':')]
- afterevent.append((value, (start, end)))
- else:
- afterevent.append((value, None))
except KeyError, ke:
print '[AutoTimer] Erroneous config contains invalid value for "afterevent":', afterevent,', ignoring definition'
continue
+
+ start = element.getAttribute("from")
+ end = element.getAttribute("to")
+ if start and end:
+ start = [int(x) for x in start.split(':')]
+ end = [int(x) for x in end.split(':')]
+ afterevent.append((value, (start, end)))
+ else:
+ afterevent.append((value, None))
baseTimer.afterevent = afterevent
# Read out exclude
try:
value = idx[value]
- start = element.getAttribute("from")
- end = element.getAttribute("to")
- if start and end:
- start = [int(x) for x in start.split(':')]
- end = [int(x) for x in end.split(':')]
- afterevent.append((value, (start, end)))
- else:
- afterevent.append((value, None))
except KeyError, ke:
print '[AutoTimer] Erroneous config contains invalid value for "afterevent":', afterevent,', ignoring definition'
continue
+ start = element.getAttribute("from")
+ end = element.getAttribute("to")
+ if start and end:
+ start = [int(x) for x in start.split(':')]
+ end = [int(x) for x in end.split(':')]
+ afterevent.append((value, (start, end)))
+ else:
+ afterevent.append((value, None))
+
# Read out exclude (V*)
idx = {"title": 0, "shortdescription": 1, "description": 2, "dayofweek": 3}
excludes = ([], [], [], [])
file.writelines(list)
file.close()
+
self.useDestination = ConfigYesNo(default = default)
default = timer.destination or Directories.resolveFilename(Directories.SCOPE_HDD)
- choices = []
- try:
- choices = config.movielist.videodirs.value
- except:
- print "config.movielist.videodirs.value not set"
-
+ choices = config.movielist.videodirs.value
+
if default not in choices:
choices.append(default)
self.destination = ConfigSelection(default = default, choices = choices)
# Save xml (as long as we added something)
ret and autotimer and autotimer.writeXml()
autotimer = None
+
self.autotimer,
self.session
))
+
self.instance.moveSelectionTo(idx)
break
idx += 1
+
def save(self):
# Just close here, saving will be done by cb
self.close(self.session)
+
def save(self):
self.close(True)
+
def createSummary(self):
return SetupSummary
+
from Components.Language import language
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
-import os,gettext
+from os import environ as os_environ
+import gettext
def localeInit():
lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
- os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
+ os_environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
print "[AutoTimer] set language to ", lang
gettext.bindtextdomain("AutoTimer", resolveFilename(SCOPE_PLUGINS, "Extensions/AutoTimer/locale"))
elif reason == 1:
# Stop Poller
if autopoller is not None:
- # We might shutdown when configuring, timer won't be running then
- try:
- autopoller.stop()
- except ValueError, ve:
- pass
-
+ autopoller.stop()
autopoller = None
if autotimer is not None:
PluginDescriptor(name="AutoTimer", description = _("Edit Timers and scan for new Events"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main),
PluginDescriptor(name="AutoTimer", description= _("Add AutoTimer..."), where = PluginDescriptor.WHERE_MOVIELIST, fnc = movielist)
]
+