1 | #!/usr/bin/python |
---|
2 | |
---|
3 | import MySQLdb |
---|
4 | import os, time |
---|
5 | |
---|
6 | def get_stuff(): |
---|
7 | conn = MySQLdb.connect (host = "localhost", |
---|
8 | user = "mythtv", |
---|
9 | passwd = "mythtv", |
---|
10 | db = "mythconverg") |
---|
11 | cursor = conn.cursor () |
---|
12 | cursor.execute ("SELECT recusage from inuseprograms") |
---|
13 | row = cursor.fetchone () |
---|
14 | cursor.close() |
---|
15 | conn.close() |
---|
16 | return row |
---|
17 | |
---|
18 | def main(): |
---|
19 | while True: |
---|
20 | row = get_stuff() |
---|
21 | if 'recorder' in str(row): |
---|
22 | print '.' |
---|
23 | time.sleep(30*60) |
---|
24 | else: |
---|
25 | break |
---|
26 | os.system('/myth/firewire_tester -B -n 0 -r 5') |
---|
27 | os.system('/myth/firewire_tester -B -n 1 -r 5') |
---|
28 | os.system('/myth/firewire_tester -B -n 2 -r 5') |
---|
29 | |
---|
30 | if __name__ == '__main__': |
---|
31 | main() |
---|