From 13c84f81e7dcb1b13344e3b3d089a9cab6ef68ec Mon Sep 17 00:00:00 2001
From: George Nassas <gnassas@gmail.com>
Date: Wed, 26 Feb 2014 11:12:17 -0500
Subject: [PATCH] Update

---
 mythtv/bindings/perl/MythTV.pm                     |  4 +-
 mythtv/bindings/perl/MythTV/Program.pm             |  4 ++
 mythtv/bindings/php/MythBackend.php                |  4 +-
 mythtv/bindings/php/MythTVProgram.php              |  1 +
 mythtv/bindings/php/MythTVRecording.php            |  1 +
 mythtv/bindings/python/MythTV/mythproto.py         | 10 +--
 mythtv/bindings/python/MythTV/static.py            |  4 +-
 mythtv/libs/libmyth/programinfo.cpp                | 73 ++++++++++++----------
 mythtv/libs/libmyth/programinfo.h                  | 11 +++-
 mythtv/libs/libmythbase/mythversion.h              |  4 +-
 .../datacontracts/recording.h                      |  3 +
 mythtv/libs/libmythtv/recordinginfo.cpp            |  6 +-
 mythtv/libs/libmythtv/tv_rec.cpp                   |  8 ++-
 mythtv/libs/libmythtv/videosource.cpp              |  8 +--
 .../programs/mythbackend/services/serviceUtil.cpp  |  1 +
 mythtv/programs/mythfrontend/progdetails.cpp       |  6 +-
 .../MythCenter-wide/htmls/progdetails_page2.html   |  1 +
 .../themes/MythCenter/htmls/progdetails_page2.html |  1 +
 mythtv/themes/Terra/htmls/progdetails_page2.html   |  1 +
 mythtv/themes/default/htmls/progdetails_page2.html |  1 +
 20 files changed, 97 insertions(+), 55 deletions(-)

diff --git a/mythtv/bindings/perl/MythTV.pm b/mythtv/bindings/perl/MythTV.pm
index b1fcae5..ae9f7ff 100644
--- a/mythtv/bindings/perl/MythTV.pm
+++ b/mythtv/bindings/perl/MythTV.pm
@@ -107,8 +107,8 @@ package MythTV;
 # Note: as of July 21, 2010, this is actually a string, to account for proto
 # versions of the form "58a".  This will get used if protocol versions are 
 # changed on a fixes branch ongoing.
-    our $PROTO_VERSION = "79";
-    our $PROTO_TOKEN = "BasaltGiant";
+    our $PROTO_VERSION = "80";
+    our $PROTO_TOKEN = "SeaBird";
 
 # currentDatabaseVersion is defined in libmythtv in
 # mythtv/libs/libmythtv/dbcheck.cpp and should be the current MythTV core
diff --git a/mythtv/bindings/perl/MythTV/Program.pm b/mythtv/bindings/perl/MythTV/Program.pm
index eb70a2d..c74f00e 100644
--- a/mythtv/bindings/perl/MythTV/Program.pm
+++ b/mythtv/bindings/perl/MythTV/Program.pm
@@ -94,6 +94,8 @@ package MythTV::Program;
         $self->{'parttotal'}         = $_[47]; # part total
         $self->{'categorytype'}      = $_[48]; # category type (enum)
 
+        $self->{'recinput'}          = $_[49]; # recording input
+
     # Load the channel data
         if ($self->{'chanid'}) {
             $self->{'channel'} = $self->{'_mythtv'}->channel($self->{'chanid'});
@@ -190,6 +192,8 @@ package MythTV::Program;
                     $self->{'year'}           , # 44 production year
                     $self->{'partnumber'}     , # 45 part number
                     $self->{'parttotal'}      , # 46 part total
+
+                    $self->{'recinput'}       , # 47 rec input
                     ''                          # trailing separator
                    );
     }
diff --git a/mythtv/bindings/php/MythBackend.php b/mythtv/bindings/php/MythBackend.php
index 0866afd..41d2111 100644
--- a/mythtv/bindings/php/MythBackend.php
+++ b/mythtv/bindings/php/MythBackend.php
@@ -11,8 +11,8 @@ class MythBackend {
 
 // MYTH_PROTO_VERSION is defined in libmyth in mythtv/libs/libmyth/mythcontext.h
 // and should be the current MythTV protocol version.
-    static $protocol_version        = '79';
-    static $protocol_token          = 'BasaltGiant';
+    static $protocol_version        = '80';
+    static $protocol_token          = 'SeaBird';
 
 // The character string used by the backend to separate records
     static $backend_separator       = '[]:[]';
diff --git a/mythtv/bindings/php/MythTVProgram.php b/mythtv/bindings/php/MythTVProgram.php
index a99741e..70c6677 100644
--- a/mythtv/bindings/php/MythTVProgram.php
+++ b/mythtv/bindings/php/MythTVProgram.php
@@ -45,6 +45,7 @@ class MythTVProgram {
     public $airdate;
     public $playgroup;
     public $recpriority2;
+    public $recinput;
     public $parentid;
     public $storagegroup;
     public $audioprop;
diff --git a/mythtv/bindings/php/MythTVRecording.php b/mythtv/bindings/php/MythTVRecording.php
index 933b54f..6929126 100644
--- a/mythtv/bindings/php/MythTVRecording.php
+++ b/mythtv/bindings/php/MythTVRecording.php
@@ -34,6 +34,7 @@ class MythTVRecording {
     public  $transcoder;
     public  $timestretch;
     public  $recpriority;
+    public  $recinput;
     public  $basename;
     public  $progstart;
     public  $progend;
diff --git a/mythtv/bindings/python/MythTV/mythproto.py b/mythtv/bindings/python/MythTV/mythproto.py
index ce6c738..6ae583e 100644
--- a/mythtv/bindings/python/MythTV/mythproto.py
+++ b/mythtv/bindings/python/MythTV/mythproto.py
@@ -841,7 +841,8 @@ class Program( CMPRecord, DictData, RECSTATUS, AUDIO_PROPS, \
                      'airdate',      'playgroup',    'recpriority2',
                      'parentid',     'storagegroup', 'audio_props',
                      'video_props',  'subtitle_type','year',
-                     'part_number',  'part_total',   'categorytype']
+                     'part_number',  'part_total',   'categorytype',
+                     'recinput']
     _field_type = [  3,      3,      3,
                      0,      0,      0,
                      3,
@@ -858,7 +859,8 @@ class Program( CMPRecord, DictData, RECSTATUS, AUDIO_PROPS, \
                      5,      3,      0,
                      3,      3,      0,
                      0,      0,      0,
-                     0,      0,      0]
+                     0,      0,      0,
+                     3]
     def __str__(self):
         return u"<Program '%s','%s' at %s>" % (self.title,
                  self.starttime.isoformat(' '), hex(id(self)))
@@ -886,7 +888,7 @@ class Program( CMPRecord, DictData, RECSTATUS, AUDIO_PROPS, \
         for key in ('title','subTitle','seriesId','programId','airdate',
                 'category','hostname','chanNum','callSign','playGroup',
                 'recGroup','rectype','programFlags','chanId','recStatus',
-                'commFree','stars','filesize'):
+                'commFree','stars','filesize','recinput'):
             if key in xmldat:
                 dat[key.lower()] = xmldat[key]
         for key in ('startTime','endTime','lastModified',
@@ -914,7 +916,7 @@ class Program( CMPRecord, DictData, RECSTATUS, AUDIO_PROPS, \
                 ('ChanId', 'CallSign', 'ChanNum', 'InputId', 'SourceId'), True)
         CopyData2(prog['Channel'], dat, (('ChannelName', 'channame'),))
         CopyData(prog['Recording'], dat,
-                ('DupMethod', 'PlayGroup', 'RecType', 'RecordId'), True)
+                ('DupMethod', 'PlayGroup', 'RecType', 'RecordId', 'RecInput'), True)
         CopyData2(prog['Recording'], dat, (('DupInType', 'dupin'),
                                            ('Status', 'recstatus')))
 
diff --git a/mythtv/bindings/python/MythTV/static.py b/mythtv/bindings/python/MythTV/static.py
index a485903..30ff232 100644
--- a/mythtv/bindings/python/MythTV/static.py
+++ b/mythtv/bindings/python/MythTV/static.py
@@ -8,8 +8,8 @@ OWN_VERSION = (0,28,-1,0)
 SCHEMA_VERSION = 1322
 NVSCHEMA_VERSION = 1007
 MUSICSCHEMA_VERSION = 1018
-PROTO_VERSION = '79'
-PROTO_TOKEN = 'BasaltGiant'
+PROTO_VERSION = '80'
+PROTO_TOKEN = 'SeaBird'
 BACKEND_SEP = '[]:[]'
 INSTALL_PREFIX = '/usr/local'
 
diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp
index 7400eaf..ea64073 100644
--- a/mythtv/libs/libmyth/programinfo.cpp
+++ b/mythtv/libs/libmyth/programinfo.cpp
@@ -66,7 +66,7 @@ const QString ProgramInfo::kFromRecordedQuery =
     "       r.findid,           rec.dupin,      rec.dupmethod,     "//45-47
     "       p.syndicatedepisodenumber, p.partnumber, p.parttotal,  "//48-50
     "       p.season,           p.episode,      p.totalepisodes,   "//51-53
-    "       p.category_type                                        "//54
+    "       p.category_type,    r.recinput                         "//54-55
     "FROM recorded AS r "
     "LEFT JOIN channel AS c "
     "ON (r.chanid    = c.chanid) "
@@ -123,6 +123,7 @@ ProgramInfo::ProgramInfo(void) :
     director(),
 
     recpriority(0),
+    recinput(),
 
     chanid(0),
     chanstr(),
@@ -207,6 +208,7 @@ ProgramInfo::ProgramInfo(const ProgramInfo &other) :
     director(other.director),
 
     recpriority(other.recpriority),
+    recinput(other.recinput),
 
     chanid(other.chanid),
     chanstr(other.chanstr),
@@ -317,6 +319,7 @@ ProgramInfo::ProgramInfo(
     CategoryType  _catType,
 
     int _recpriority,
+    const QString &_recinput,
 
     uint64_t _filesize,
 
@@ -357,6 +360,7 @@ ProgramInfo::ProgramInfo(
     director(),
 
     recpriority(_recpriority),
+    recinput(_recinput),
 
     chanid(_chanid),
     chanstr(_channum),
@@ -475,6 +479,7 @@ ProgramInfo::ProgramInfo(
     director(),
 
     recpriority(0),
+    recinput(),
 
     chanid(_chanid),
     chanstr(_channum),
@@ -602,6 +607,7 @@ ProgramInfo::ProgramInfo(
     director(),
 
     recpriority(0),
+    recinput(),
 
     chanid(_chanid),
     chanstr(_channum),
@@ -746,6 +752,7 @@ ProgramInfo::ProgramInfo(
     director(),
 
     recpriority(0),
+    recinput(),
 
     chanid(_chanid),
     chanstr(_channum),
@@ -1010,6 +1017,7 @@ void ProgramInfo::clone(const ProgramInfo &other,
     catType = other.catType;
 
     recpriority = other.recpriority;
+    recinput = other.recinput;
 
     filesize = other.filesize;
 
@@ -1079,6 +1087,8 @@ void ProgramInfo::clone(const ProgramInfo &other,
     programid.detach();
     inetref.detach();
 
+    recinput.detach();
+
     sortTitle.detach();
     inUseForWhat.detach();
 }
@@ -1116,6 +1126,7 @@ void ProgramInfo::clear(void)
     seriesid.clear();
     programid.clear();
     inetref.clear();
+    recinput.clear();
     catType = kCategoryNone;
 
     sortTitle.clear();
@@ -1311,6 +1322,7 @@ void ProgramInfo::ToStringList(QStringList &list) const
     INT_TO_LIST(partnumber);   // 46
     INT_TO_LIST(parttotal);    // 47
     INT_TO_LIST(catType);      // 48
+    STR_TO_LIST(recinput);     // 49
 /* do not forget to update the NUMPROGRAMLINES defines! */
 }
 
@@ -1415,6 +1427,7 @@ bool ProgramInfo::FromStringList(QStringList::const_iterator &it,
     INT_FROM_LIST(partnumber);        // 46
     INT_FROM_LIST(parttotal);         // 47
     ENUM_FROM_LIST(catType, CategoryType); // 48
+    STR_FROM_LIST(recinput);          // 49
 
     if (!origChanid || !origRecstartts.isValid() ||
         (origChanid != chanid) || (origRecstartts != recstartts))
@@ -1533,6 +1546,7 @@ void ProgramInfo::ToMap(InfoMap &progMap,
         if (timeNow.toLocalTime().date().year() !=
             endts.toLocalTime().date().year())
             progMap["endyear"] = endts.toLocalTime().toString("yyyy");
+        progMap["inputname"] = recinput;
     }
 
     using namespace MythDate;
@@ -1620,7 +1634,6 @@ void ProgramInfo::ToMap(InfoMap &progMap,
 
     progMap["card"] = ::toString(GetRecordingStatus(), cardid);
     progMap["input"] = ::toString(GetRecordingStatus(), inputid);
-    progMap["inputname"] = QueryInputDisplayName();
 
     progMap["recpriority"] = recpriority;
     progMap["recpriority2"] = recpriority2;
@@ -1943,6 +1956,7 @@ bool ProgramInfo::LoadProgramFromRecorded(
     catType      = string_to_myth_category_type(query.value(54).toString());
 
     recpriority  = query.value(16).toInt();
+    recinput     = query.value(55).toString();
 
     filesize     = query.value(20).toULongLong();
 
@@ -4357,6 +4371,29 @@ void ProgramInfo::SaveInetRef(const QString &inet)
     SendUpdateEvent();
 }
 
+/** \fn ProgramInfo::SaveRecInput(const QString)
+ *  \brief Sets recording input display name in database,
+ *         and sets "recinput" field.
+ */
+void ProgramInfo::SaveRecInput(const QString &inputName)
+{
+    recinput = inputName;
+
+    MSqlQuery query(MSqlQuery::InitCon());
+
+    query.prepare(
+        "UPDATE recorded "
+        "SET recinput = :RECINPUT "
+        "WHERE chanid = :CHANID AND starttime = :STARTTIME "
+        "AND recordid = :RECORDID");
+
+    query.bindValue(":RECINPUT",   inputName);
+    query.bindValue(":CHANID",     chanid);
+    query.bindValue(":STARTTIME",  recstartts);
+    query.bindValue(":RECORDID",   recordid);
+    query.exec();
+}
+
 /** \brief Attempts to ascertain if the main file for this ProgramInfo
  *         is readable.
  *  \note This method often initiates a QUERY_CHECKFILE MythProto
@@ -4712,36 +4749,6 @@ bool ProgramInfo::QueryTuningInfo(QString &channum, QString &input) const
     }
 }
 
-/** \brief Returns the display name of the card input for this program.
- *  \note Ideally this would call CardUtil::GetDisplayName(), but
- *        that's in libmythtv.  Dupliacte code for now until a better
- *        solution can be found.
- */
-QString ProgramInfo::QueryInputDisplayName(void) const
-{
-    if (!inputid)
-        return QString::null;
-
-    MSqlQuery query(MSqlQuery::InitCon());
-    query.prepare("SELECT displayname, cardid, inputname "
-                  "FROM cardinput "
-                  "WHERE cardinputid = :INPUTID");
-    query.bindValue(":INPUTID", inputid);
-
-    if (!query.exec())
-        MythDB::DBError("ProgramInfo::GetInputDisplayName(uint)", query);
-    else if (query.next())
-    {
-        QString result = query.value(0).toString();
-        if (result.isEmpty())
-            result = QString("%1: %2").arg(query.value(1).toInt())
-                                      .arg(query.value(2).toString());
-        return result;
-    }
-
-    return QString::null;
-}
-
 static int init_tr(void)
 {
     static bool done = false;
@@ -4866,6 +4873,7 @@ void ProgramInfo::SubstituteMatches(QString &str)
     str.replace(QString("%PLAYGROUP%"), playgroup);
     str.replace(QString("%CHANID%"), QString::number(chanid));
     str.replace(QString("%INETREF%"), inetref);
+    str.replace(QString("%RECINPUT%"), recinput);
     str.replace(QString("%PARTNUMBER%"), QString::number(partnumber));
     str.replace(QString("%PARTTOTAL%"), QString::number(parttotal));
     str.replace(QString("%ORIGINALAIRDATE%"),
@@ -5366,6 +5374,7 @@ bool LoadFromRecorded(
                 string_to_myth_category_type(query.value(54).toString()), // category_type
 
                 query.value(16).toInt(),  // recpriority
+                query.value(55).toString(), // recinput
 
                 query.value(20).toULongLong(),  // filesize
 
diff --git a/mythtv/libs/libmyth/programinfo.h b/mythtv/libs/libmyth/programinfo.h
index 0254901..890c791 100644
--- a/mythtv/libs/libmyth/programinfo.h
+++ b/mythtv/libs/libmyth/programinfo.h
@@ -30,7 +30,7 @@
    mythtv/bindings/python/MythTV/static.py (version number)
    mythtv/bindings/python/MythTV/mythproto.py (layout)
 */
-#define NUMPROGRAMLINES 49
+#define NUMPROGRAMLINES 50
 
 class ProgramInfo;
 typedef AutoDeleteDeque<ProgramInfo*> ProgramList;
@@ -112,6 +112,7 @@ class MPUBLIC ProgramInfo
                 CategoryType  catType,
 
                 int recpriority,
+                const QString &recinput,
 
                 uint64_t filesize,
 
@@ -417,6 +418,7 @@ class MPUBLIC ProgramInfo
     QString GetCategoryTypeString(void)   const;
     int     GetRecordingPriority(void)    const { return recpriority;  }
     int     GetRecordingPriority2(void)   const { return recpriority2; }
+    QString GetRecInput(void)             const { return recinput;     }
     float   GetStars(void)                const { return stars;        }
     uint    GetStars(uint range_max)      const
         { return (int)(stars * range_max + 0.5f); }
@@ -504,8 +506,10 @@ class MPUBLIC ProgramInfo
     void SetRecordingPriority2(int priority)     { recpriority2 = priority; }
     void SetRecordingRuleID(uint id)                { recordid     = id;    }
     void SetSourceID(uint id)                       { sourceid     = id;    }
-    void SetInputID( uint id)                       { inputid      = id;    }
+    virtual void
+         SetInputID( uint id)                       { inputid      = id;    }
     void SetCardID(  uint id)                       { cardid       = id;    }
+    void SetRecInput(      const QString &inpName)  { recinput     = inpName; }
     void SetReactivated(bool reactivate)
     {
         programflags &= ~FL_REACTIVATE;
@@ -548,7 +552,6 @@ class MPUBLIC ProgramInfo
     AutoExpireType QueryAutoExpire(void) const;
     TranscodingStatus QueryTranscodeStatus(void) const;
     bool        QueryTuningInfo(QString &channum, QString &input) const;
-    QString     QueryInputDisplayName(void) const;
     uint        QueryAverageWidth(void) const;
     uint        QueryAverageHeight(void) const;
     uint        QueryAverageFrameRate(void) const;
@@ -586,6 +589,7 @@ class MPUBLIC ProgramInfo
     void UpdateInUseMark(bool force = false);
     void SaveSeasonEpisode(uint seas, uint ep);
     void SaveInetRef(const QString &inet);
+    void SaveRecInput(const QString &inputName);
 
     // Extremely slow functions that cannot be called from the UI thread.
     QString DiscoverRecordingDirectory(void) const;
@@ -688,6 +692,7 @@ class MPUBLIC ProgramInfo
     QString director;
 
     int32_t recpriority;
+    QString recinput;
 
     uint32_t chanid;
     QString chanstr; // Channum
diff --git a/mythtv/libs/libmythbase/mythversion.h b/mythtv/libs/libmythbase/mythversion.h
index cc7800f..a9f2bc4 100644
--- a/mythtv/libs/libmythbase/mythversion.h
+++ b/mythtv/libs/libmythbase/mythversion.h
@@ -39,8 +39,8 @@
  *       http://www.mythtv.org/wiki/Category:Myth_Protocol_Commands
  *       http://www.mythtv.org/wiki/Category:Myth_Protocol
  */
-#define MYTH_PROTO_VERSION "79"
-#define MYTH_PROTO_TOKEN "BasaltGiant"
+#define MYTH_PROTO_VERSION "80"
+#define MYTH_PROTO_TOKEN "SeaBird"
 
 /** \brief Increment this whenever the MythTV core database schema changes.
  *
diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/recording.h b/mythtv/libs/libmythservicecontracts/datacontracts/recording.h
index d2870eb..e247803 100644
--- a/mythtv/libs/libmythservicecontracts/datacontracts/recording.h
+++ b/mythtv/libs/libmythservicecontracts/datacontracts/recording.h
@@ -41,6 +41,7 @@ class SERVICE_PUBLIC RecordingInfo : public QObject
     Q_PROPERTY( int                     EncoderId    READ EncoderId    WRITE setEncoderId    DESIGNABLE SerializeDetails )
     Q_PROPERTY( QString                 EncoderName  READ EncoderName  WRITE setEncoderName  DESIGNABLE SerializeDetails )
     Q_PROPERTY( QString                 Profile      READ Profile      WRITE setProfile      DESIGNABLE SerializeDetails )
+    Q_PROPERTY( QString                 InputName    READ InputName    WRITE setInputName    DESIGNABLE SerializeDetails )
 
     /*
     Not using since Q_ENUMS seem to require the enum be defined in this class
@@ -66,6 +67,7 @@ class SERVICE_PUBLIC RecordingInfo : public QObject
     PROPERTYIMP     ( int                    , EncoderId   )
     PROPERTYIMP     ( QString                , EncoderName )
     PROPERTYIMP     ( QString                , Profile     )
+    PROPERTYIMP     ( QString                , InputName   )
 
     // Used only by Serializer
     PROPERTYIMP( bool, SerializeDetails )
@@ -109,6 +111,7 @@ class SERVICE_PUBLIC RecordingInfo : public QObject
             m_DupMethod       = src.m_DupMethod        ;
             m_EncoderId       = src.m_EncoderId        ;
             m_Profile         = src.m_Profile          ;
+            m_InputName       = src.m_InputName        ;
             m_SerializeDetails= src.m_SerializeDetails ;
         }
 };
diff --git a/mythtv/libs/libmythtv/recordinginfo.cpp b/mythtv/libs/libmythtv/recordinginfo.cpp
index ff2cc9e..d8801cd 100644
--- a/mythtv/libs/libmythtv/recordinginfo.cpp
+++ b/mythtv/libs/libmythtv/recordinginfo.cpp
@@ -30,6 +30,7 @@ using namespace std;
 #include "mythdb.h"
 #include "mythlogging.h"
 #include "previewgenerator.h"
+#include "cardutil.h"
 #include "channelutil.h"
 
 #define LOC      QString("RecordingInfo(%1): ").arg(GetBasename())
@@ -1025,7 +1026,7 @@ bool RecordingInfo::InsertProgram(const RecordingInfo *pg,
         "    stars,     previouslyshown,              originalairdate,  "
         "    findid,    transcoder,  playgroup,       recpriority,      "
         "    basename,  progstart,   progend,         profile,          "
-        "    duplicate, storagegroup) "
+        "    duplicate, storagegroup,recinput) "
         "VALUES"
         "  (:CHANID,   :STARTS,     :ENDS,           :TITLE,            "
         "   :SUBTITLE, :DESC,       :SEASON,         :EPISODE,          "
@@ -1034,7 +1035,7 @@ bool RecordingInfo::InsertProgram(const RecordingInfo *pg,
         "   :STARS,    :REPEAT,                      :ORIGAIRDATE,      "
         "   :FINDID,   :TRANSCODER, :PLAYGROUP,      :RECPRIORITY,      "
         "   :BASENAME, :PROGSTART,  :PROGEND,        :PROFILE,          "
-        "   0,         :STORGROUP) "
+        "   0,         :STORGROUP,  :RECINPUT)"
         );
 
     if (pg->rectype == kOverrideRecord)
@@ -1068,6 +1069,7 @@ bool RecordingInfo::InsertProgram(const RecordingInfo *pg,
     query.bindValue(":TRANSCODER",  rule->m_transcoder);
     query.bindValue(":PLAYGROUP",   pg->playgroup);
     query.bindValue(":RECPRIORITY", rule->m_recPriority);
+    query.bindValue(":RECINPUT",    null_to_empty(pg->recinput));
     query.bindValue(":BASENAME",    pg->pathname);
     query.bindValue(":STORGROUP",   null_to_empty(pg->storagegroup));
     query.bindValue(":PROGSTART",   pg->startts);
diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp
index 20c5f23..15edd97 100644
--- a/mythtv/libs/libmythtv/tv_rec.cpp
+++ b/mythtv/libs/libmythtv/tv_rec.cpp
@@ -3601,7 +3601,7 @@ uint TVRec::TuningCheckForHWChange(const TuningRequest &request,
         curCardID = channel->GetInputCardID(current_input);
         newCardID = channel->GetInputCardID(new_input);
         LOG(VB_GENERAL, LOG_INFO, LOC + QString("HW Tuner: %1->%2")
-                .arg(curCardID).arg(newCardID));
+                .arg(curCardID).arg(newCardID)); 
     }
 
     if (curCardID != newCardID || !CardUtil::IsChannelReusable(genOpt.cardtype))
@@ -3782,6 +3782,12 @@ void TVRec::TuningFrequency(const TuningRequest &request)
     else
         ok = true;
 
+    LOG(VB_RECORD, LOG_INFO, LOC + QString("Tuning on: %1").arg(input));
+    if (curRecording) {
+        curRecording->SaveRecInput(
+            CardUtil::GetDisplayName(cardid,input));
+    }
+
     if (!ok)
     {
         if (!(request.flags & kFlagLiveTV) || !(request.flags & kFlagEITScan))
diff --git a/mythtv/libs/libmythtv/videosource.cpp b/mythtv/libs/libmythtv/videosource.cpp
index 2c943c6..e5bfdf3 100644
--- a/mythtv/libs/libmythtv/videosource.cpp
+++ b/mythtv/libs/libmythtv/videosource.cpp
@@ -2561,10 +2561,10 @@ class InputDisplayName : public LineEditSetting, public CardInputDBStorage
     {
         setLabel(QObject::tr("Display name (optional)"));
         setHelpText(QObject::tr(
-                        "This name is displayed on screen when Live TV begins "
-                        "and when changing the selected input or card. If you "
-                        "use this, make sure the information is unique for "
-                        "each input."));
+                        "This name is displayed on screen when Live TV begins, "
+                        "when changing the selected input or card, and on a "
+                        "recording's info dialog. If you use this, make sure "
+                        "the information is unique for each input."));
     };
 };
 
diff --git a/mythtv/programs/mythbackend/services/serviceUtil.cpp b/mythtv/programs/mythbackend/services/serviceUtil.cpp
index 92ce181..cfecc68 100644
--- a/mythtv/programs/mythbackend/services/serviceUtil.cpp
+++ b/mythtv/programs/mythbackend/services/serviceUtil.cpp
@@ -140,6 +140,7 @@ void FillProgramInfo( DTC::Program *pProgram,
                                                                pProgram->Channel()->SourceId());
                 pRecording->setEncoderName( encoderName );
             }
+            pRecording->setInputName   ( pInfo->GetRecInput()             );
 
             const RecordingInfo ri(*pInfo);
             pRecording->setProfile( ri.GetProgramRecordingProfile() );
diff --git a/mythtv/programs/mythfrontend/progdetails.cpp b/mythtv/programs/mythfrontend/progdetails.cpp
index fcff565..c817f85 100644
--- a/mythtv/programs/mythfrontend/progdetails.cpp
+++ b/mythtv/programs/mythfrontend/progdetails.cpp
@@ -664,6 +664,7 @@ void ProgDetails::loadPage(void)
     addItem("FINDID", tr("Find ID"), s);
 
     QString recordingHost;
+    QString recordingInput;
     QString recordedFilename;
     QString recordedFileSize;
     QString recordingGroup;
@@ -671,9 +672,11 @@ void ProgDetails::loadPage(void)
     QString playbackGroup;
     QString recordingProfile;
 
+    recordingHost = m_progInfo.GetHostname();
+    recordingInput = m_progInfo.GetRecInput();
+
     if (recorded)
     {
-        recordingHost = m_progInfo.GetHostname();
         recordedFilename = m_progInfo.GetBasename();
         recordedFileSize = QString("%1 ")
             .arg(m_progInfo.GetFilesize()/((double)(1<<30)),0,'f',2);
@@ -698,6 +701,7 @@ void ProgDetails::loadPage(void)
         recordingProfile =  record->m_recProfile;
     }
     addItem("RECORDING_HOST", tr("Recording Host"), recordingHost);
+    addItem("RECORDING_INPUT", tr("Recording Input"), recordingInput);
     addItem("RECORDED_FILE_NAME", tr("Recorded File Name"), recordedFilename);
     addItem("RECORDED_FILE_SIZE", tr("Recorded File Size"), recordedFileSize);
     addItem("RECORDING_PROFILE", tr("Recording Profile"), recordingProfile);
diff --git a/mythtv/themes/MythCenter-wide/htmls/progdetails_page2.html b/mythtv/themes/MythCenter-wide/htmls/progdetails_page2.html
index 499bfb5..fdb9cf9 100644
--- a/mythtv/themes/MythCenter-wide/htmls/progdetails_page2.html
+++ b/mythtv/themes/MythCenter-wide/htmls/progdetails_page2.html
@@ -36,6 +36,7 @@
     <h1>%SEARCH_PHRASE_LABEL%</h1> <p>%SEARCH_PHRASE%</p>
     <h1>%FINDID_LABEL%</h1> <p>%FINDID%</p>
     <h1>%RECORDING_HOST_LABEL%</h1> <p>%RECORDING_HOST%</p>
+    <h1>%RECORDING_INPUT_LABEL%</h1> <p>%RECORDING_INPUT%</p>
     <h1>%RECORDED_FILE_NAME_LABEL%</h1> <p>%RECORDED_FILE_NAME%</p>
     <h1>%RECORDED_FILE_SIZE_LABEL%</h1> <p>%RECORDED_FILE_SIZE%</p>
     <h1>%RECORDING_PROFILE_LABEL%</h1> <p>%RECORDING_PROFILE%</p>
diff --git a/mythtv/themes/MythCenter/htmls/progdetails_page2.html b/mythtv/themes/MythCenter/htmls/progdetails_page2.html
index 3619729..cf36332 100644
--- a/mythtv/themes/MythCenter/htmls/progdetails_page2.html
+++ b/mythtv/themes/MythCenter/htmls/progdetails_page2.html
@@ -38,6 +38,7 @@
     <h1>%SEARCH_PHRASE_LABEL%</h1> <p>%SEARCH_PHRASE%</p>
     <h1>%FINDID_LABEL%</h1> <p>%FINDID%</p>
     <h1>%RECORDING_HOST_LABEL%</h1> <p>%RECORDING_HOST%</p>
+    <h1>%RECORDING_INPUT_LABEL%</h1> <p>%RECORDING_INPUT%</p>
     <h1>%RECORDED_FILE_NAME_LABEL%</h1> <p>%RECORDED_FILE_NAME%</p>
     <h1>%RECORDED_FILE_SIZE_LABEL%</h1> <p>%RECORDED_FILE_SIZE%</p>
     <h1>%RECORDING_PROFILE_LABEL%</h1> <p>%RECORDING_PROFILE%</p>
diff --git a/mythtv/themes/Terra/htmls/progdetails_page2.html b/mythtv/themes/Terra/htmls/progdetails_page2.html
index 243d041..a1426d6 100644
--- a/mythtv/themes/Terra/htmls/progdetails_page2.html
+++ b/mythtv/themes/Terra/htmls/progdetails_page2.html
@@ -41,6 +41,7 @@
     <h1>%SEARCH_PHRASE_LABEL%</h1> <p>%SEARCH_PHRASE%</p>
     <h1>%FINDID_LABEL%</h1> <p>%FINDID%</p>
     <h1>%RECORDING_HOST_LABEL%</h1> <p>%RECORDING_HOST%</p>
+    <h1>%RECORDING_INPUT_LABEL%</h1> <p>%RECORDING_INPUT%</p>
     <h1>%RECORDED_FILE_NAME_LABEL%</h1> <p>%RECORDED_FILE_NAME%</p>
     <h1>%RECORDED_FILE_SIZE_LABEL%</h1> <p>%RECORDED_FILE_SIZE%</p>
     <h1>%RECORDING_PROFILE_LABEL%</h1> <p>%RECORDING_PROFILE%</p>
diff --git a/mythtv/themes/default/htmls/progdetails_page2.html b/mythtv/themes/default/htmls/progdetails_page2.html
index 900fd31..40fb94b 100644
--- a/mythtv/themes/default/htmls/progdetails_page2.html
+++ b/mythtv/themes/default/htmls/progdetails_page2.html
@@ -38,6 +38,7 @@
     <h1>%SEARCH_PHRASE_LABEL%</h1> <p>%SEARCH_PHRASE%</p>
     <h1>%FINDID_LABEL%</h1> <p>%FINDID%</p>
     <h1>%RECORDING_HOST_LABEL%</h1> <p>%RECORDING_HOST%</p>
+    <h1>%RECORDING_INPUT_LABEL%</h1> <p>%RECORDING_INPUT%</p>
     <h1>%RECORDED_FILE_NAME_LABEL%</h1> <p>%RECORDED_FILE_NAME%</p>
     <h1>%RECORDED_FILE_SIZE_LABEL%</h1> <p>%RECORDED_FILE_SIZE%</p>
     <h1>%RECORDING_PROFILE_LABEL%</h1> <p>%RECORDING_PROFILE%</p>
-- 
1.8.3.4 (Apple Git-47)

