diff options
author | James Meyer <james.meyer@operamail.com> | 2008-11-09 02:33:06 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2008-11-09 02:33:06 (GMT) |
commit | 1ba69cc033dfbd0a6c4c29c6d877c7e753f96e8e (patch) | |
tree | f336ee91ce16c6591fff50340562e07e15aa1a55 /abs/mv-core/ncid/ncid.py | |
parent | 75b1bceb21faab32d8f519d6f7f7062a226f9047 (diff) | |
download | linhes_pkgbuild-1ba69cc033dfbd0a6c4c29c6d877c7e753f96e8e.zip linhes_pkgbuild-1ba69cc033dfbd0a6c4c29c6d877c7e753f96e8e.tar.gz linhes_pkgbuild-1ba69cc033dfbd0a6c4c29c6d877c7e753f96e8e.tar.bz2 |
MythVantage specific pkgs
Diffstat (limited to 'abs/mv-core/ncid/ncid.py')
-rwxr-xr-x | abs/mv-core/ncid/ncid.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/abs/mv-core/ncid/ncid.py b/abs/mv-core/ncid/ncid.py new file mode 100755 index 0000000..7ffcefe --- /dev/null +++ b/abs/mv-core/ncid/ncid.py @@ -0,0 +1,59 @@ +#!/usr/bin/python + +import MySQLdb +import sys +import getopt +import socket +import os +db = MySQLdb.connect(host="127.0.0.1", user="mythtv", passwd="mythtv", db="mythconverg") +cdb = MySQLdb.connect(host="127.0.0.1", user="mythtv", passwd="mythtv", db="ncid") +#log to logger? + + + +#log to db + +def main(argv): + + DATE=sys.stdin.readline().strip() + TIME=sys.stdin.readline().strip() + NUMBER=sys.stdin.readline().strip() + NAME=sys.stdin.readline().strip() + + + #print "start of line" + #print DATE + #print TIME + #print NUMBER + #print NAME + #print "$$$$$$$$$$$$$$$$$$" + +#notify + + + # create a cursor + cursor = db.cursor() + # execute SQL statement + cursor.execute("SELECT DISTINCT(hostname) from settings where not hostname is NULL") + result = cursor.fetchall() + + port1=str(5000) + port2=str(5001) + + + message = NAME + " :::" + "PHN" + message2 = NUMBER + " :::" + "PH2" + for row in result: + os.system("/usr/bin/osdClient.pl " + row[0] + " " + port1 + " "+ "\"" + message + "\"" + " 2>/dev/null &" ) + os.system("/usr/bin/osdClient.pl " + row[0] + " " + port2 + " "+ "\"" + message2 + "\"" + " 2>/dev/null &" ) + #print ("/usr/bin/osdClient.pl " + row[0] + " " + port2 + " "+ "\"" + message2 + "\"" + " 2>/dev/null &" ) + + + ncursor=cdb.cursor() + ncursor.execute ("""INSERT INTO cid (date,time,name,number) VALUES ('%s', '%s','%s','%s');""" %(DATE,TIME,NAME,NUMBER ) ) + + + +if __name__ == "__main__": + main(sys.argv[1:]) + |