diff options
author | James Meyer <james.meyer@operamail.com> | 2010-03-25 16:35:20 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2010-03-25 16:35:20 (GMT) |
commit | c72e5b283fb8b8cb83158fa8b81c1557b6d4af40 (patch) | |
tree | ac455eb8aa9e8c6e2fadb649821a44953033611c /abs/extra-testing/recstat | |
parent | effe3b68b666b2e242bbd53871cde8ad0792463f (diff) | |
download | linhes_pkgbuild-c72e5b283fb8b8cb83158fa8b81c1557b6d4af40.zip linhes_pkgbuild-c72e5b283fb8b8cb83158fa8b81c1557b6d4af40.tar.gz linhes_pkgbuild-c72e5b283fb8b8cb83158fa8b81c1557b6d4af40.tar.bz2 |
recstat: initial include. Does not have support for runit
recstat will need to be modified
ref #632
Diffstat (limited to 'abs/extra-testing/recstat')
-rw-r--r-- | abs/extra-testing/recstat/PKGBUILD | 17 | ||||
-rw-r--r-- | abs/extra-testing/recstat/recstat | 56 | ||||
-rw-r--r-- | abs/extra-testing/recstat/recstat.install | 12 | ||||
-rw-r--r-- | abs/extra-testing/recstat/recstat.py | 38 |
4 files changed, 123 insertions, 0 deletions
diff --git a/abs/extra-testing/recstat/PKGBUILD b/abs/extra-testing/recstat/PKGBUILD new file mode 100644 index 0000000..84a0943 --- /dev/null +++ b/abs/extra-testing/recstat/PKGBUILD @@ -0,0 +1,17 @@ +pkgname=recstat +pkgver=1 +pkgrel=7 +pkgdesc="pkg to help use the System LEDs for Recording Status" +arch=('i686' 'x86_64') +url="" +depends=('python') +license=('GPL') +source=(recstat recstat.py) +md5sums=('626acb8cdd9e5cdb3a502bc12b828067') +install=recstat.install +build () { + install -D $startdir/src/recstat $startdir/pkg/etc/rc.d/recstat + install -D $startdir/src/recstat.py $startdir/pkg/usr/bin/recstat.py +} +md5sums=('7f4ba41b65ed4d693d60d5ea00e8411b' + '9477fe77a716c308125eab521cf59f20') diff --git a/abs/extra-testing/recstat/recstat b/abs/extra-testing/recstat/recstat new file mode 100644 index 0000000..2d72c61 --- /dev/null +++ b/abs/extra-testing/recstat/recstat @@ -0,0 +1,56 @@ +#! /bin/sh + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="serial port encoder status script" +NAME=recstat +DAEMON=/usr/bin/$NAME.py +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Gracefully exit if the package has been removed. +test -x $DAEMON || exit 0 + +# +# Function that starts the daemon/service. +# +d_start() { + start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE \ + --exec $DAEMON & +} + +# +# Function that stops the daemon/service. +# +d_stop() { + kill -9 `cat $PIDFILE` +} + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + d_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + d_stop + echo "." + ;; + restart|force-reload) + echo -n "Stopping $DESC: $NAME" + d_stop + sleep 1 + echo "." + echo -n "Starting $DESC: $NAME" + d_start + echo "." + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0
\ No newline at end of file diff --git a/abs/extra-testing/recstat/recstat.install b/abs/extra-testing/recstat/recstat.install new file mode 100644 index 0000000..c45cc1b --- /dev/null +++ b/abs/extra-testing/recstat/recstat.install @@ -0,0 +1,12 @@ +# arg 1: the new package version +post_install() { + echo "" + echo "" + echo "" + echo " Edit /usr/bin/recstat.py to fit your tuner setup" + echo " http://linhes.org/bugs/projects/lin-hes/wiki/_Using_System_LEDs_for_Recording_Status_" +} + +op=$1 +shift +$op $* diff --git a/abs/extra-testing/recstat/recstat.py b/abs/extra-testing/recstat/recstat.py new file mode 100644 index 0000000..ff1b11e --- /dev/null +++ b/abs/extra-testing/recstat/recstat.py @@ -0,0 +1,38 @@ +#!/usr/bin/python + +import httplib +import serial,time + +mythStatus = "localhost:6544" +encoder1 = "Encoder 1 " +encoder2 = "Encoder 2 " +recording = "is local on mythtv and is recording" +watching = "is local on mythtv and is watching" + +#Open COM2 +s = serial.Serial(1) +#Turn off all lights +s.setDTR(0) +s.setRTS(0) + +while(True): + conn = httplib.HTTPConnection(mythStatus) + conn.request("GET", "/") + r1 = conn.getresponse() + results = r1.read() + + if(results.find(encoder1+recording)!=-1): + s.setDTR(1) + elif (results.find(encoder1+watching) !=-1): + s.setDTR(1) + else: + s.setDTR(0) + + if(results.find(encoder2+recording)!=-1): + s.setRTS(1) + elif (results.find(encoder2+watching) !=-1): + s.setRTS(1) + else: + s.setRTS(0) + + time.sleep(1)
\ No newline at end of file |