From 8debb46e2c37ebc5aacd2038e708d5d40d655d7e Mon Sep 17 00:00:00 2001
From: Marc Tousignant <drayson@net1plus.com>
Date: Tue, 31 Mar 2009 19:47:33 +1300
Subject: [PATCH] The XML since r20037 contains some additional states, cater
 for them.

From Marc:

OK, not good.

From my research, I am on ProtoVer 44 which was switched at 19978.
The changes to State went in at 20037, well after the switch to 44.
I am currently on 20281.

Not looking like we can use ProtoVer as the versioning check atm.

Marc

So we'll pretend that protocol version 44 is when the change happened.
---
 bin/mythtv-status | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/bin/mythtv-status b/bin/mythtv-status
index 921f545..fa816d5 100755
--- a/bin/mythtv-status
+++ b/bin/mythtv-status
@@ -192,10 +192,11 @@ my @blocks = (
     'name'  => 'Encoders',
     'type'  => 'xpath',
     'xpath' => "//Status/Encoders/Encoder",
+    'protocol_version' => [ "<= 43" ],
     'attrs' => [ qw/hostname id state connected/ ],
     'template' => "__hostname__ (__id__) - __state____connected__",
     'rewrite' => {
-      '/connected/' => { '1' => '', '0' => ' (Disconnected)' },
+      '/connected/' => { '1' => '', '0' => "${warning}(Disconnected)${normal}" },
       '/state/' => {
         '^0$' => "${safe}Idle${normal}",
         '^1$' => "${warning}Watching LiveTV${normal}",
@@ -205,6 +206,28 @@ my @blocks = (
       }
   },
 
+  # Info about the encoders.
+  {
+    'name'  => 'Encoders',
+    'type'  => 'xpath',
+    'xpath' => "//Status/Encoders/Encoder",
+    'protocol_version' => [ ">= 44" ],
+    'attrs' => [ qw/hostname id state connected/ ],
+    'template' => "__hostname__ (__id__) - __state____connected__",
+    'rewrite' => {
+      '/connected/' => { '1' => '', '0' => "${warning}(Disconnected)${normal}" },
+      '/state/' => {
+         '^-1$' => "${warning}Error${normal}",
+         '^0$' => "${safe}Idle${normal}",
+         '^1$' => "${warning}Watching LiveTV${normal}",
+         '^2$' => "${warning}Watching Pre-recorded${normal}",
+         '^3$' => "${warning}Watching DVD${normal}",
+         '^4$' => "${warning}Watching Video${normal}",
+         '^5$' => "${warning}Watching Recording${normal}",
+         '^6$' => "${warning}Recording${normal}" },
+    }
+  },
+
   # What programs (if any) are being recorded right now?
   {
     'name'  => 'Recording Now',
-- 
2.30.2