diff options
author | James Meyer <james.meyer@operamail.com> | 2010-10-23 18:17:40 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2010-10-23 18:19:39 (GMT) |
commit | adbcf19958300e9b6598990184c8815b945ba0ee (patch) | |
tree | f4283c850ac0ac202c17e78a637ee7ca8147621b /abs/mv-core/hobbitmon/hobbitstorage.py | |
parent | 61a68250df10d29b624650948484898334ff22d0 (diff) | |
download | linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.zip linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.tar.gz linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.tar.bz2 |
Removed old core and extra from repo. Renamed -testing to core/extra. This will setup the base for the testing branch.
Diffstat (limited to 'abs/mv-core/hobbitmon/hobbitstorage.py')
-rwxr-xr-x | abs/mv-core/hobbitmon/hobbitstorage.py | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/abs/mv-core/hobbitmon/hobbitstorage.py b/abs/mv-core/hobbitmon/hobbitstorage.py deleted file mode 100755 index e79f8d1..0000000 --- a/abs/mv-core/hobbitmon/hobbitstorage.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/python -# import MySQL module - -import MySQLdb -import sys -import getopt -import socket -import os -import time -import string - -def LIVETV(): - grandtotal=0 - global rectv_total - global rectv_time - global livetv_total - global livetv_time - # create a cursor - cursor = db.cursor() - # execute SQL statement - - cursor.execute("SELECT unix_timestamp(starttime),unix_timestamp(endtime),title FROM recorded where recgroup=(%s) ORDER by starttime;" , ("livetv")) - result = cursor.fetchall() - - for row in result: - # print row[0], row[1] ,row [2] - start=row[0] - end=row[1] - if ( end > start ): - total = (end - start) /60 - grandtotal+=total - hours = grandtotal / 60.0 - days = hours / 24.0 - - livetv_total=len(result) - livetv_time=hours - - - -def RECORDTV(): - grandtotal=0 - global rectv_total - global rectv_time - global livetv_total - global livetv_time - # create a cursor - cursor = db.cursor() - # execute SQL statement - - cursor.execute("SELECT unix_timestamp(starttime),unix_timestamp(endtime),title FROM recorded where not recgroup=(%s) ORDER by starttime;" , ("livetv")) - result = cursor.fetchall() - - for row in result: - # print row[0], row[1] ,row [2] - start=row[0] - end=row[1] - if ( end > start ): - total = (end - start) /60 - grandtotal+=total - hours = grandtotal / 60.0 - days = hours / 24.0 - - rectv_total=len(result) - rectv_time=hours - - - -def printvars(): - print rectv_time - print rectv_total - print livetv_time - print livetv_total - -def sendTObb(): - DATE = time.strftime("%a %b %d %H:%M:%S %Z %Y", time.localtime(time.time())) - if os.environ['BB']: - #print os.environ['BB'] - BB=os.environ['BB'] - if os.environ['BBDISP']: - #print os.environ['BBDISP'] - BBDISP=os.environ['BBDISP'] - if os.environ['MACHINE']: - # print os.environ['MACHINE'] - MACHINE=os.environ['MACHINE'] - - # MACHINE = socket.gethostname() - # MACHINE = string.replace(MACHINE, '.', ',') - INFOLINE= "\n rectv_total:" + str(rectv_total) - INFOLINE= INFOLINE + "\n rectv_time:" + str(rectv_time) - INFOLINE= INFOLINE + "\n livetv_total:" + str(livetv_total) - INFOLINE= INFOLINE + "\n livetv_time:" + str(livetv_time) - INFOLINE= INFOLINE + "\n " - - - - LINE = "status " + MACHINE + ".storage green" + " " + DATE + " " + INFOLINE - - cmd = BB + ' ' + BBDISP + ' "' + LINE + '"' - os.system(cmd) - #print LINE - -def main(argv): - global db - global rectv_total - global rectv_time - global livetv_total - global livetv_time - - rectv_total=0 - rectv_time=0 - livetv_total=0 - livetv_time=0 - - db = MySQLdb.connect(host="localhost", user="mythtv", passwd="mythtv", db="mythconverg") - - LIVETV() - RECORDTV() - #printvars() - sendTObb() -if __name__ == "__main__": - main(sys.argv[1:]) |