@@ 11,6 11,10 @@ from launchMail import *
+ser = None
+
+
+
for arg in sys.argv:
print(arg)
@@ 101,6 105,15 @@ def sig_handler(signum, frame):
+def sig_end(signum, frame):
+ global ser
+
+ ser.close()
+ print("stopping\n")
+ sys.exit(0)
+
+
+
def resetUSB(USBDevice):
USBDEVFS_RESET= 21780
@@ 300,25 313,28 @@ def checkSilentList(number, name, book):
for i in book:
n = i.split(':')
if number == n[0]:
- log.debug('checkSilentList for {}, found: {}, {}'.format(number, n[0], n[1]))
+ print('checkSilentList for number {}, found: {}, {}'.format(number, n[0], n[1]))
return([True, n[0], n[1]])
# if number not found check name and see if it has * for number
- #for i in book:
- # n = i.split(':')
- # if name == n[1] and '*' == n[0]:
- # return(True)
for i in book:
n = i.split(':')
+ #print("book: ", i, n[1])
if name == n[1] and '*' == n[0]:
- log.debug('checkSilentList for {}, found: {}, {}'.format(name, n[0], n[1]))
+ print('checkSilentList for name {}, found: {}, {}'.format(name, n[0], n[1]))
return([True, n[0], n[1]])
-
- log.debug('checkSilentList no match: {}, {}'.format(number, name))
+ # check if regular expression (single quote as first char)
+ elif n[1][0:1] == "'" and '*' == n[0]:
+ n[1] = n[1][1:]
+ #print('n: ', n[1], 'name: ', name)
+ if re.search(n[1], name) != None:
+ print('checkSilentList for re name {}, found: {}, {}'.format(name, n[0], n[1]))
+ return([True, n[0], n[1]])
+
+ print('checkSilentList no match: {}, {}'.format(number, name))
return([False,'',''] )
-
def checkBlockList(number, name, book):
for i in book:
n = i.split(':')
@@ 343,7 359,7 @@ def checkBlockList(number, name, book):
def main(argv):
- global listSilent, listBlock, listBook
+ global ser, listSilent, listBlock, listBook
# open unknown number file
@@ 565,8 581,9 @@ def main(argv):
if __name__ == "__main__":
- # define signal
+ # define signals
signal.signal(signal.SIGUSR1, sig_handler)
+ signal.signal(signal.SIGUSR2, sig_end)
main(sys.argv)