return not seemEqual
-def is_changed():
+def create_backend(config):
gvCookiePath = os.path.join(constants._data_path_, "gv_cookies.txt")
backend = gv_backend.GVDialer(gvCookiePath)
if not loggedIn:
loggedIn = backend.is_authed()
- config = ConfigParser.SafeConfigParser()
- config.read(constants._user_settings_)
if not loggedIn:
import base64
try:
except ConfigParser.NoSectionError, e:
pass
+ assert loggedIn
+ return backend
+
+
+def is_changed(config, backend):
try:
notifyOnMissed = config.getboolean("2 - Account Info", "notifyOnMissed")
notifyOnVoicemail = config.getboolean("2 - Account Info", "notifyOnVoicemail")
notifyOnVoicemail = False
notifyOnSms = False
- assert loggedIn
notifySources = []
if notifyOnMissed:
notifySources.append(("missed", get_missed))
def notify_on_change():
- notifyUser = is_changed()
+ config = ConfigParser.SafeConfigParser()
+ config.read(constants._user_settings_)
+ backend = create_backend(config)
+ notifyUser = is_changed(config, backend)
if notifyUser:
import led_handler
import sys
import datetime
+import ConfigParser
sys.path.insert(0,"/usr/lib/dialcentral/")
filename = "%s/notification.log" % constants._data_path_
with open(filename, "a") as file:
file.write("Notification: %r\n" % (datetime.datetime.now(), ))
- notifyUser = alarm_notify.is_changed()
+
+ config = ConfigParser.SafeConfigParser()
+ config.read(constants._user_settings_)
+ backend = alarm_notify.create_backend(config)
+ notifyUser = alarm_notify.is_changed(config, backend)
+
if notifyUser:
file.write("\tChange occurred\n")
#!/usr/bin/env python
import sys
+import ConfigParser
sys.path.insert(0,"/usr/lib/dialcentral/")
+import constants
import alarm_notify
def notify_on_change():
- notifyUser = alarm_notify.is_changed()
+ config = ConfigParser.SafeConfigParser()
+ config.read(constants._user_settings_)
+ backend = alarm_notify.create_backend(config)
+ notifyUser = alarm_notify.is_changed(config, backend)
if notifyUser:
import subprocess