Changeset 187:b82b5be8e615
- Timestamp:
- 11/28/08 18:18:12 (3 years ago)
- Branch:
- default
- Parents:
- 186:fdaf10ceded4 (diff), 183:1e15754ebd2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 9 removed
- 19 modified
-
.hgignore (modified) (1 diff)
-
.hgignore (modified) (1 diff)
-
StormSiren/AlertDevice.py (modified) (1 diff)
-
StormSiren/AlertDevice.py (modified) (2 diffs)
-
StormSiren/CAP.py (deleted)
-
StormSiren/ExecutionAlertDevice.py (modified) (1 diff)
-
StormSiren/ExecutionAlertDevice.py (modified) (1 diff)
-
StormSiren/JabberAlertDevice.py (modified) (2 diffs)
-
StormSiren/JabberAlertDevice.py (modified) (1 diff)
-
StormSiren/SmsAlertDevice.py (modified) (1 diff)
-
StormSiren/SmsAlertDevice.py (modified) (1 diff)
-
StormSiren/StormConfig.py (modified) (2 diffs)
-
StormSiren/StormConfig.py (modified) (4 diffs)
-
StormSiren/StormWeather.py (modified) (4 diffs)
-
StormSiren/StormWeather.py (modified) (2 diffs)
-
StormSiren/TestAlert.py (modified) (1 diff)
-
StormSiren/TestAlert.py (modified) (1 diff)
-
StormSiren/XmlWeather.py (modified) (1 diff)
-
StormSiren/XmlWeather.py (modified) (3 diffs)
-
examples/cap1.1/tx.0 (deleted)
-
examples/cap1.1/tx.1 (deleted)
-
examples/cap1.1/tx.2 (deleted)
-
examples/cap1.1/wwacapget.php_x=TX20081114002000OUNNOWOUN20081114020000TX (deleted)
-
examples/cap1.1/wwacapget.php_x=WY20081113235700RIWNPWRIW20081114090000WY (deleted)
-
examples/cap1.1/wy.0 (deleted)
-
examples/cap1.1/wy.1 (deleted)
-
examples/cap1.1/wy.2 (deleted)
-
siren (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
.hgignore
r161 r187 4 4 *.elc 5 5 *-orig 6 *-rej 6 7 *.swp 7 8 .*.swp -
.hgignore
r45 r187 3 3 4 4 *.elc 5 *-orig 6 *-rej 5 7 *.swp 6 8 .*.swp -
StormSiren/AlertDevice.py
r170 r187 59 59 self.log = logging.getLogger('AlertDevice') 60 60 61 self.log.setLevel(logging.INFO) 61 62 self.__parse_weather_types(alerts) 62 63 self.__parse_areas(areas) -
StormSiren/AlertDevice.py
r184 r187 136 136 return False 137 137 138 def is CountyWanted(self,state,county):138 def isAreaWanted(self,state,alert_areas): 139 139 if(self.__areas.has_key(state)): 140 if(county.lower() in self.__areas[state]): 141 return True 140 for area in alert_areas: 141 self.log.debug("checking if %s is in (%s)" % (area.lower(),self.__areas[state])) 142 if(area.lower() in self.__areas[state]): 143 self.log.debug("%s IS IN (%s)" % (area.lower(),self.__areas[state])) 144 return True 142 145 return False 143 146 … … 146 149 if(self.isTypeWanted(cap_alert.type) and self.isStateWanted(cap_alert.state)): 147 150 self.log.debug("Testing[%s]: type and state match(%s/%i)" % (cap_alert.id, cap_alert.state, cap_alert.type)) 148 if(self.is CountyWanted(cap_alert.state, cap_alert.county)):149 self.log. info("Alert hit on county[%s/%s]: %s" % (cap_alert.county, cap_alert.state, cap_alert.id))151 if(self.isAreaWanted(cap_alert.state, cap_alert.areas)): 152 self.log.debug("Alert hit on area[%s/%s]: %s" % (cap_alert.state, cap_alert.id, cap_alert.areas)) 150 153 return True 151 154 else: 152 for loc in self.__areas[cap_alert.state]: 153 if(cap_alert.isLocationInDesc(loc)): 154 self.log.info("Alert hit on location[%s/%s]: %s" % (loc, cap_alert.state, cap_alert.id)) 155 return True 155 self.log.debug("Testing[%s]: alert not in watched area(%s/%s)" % (cap_alert.id, cap_alert.state, cap_alert.areas)) 156 else: 157 self.log.debug("Testing[%s]: Either wrong type or state (%s/%i)" % (cap_alert.id, cap_alert.state, cap_alert.type)) 156 158 return False 157 159 #CODE END -
StormSiren/ExecutionAlertDevice.py
r177 r187 51 51 super(ExecutionAlertDevice,self).__init__(alerts,areas) 52 52 self.__exeInfo = exeInfo 53 self.log = logging.getLogger('ExecutionAlertDevice') 54 self.log.setLevel(logging.DEBUG) 53 55 54 56 def display(self): -
StormSiren/ExecutionAlertDevice.py
r184 r187 79 79 def _execute(self,exe,alert): 80 80 try: 81 subprocess.Popen([exe,alert.id, WeatherTypes.toString(alert.type),alert.state,alert.county]).wait()82 self.log.info("Executing: [%s %s %s %s %s]" % (exe,alert.id, WeatherTypes.toString(alert.type),alert.state,alert.county))81 subprocess.Popen([exe,alert.id,"\"" + WeatherTypes.toString(alert.type) + "\"",alert.state,"\"" + alert.getAreas() + "\""]).wait() 82 self.log.info("Executing: [%s %s %s %s %s]" % (exe,alert.id,"\"" + WeatherTypes.toString(alert.type) + "\"",alert.state,"\"" + alert.getAreas() + "\"")) 83 83 except os.error: 84 self.log.error("Problem Executing: [%s %s %s %s %s]" % (exe,alert.id, WeatherTypes.toString(alert.type),alert.state,alert.county))84 self.log.error("Problem Executing: [%s %s %s %s %s]" % (exe,alert.id,"\"" + WeatherTypes.toString(alert.type),alert.state,"\"" + alert.getAreas() + "\"")) 85 85 86 86 class ExecutionAlertDeviceInfo(object): -
StormSiren/JabberAlertDevice.py
r181 r187 49 49 pass 50 50 51 52 51 from AlertDevice import * 53 52 … … 61 60 self.__to = to 62 61 self.a = alerts 62 self.log = logging.getLogger('JabberAlertDevice') 63 64 self.log.setLevel(logging.INFO) 63 65 64 66 def display(self): -
StormSiren/JabberAlertDevice.py
r184 r187 96 96 self.log.warn("Warning: unable to perform SASL auth os %s. Old authentication method used!" % jid) 97 97 98 cl.send(xmpp.protocol.Message(self.to,alert.detailed,None, alert. event + "(" + alert.area+ ")"))98 cl.send(xmpp.protocol.Message(self.to,alert.detailed,None, alert.headline + "(" + alert.getAreas() + ")")) 99 99 100 100 class JabberAlertDeviceInfo(object): -
StormSiren/SmsAlertDevice.py
r180 r187 47 47 def __init__(self, to, textwidth, smtpInfo, alerts, areas): 48 48 super(SmsAlertDevice,self).__init__(to, textwidth, smtpInfo, alerts, areas) 49 self.log = logging.getLogger('SmsAlertDevice') 50 51 self.log.setLevel(logging.INFO) 49 52 50 53 def display(self): -
StormSiren/SmsAlertDevice.py
r184 r187 60 60 61 61 def send(self,alert): 62 self.email(alert.terse,alert. event)62 self.email(alert.terse,alert.headline) 63 63 self.log.info('Paged ' + self.to + ' on bulletin ' + alert.id) -
StormSiren/StormConfig.py
r176 r187 59 59 60 60 class StormConfig(Config): 61 def __init__(self, config_file = None, log_config_file = None): 61 def __init__(self, config_file = None): 62 super(StormConfig,self).__init__(__APPNAME__,config_file) 63 62 64 self.__states = [] 63 65 self.devices = [] 64 self.__history_file = ''66 self.__history_file = self.config_dir + '/' + __APPNAME__ + '.history' 65 67 self.log = logging.getLogger('StormConfig') 66 68 self.__max_history = History.DEFAULT_MAX_HISTORICAL_EVENTS 67 69 self.__proxy = '' 68 70 69 super(StormConfig,self).__init__(__APPNAME__,config_file, log_config_file) 70 71 self.__history_file = self.config_dir + '/' + __APPNAME__ + '.history' 71 self.log.setLevel(logging.DEBUG) 72 self._load() 72 73 73 74 def _load(self): … … 121 122 122 123 for i in range(1,int(num_watchers)+1): 123 dev = self.getRequired(str(i),"device") 124 alerts = self.getRequired(str(i),"alert") 125 areas = self.getRequired(str(i),"areas") 126 127 if(dev == "email"): 128 to = self.getRequired(str(i),"to") 129 textwidth = int(self.get(str(i),"textwidth",-1)) 130 self.devices.append(EmailAlertDevice(to,textwidth,smtpInfo,alerts,areas)) 131 if(dev == "sms"): 132 to = self.getRequired(str(i),"to") 133 textwidth = int(self.get(str(i),"textwidth",-1)) 134 self.devices.append(SmsAlertDevice(to,textwidth,smtpInfo,alerts,areas)) 135 if(dev == "jabber"): 136 if(not jabberLoadAttempted): 137 jabber_available = self.__loadXmpp() 138 jabberLoadAttempted = True 139 140 if(jabber_available): 141 to = self.getRequired(str(i),"to") 142 self.devices.append(JabberAlertDevice(to,jabberInfo,alerts,areas)) 143 else: 144 self.log.error("Jabber Support Not Enabled, but Jabber Device Requested!") 145 if(dev == "osd"): 146 if(not osdLoadAttempted): 147 osd_available = self.__loadOsd() 148 osdLoadAttempted = True 149 150 if(osd_available): 151 position = self.get(str(i),"position", DEFAULT_OSD_POSITION) 152 alignment = self.get(str(i),"alignment", DEFAULT_OSD_ALIGNMENT) 153 offset = int(self.get(str(i),"offset", DEFAULT_OSD_OFFSET)) 154 timeout = int(self.get(str(i),"timeout", DEFAULT_OSD_TIMEOUT)) 155 color = self.get(str(i),"color", DEFAULT_OSD_COLOR) 156 font = self.get(str(i),"font", DEFAULT_OSD_FONT) 157 self.devices.append(OsdAlertDevice(OsdAlertDeviceInfo(position, 158 alignment, 159 offset, 160 timeout, 161 color, 162 font), 163 alerts,areas)) 164 else: 165 self.log.error("OSD Support Not Enabled, but OSD Device Requested!") 166 if(dev == "mythtv"): 124 dev = self.getRequired(str(i),"device") 125 alerts = self.getRequired(str(i),"alert") 126 areas = self.getRequired(str(i),"areas") 127 self.log.debug("AlertDevice(%s) Areas(%s) Alerts(%s)" % (dev, alerts,areas)) 128 129 if(dev == "email"): 130 to = self.getRequired(str(i),"to") 131 textwidth = int(self.get(str(i),"textwidth",-1)) 132 self.devices.append(EmailAlertDevice(to,textwidth,smtpInfo,alerts,areas)) 133 self.log.debug("Adding email device") 134 if(dev == "sms"): 135 to = self.getRequired(str(i),"to") 136 textwidth = int(self.get(str(i),"textwidth",-1)) 137 self.devices.append(SmsAlertDevice(to,textwidth,smtpInfo,alerts,areas)) 138 self.log.debug("Adding sms device") 139 if(dev == "jabber"): 140 if(not jabberLoadAttempted): 141 jabber_available = self.__loadXmpp() 142 jabberLoadAttempted = True 143 144 if(jabber_available): 167 145 to = self.getRequired(str(i),"to") 168 146 wait_time = int(self.getRequired(str(i),"wait_time")) 169 147 self.devices.append(MythtvAlertDevice(MythtvAlertDeviceInfo(to,wait_time),alerts,areas)) 170 if(dev == "media"): 171 self.devices.append(MediaAlertDevice(mediaInfo,alerts,areas)) 172 if(dev == "execution"): 173 self.devices.append(ExecutionAlertDevice(exeInfo,alerts,areas)) 174 print self.__str__() 148 self.log.debug("Adding jabber device") 149 else: 150 self.log.error("Jabber Support Not Enabled, but Jabber Device Requested!") 151 if(dev == "media"): 152 self.devices.append(MediaAlertDevice(mediaInfo,alerts,areas)) 153 self.log.debug("Adding media device") 154 if(dev == "execution"): 155 self.devices.append(ExecutionAlertDevice(exeInfo,alerts,areas)) 156 self.log.debug("Adding execution device") 157 if(dev == "osd"): 158 if(not osdLoadAttempted): 159 osd_available = self.__loadOsd() 160 osdLoadAttempted = True 161 162 if(osd_available): 163 position = self.get(str(i),"position", DEFAULT_OSD_POSITION) 164 alignment = self.get(str(i),"alignment", DEFAULT_OSD_ALIGNMENT) 165 offset = int(self.get(str(i),"offset", DEFAULT_OSD_OFFSET)) 166 timeout = int(self.get(str(i),"timeout", DEFAULT_OSD_TIMEOUT)) 167 color = self.get(str(i),"color", DEFAULT_OSD_COLOR) 168 font = self.get(str(i),"font", DEFAULT_OSD_FONT) 169 self.devices.append(OsdAlertDevice(OsdAlertDeviceInfo(position, 170 alignment, 171 offset, 172 timeout, 173 color, 174 font), 175 alerts,areas)) 176 self.log.debug("Adding jabber device") 177 else: 178 self.log.error("OSD Support Not Enabled, but OSD Device Requested!") 179 if(dev == "mythtv"): 180 to = self.getRequired(str(i),"to") 181 wait_time = int(self.getRequired(str(i),"wait_time")) 182 self.devices.append(MythtvAlertDevice(MythtvAlertDeviceInfo(to,wait_time),alerts,areas)) 183 self.log.debug("Adding mythtv device") 175 184 176 185 def __str__(self): -
StormSiren/StormConfig.py
r186 r187 69 69 self.__proxy = '' 70 70 71 self.log.setLevel(logging. INFO)71 self.log.setLevel(logging.DEBUG) 72 72 self._load() 73 74 73 75 74 def _load(self): … … 145 144 if(jabber_available): 146 145 to = self.getRequired(str(i),"to") 147 self.devices.append(JabberAlertDevice(to,jabberInfo,alerts,areas)) 146 wait_time = int(self.getRequired(str(i),"wait_time")) 147 self.devices.append(MythtvAlertDevice(MythtvAlertDeviceInfo(to,wait_time),alerts,areas)) 148 148 self.log.debug("Adding jabber device") 149 149 else: 150 150 self.log.error("Jabber Support Not Enabled, but Jabber Device Requested!") 151 if(dev == "media"): 152 self.devices.append(MediaAlertDevice(mediaInfo,alerts,areas)) 153 self.log.debug("Adding media device") 154 if(dev == "execution"): 155 self.devices.append(ExecutionAlertDevice(exeInfo,alerts,areas)) 156 self.log.debug("Adding execution device") 151 157 if(dev == "osd"): 152 158 if(not osdLoadAttempted): … … 168 174 font), 169 175 alerts,areas)) 170 self.log.debug("Adding OSDdevice")176 self.log.debug("Adding jabber device") 171 177 else: 172 178 self.log.error("OSD Support Not Enabled, but OSD Device Requested!") 173 179 if(dev == "mythtv"): 174 to = self.getRequired(str(i),"to") 175 wait_time = int(self.getRequired(str(i),"wait_time")) 176 self.devices.append(MythtvAlertDevice(MythtvAlertDeviceInfo(to,wait_time),alerts,areas)) 177 self.log.debug("Adding MythTv device") 178 if(dev == "media"): 179 self.devices.append(MediaAlertDevice(mediaInfo,alerts,areas)) 180 self.log.debug("Adding media device") 181 if(dev == "execution"): 182 self.devices.append(ExecutionAlertDevice(exeInfo,alerts,areas)) 183 self.log.debug("Adding execution device") 180 to = self.getRequired(str(i),"to") 181 wait_time = int(self.getRequired(str(i),"wait_time")) 182 self.devices.append(MythtvAlertDevice(MythtvAlertDeviceInfo(to,wait_time),alerts,areas)) 183 self.log.debug("Adding mythtv device") 184 184 185 185 def __str__(self): … … 187 187 str += "\n\t".join(self.__states) 188 188 189 str += "\nProxy: % i\n" % self.__proxy190 str += "\nHistory: %i \n" % self.max_history189 str += "\nProxy: %s" % self.proxy 190 str += "\nHistory: %i" % self.max_history 191 191 str += "\nDevices: %i\n" % len(self.devices) 192 192 -
StormSiren/StormWeather.py
r174 r187 56 56 self.__simalert = simalert 57 57 self.__history = history 58 59 self.log.setLevel(logging.INFO) 58 60 59 61 def __str__(self): … … 71 73 self.__alert_devs.append(dev) 72 74 73 def logAtom(self, cap_atom): 75 def logAtomShort(self, cap_atom): 76 self.log.info("---------CAP ATOM---------") 77 for l in (cap_atom.__str__().split('\n')): 78 self.log.info(l) 79 self.log.info("---------CAP ATOM---------") 80 81 def logAtomFull(self, cap_atom): 82 self.log.info("---------CAP ATOM---------") 74 83 for l in (cap_atom.__str__().split('\n')): 75 84 self.log.info(l) … … 79 88 self.log.info(l) 80 89 self.log.info("========DESCRIPTION=======") 90 self.log.info("---------CAP ATOM---------") 81 91 82 92 def handleAtom(self, cap_atom): 83 self.logAtom (cap_atom)93 self.logAtomShort(cap_atom) 84 94 if(not self.__history.exists(cap_atom.id)): 85 95 for dev in self.__alert_devs: … … 87 97 if(not self.__simalert): 88 98 cap_atom.expand(self.simfetch,self.proxy) 89 self.logAtom (cap_atom)99 self.logAtomFull(cap_atom) 90 100 dev.send(cap_atom) 91 101 self.__history.add(cap_atom.id) -
StormSiren/StormWeather.py
r186 r187 48 48 from WeatherAlert import * 49 49 from XmlWeather import * 50 from CAP import CAP51 50 52 51 class StormWeather(XmlWeather): 53 52 def __init__(self, state, history, simfetch = False, simalert = False, proxy = None): 54 super(StormWeather,self).__init__(state, history,simfetch,proxy)53 super(StormWeather,self).__init__(state,simfetch,proxy) 55 54 self.log = logging.getLogger("StormWeather") 56 55 self.__alert_devs = [] 57 56 self.__simalert = simalert 57 self.__history = history 58 58 59 59 self.log.setLevel(logging.INFO) 60 60 61 def display(self):62 return self.__str__()63 64 61 def __str__(self): 65 62 str = "StormWeather: " + "\n" … … 72 69 return str 73 70 74 def display(self):75 print self.__str__()76 77 71 def registerDevice(self, dev): 78 72 self.log.debug("Registering Device") 79 73 self.__alert_devs.append(dev) 80 74 81 def handleAlert(self, cap_item): 82 alerted = False 75 def logAtomShort(self, cap_atom): 76 self.log.info("---------CAP ATOM---------") 77 for l in (cap_atom.__str__().split('\n')): 78 self.log.info(l) 79 self.log.info("---------CAP ATOM---------") 83 80 84 for dev in self.__alert_devs: 85 if(dev.isAlertWanted(cap_item)): 86 if(not self.__simalert): 87 dev.send(WeatherAlert(cap_item)) 88 alerted = True 89 else: 90 self.log.info("Simulated Alert on: %s" % cap_item.id) 81 def logAtomFull(self, cap_atom): 82 self.log.info("---------CAP ATOM---------") 83 for l in (cap_atom.__str__().split('\n')): 84 self.log.info(l) 85 self.log.info("========DESCRIPTION=======") 86 if(cap_atom.description): 87 for l in (cap_atom.description.split('\n')): 88 self.log.info(l) 89 self.log.info("========DESCRIPTION=======") 90 self.log.info("---------CAP ATOM---------") 91 91 92 return alerted 92 def handleAtom(self, cap_atom): 93 self.logAtomShort(cap_atom) 94 if(not self.__history.exists(cap_atom.id)): 95 for dev in self.__alert_devs: 96 if(dev.isAlertWanted(cap_atom)): 97 if(not self.__simalert): 98 cap_atom.expand(self.simfetch,self.proxy) 99 self.logAtomFull(cap_atom) 100 dev.send(cap_atom) 101 self.__history.add(cap_atom.id) 102 else: 103 self.log.info("Simulated Alert on: %s" % cap_atom.id) 104 else: 105 self.log.debug("Ignoring %s: Already alerted on" % cap_atom.id) -
StormSiren/TestAlert.py
r164 r187 59 59 self.log = logging.getLogger("TestAlert") 60 60 61 self.log.setLevel(logging.INFO) 62 61 63 def fetch(self): 62 64 self.__fetch() -
StormSiren/TestAlert.py
r184 r187 49 49 from WeatherTypes import * 50 50 from WeatherAlert import * 51 from CAP import CAP52 51 53 52 class TestAlert(object): -
StormSiren/XmlWeather.py
r174 r187 62 62 self.log = logging.getLogger("XmlWeather") 63 63 64 self.log.setLevel(logging.DEBUG) 65 64 66 def fetch(self): 65 67 self.__fetch() -
StormSiren/XmlWeather.py
r186 r187 42 42 """ 43 43 44 import urllib245 44 import logging 46 import sys47 from xml.dom import minidom48 45 49 46 from WeatherTypes import * 50 from CAP import CAP 47 from XmlFetcher import * 48 from WeatherAlert import WeatherAlert 51 49 52 50 class XmlWeather(object): 53 def __init__(self, state, history,simfetch = False, proxy = None):51 def __init__(self, state, simfetch = False, proxy = None): 54 52 super(XmlWeather,self).__init__() 55 53 self.__data = '' 56 54 self.__state = state 57 55 self.__dom = [] 58 self.__baseurl = 'http://www.weather.gov/alerts/' 59 self.__namespace = 'http://purl.org/dc/elements/1.1/' 60 self.__url = self.__baseurl + self.__state.lower() + ".cap" 61 self.__tag_item = 'cap:info' 62 self.__history = history 56 self.__baseurl = 'http://www.weather.gov/wwarss-tst/' 57 self.__url = self.__baseurl + self.__state.lower() + ".php?x=0" 58 self.__tag_item = 'entry' 63 59 self.__simfetch = simfetch 64 60 self.__proxy = proxy 65 self.log = logging.getLogger("XmlWeather") 61 self.__atoms = XmlFetcher(self.__url, self.__simfetch, self.__proxy) 62 self.log = logging.getLogger("XmlWeather") 66 63 67 64 self.log.setLevel(logging.DEBUG) … … 75 72 76 73 def __fetch(self): 77 self.log.info("Fetching: " + self.__url) 78 try: 79 if(self.__simfetch): 80 self.log.info("Simulating fetch using examples directory") 81 self.__dom = minidom.parse("examples/" + self.__state.lower() + ".cap") 82 else: 83 if(self.__proxy): 84 self.log.info("Using proxy: %s" % self.__proxy) 85 proxy_support = urllib2.ProxyHandler({"http" : self.__proxy}) 86 opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler) 87 urllib2.install_opener(opener) 88 self.__dom = minidom.parse(urllib2.urlopen(self.__url)) 89 except IOError,e: 90 # No net connection available, exit. 91 self.log.error("Internet connection not available?, exiting: %s" % e) 92 sys.exit() 74 self.__dom = self.__atoms.fetch() 93 75 94 76 def __str__(self): 95 77 str = "XmlWeather:\n" + \ 78 "SimFetch: " + self.__simfetch + "\n" + \ 79 "Proxy: " + self.__proxy + "\n" + \ 96 80 "State: " + self.__state + "\n" + \ 97 81 "URL: " + self.__url + "\n" 98 99 if(self.__simfetch):100 str += "Sim Fetch: yes\n"101 else:102 str += "Sim Fetch: no\n"103 82 return str 104 83 … … 108 87 def __parse(self): 109 88 for capXmlText in self.__dom.getElementsByTagName(self.__tag_item): 110 cap_item = CAP(capXmlText, self.__state) 111 #cap_item.display() 112 if(not self.__history.exists(cap_item.id)): 113 alerted = self.handleAlert(cap_item) 114 if(alerted): 115 self.__history.add(cap_item.id) 116 else: 117 self.log.debug("Ignoring %s: Already alerted on" % cap_item.id) 89 self.handleAtom(WeatherAlert(capXmlText, self.__state)) 118 90 91 def getSimFetch(self): 92 return self.__simfetch 119 93 120 def handleAlert(self,cap_item): 121 self.log.debug("handleAlert(%s) - %s/%s" % (cap_item.id, cap_item.county, cap_item.state)) 122 return True 94 simfetch = property(getSimFetch,None,None) 95 96 def getProxy(self): 97 return self.__proxy 98 99 proxy = property(getProxy,None,None) -
siren
r155 r187 43 43 44 44 import logging 45 import sys 45 46 from optparse import OptionParser 46 47 … … 53 54 __RELEASE_VERSION = "2.0 RC4" 54 55 __RELEASE_MONTH = "12" 55 __RELEASE_DAY = "0 8"56 __RELEASE_DAY = "01" 56 57 __RELEASE_YEAR = "2008" 58 59 logging.basicConfig(level=logging.INFO, 60 format='%(asctime)s - %(name)s:%(lineno)d - %(levelname)s - %(message)s') 57 61 58 62 def main(): … … 60 64 log = logging.getLogger() 61 65 66 log.setLevel(logging.DEBUG) 62 67 63 68 parser.add_option("-c", "--conf", dest="conf", … … 82 87 help="Print only important messages to the console") 83 88 84 parser.add_option("-l", "--logconf", dest="logconf",85 help="Override log configuration file", metavar="file_name", default=None)86 87 89 parser.add_option("-t", "--testpage", 88 90 action="store_true", dest="testpage", default=False, … … 96 98 logging.disable(logging.info) 97 99 98 conf = StormConfig(options.conf , options.logconf)100 conf = StormConfig(options.conf) 99 101 100 102 log.info("StormSiren: v%s (%s/%s/%s)" % (__RELEASE_VERSION, … … 111 113 #conf.display() 112 114 #history.display() 115 116 if(len(conf.devices) == 0): 117 log.error("No valid devices found, exiting..") 118 sys.exit(1) 113 119 114 120 if(not options.testpage):
