]> git.etc.gen.nz Git - mythtv-status.git/commitdiff
Add scripts to return if MythTV is recording now or soon.
authorAndrew Ruthven <andrew@etc.gen.nz>
Fri, 11 Apr 2008 02:42:37 +0000 (14:42 +1200)
committerAndrew Ruthven <andrew@etc.gen.nz>
Fri, 11 Apr 2008 02:42:37 +0000 (14:42 +1200)
bin/mythtv_recording_now [new file with mode: 0755]
bin/mythtv_recording_soon [new file with mode: 0755]

diff --git a/bin/mythtv_recording_now b/bin/mythtv_recording_now
new file mode 100755 (executable)
index 0000000..5211665
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Copyright (c) 2007 Andrew Ruthven <andrew@etc.gen.nz>
+# This code is hereby licensed for public consumption under the GNU GPL v2.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+# Return an exit code of 0 if the MythTV backend is currently recording
+# a show.
+
+# Where Debian stores the config info.
+if [ -f /etc/default/mythtv-status ]
+then
+  . /etc/default/mythtv-status
+fi
+
+/usr/bin/mythtv-status -h ${HOST:=localhost} --return-code-only --recording-now
+
+if [ $? -eq 1 ]
+then
+  exit 0
+else
+  exit 1
+fi
diff --git a/bin/mythtv_recording_soon b/bin/mythtv_recording_soon
new file mode 100755 (executable)
index 0000000..b3198b5
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Copyright (c) 2007 Andrew Ruthven <andrew@etc.gen.nz>
+# This code is hereby licensed for public consumption under the GNU GPL v2.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+# Return an exit code of 0 if the MythTV backend is currently recording
+# a show or will be recording a show soon (in the next hour).
+
+# Where Debian stores the config info.
+if [ -f /etc/default/mythtv-status ]
+then
+  . /etc/default/mythtv-status
+fi
+
+/usr/bin/mythtv-status -h ${HOST:=localhost} --return-code-only \
+  --recording-now --next-recording
+
+if [ $? -eq 1 ]
+then
+  exit 0
+else
+  exit 1
+fi