summaryrefslogtreecommitdiffstats
path: root/abs/core
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2011-12-07 19:24:16 (GMT)
committerJames Meyer <james.meyer@operamail.com>2011-12-07 19:24:16 (GMT)
commit8ae1bab112c9567ce4bbe26dee820a6dfe29daf2 (patch)
tree0256d15e8321c4cdb4c0c44ea89fcc7e6db062a8 /abs/core
parenta26d28c380288d7c70a19bee81314a934df7c788 (diff)
downloadlinhes_pkgbuild-8ae1bab112c9567ce4bbe26dee820a6dfe29daf2.zip
linhes_pkgbuild-8ae1bab112c9567ce4bbe26dee820a6dfe29daf2.tar.gz
linhes_pkgbuild-8ae1bab112c9567ce4bbe26dee820a6dfe29daf2.tar.bz2
LinHES-system: include myth_status.py/.sh
This program will give a very brief summary of upcoming recordings. If the system is a MBE it will be run at login and output will be displayed on the terminal.
Diffstat (limited to 'abs/core')
-rw-r--r--abs/core/LinHES-system/myth_status.py76
-rw-r--r--abs/core/LinHES-system/myth_status.sh3
2 files changed, 79 insertions, 0 deletions
diff --git a/abs/core/LinHES-system/myth_status.py b/abs/core/LinHES-system/myth_status.py
new file mode 100644
index 0000000..ce95c3e
--- /dev/null
+++ b/abs/core/LinHES-system/myth_status.py
@@ -0,0 +1,76 @@
+#!/usr/bin/python2
+from MythTV import MythBE,MythDB,MythLog
+import datetime,time,sys
+try:
+ be=MythBE()
+ db = MythDB()
+except:
+ print "Couldn't connect to MythTV service for status"
+ sys.exit(1)
+
+cursor = db.cursor()
+now = datetime.datetime.now()
+next_start_diff=0
+
+def formatTD(td):
+ hours = td.seconds // 3600
+ minutes = (td.seconds % 3600) // 60
+ seconds = td.seconds % 60
+ return '%s hours, %s minutes, %s seconds' % (hours, minutes, seconds)
+
+
+
+a=be.getRecorderList()
+header="#"*60
+print header
+print "\n"
+print "Tuner Status: "
+print "--------------"
+for i in a:
+ cmd="select cardtype,hostname from capturecard where cardid=%s;" %i
+
+ cursor.execute(cmd)
+ results=cursor.fetchall()
+ type = results[0][0]
+ hostname = results[0][1]
+ id = i
+ c=be.getCurrentRecording(i)
+ if c.title == None:
+ current_recording = "Idle"
+ else:
+ current_recording = "Recording %s" %c.title
+ print " Tuner %s (%s) on %s : %s " %(id, type, hostname, current_recording)
+
+print ""
+print "Upcoming Recordings:"
+print "--------------------"
+a=be.getUpcomingRecordings()
+for i in a:
+ title_chan="%s (%s)" %(i.title, i.channame)
+ print " %s - %s - %-50s " %(i.starttime,i.hostname, title_chan)
+ #start_time=time.strptime(str(i.starttime), "%Y-%m-%d %H:%M:%S")
+
+ diff = i.starttime - now
+# print diff.seconds
+ if diff.seconds < next_start_diff or next_start_diff == 0:
+ next_start_diff = diff.seconds
+
+print " "
+print "Conflicted Recordings:"
+print "----------------------"
+a=be.getConflictedRecordings()
+for i in a:
+ title_chan="%s (%s)" %(i.title, i.channame)
+ print " %s - %-50s " %(i.starttime,title_chan)
+
+print ""
+print ""
+if next_start_diff == 0:
+ ur="No recordings are scheduled"
+else:
+ d=(datetime.timedelta(seconds=next_start_diff))
+ ur=formatTD(d)
+print "The next recording starts in:\n %s" %(ur)
+
+
+
diff --git a/abs/core/LinHES-system/myth_status.sh b/abs/core/LinHES-system/myth_status.sh
new file mode 100644
index 0000000..bc986ec
--- /dev/null
+++ b/abs/core/LinHES-system/myth_status.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+MYTHCONFDIR=/usr/share/mythtv /usr/LH/bin/myth_status.py
+