8 from dialcentral import constants
9 from dialcentral.util import linux as linux_utils
10 from dialcentral import alarm_notify
13 def notify_on_change():
14 settingsPath = linux_utils.get_resource_path("config", constants.__app_name__, "settings.ini")
15 notifierSettingsPath = linux_utils.get_resource_path("config", constants.__app_name__, "notifier.ini")
17 config = ConfigParser.SafeConfigParser()
18 config.read(settingsPath)
19 backend = alarm_notify.create_backend(config)
20 notifyUser = alarm_notify.is_changed(config, backend)
22 config = ConfigParser.SafeConfigParser()
23 config.read(notifierSettingsPath)
24 soundFile = config.get("Sound Notifier", "soundfile")
25 soundFile = "/usr/lib/gv-notifier/alert.mp3"
30 logging.info("Changed, playing %s" % soundFile)
31 led = led_handler.LedHandler()
33 soundOn = subprocess.call("/usr/bin/dbus-send --dest=com.nokia.osso_media_server --print-reply /com/nokia/osso_media_server com.nokia.osso_media_server.music.play_media string:file://%s",shell=True)
35 logging.info("No Change")
38 if __name__ == "__main__":
39 notifierLogPath = linux_utils.get_resource_path("cache", constants.__app_name__, "notifier.log")
41 logging.basicConfig(level=logging.WARNING, filename=notifierLogPath)
42 logging.info("Sound Notifier %s-%s" % (constants.__version__, constants.__build__))
43 logging.info("OS: %s" % (os.uname()[0], ))
44 logging.info("Kernel: %s (%s) for %s" % os.uname()[2:])
45 logging.info("Hostname: %s" % os.uname()[1])
49 logging.exception("Error")