From f055dd56838d9b3cae4b28386d3b983e15168e2d Mon Sep 17 00:00:00 2001
From: George Nassas <gnassas@gmail.com>
Date: Tue, 5 Nov 2013 08:44:19 -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         |  8 +--
 mythtv/bindings/python/MythTV/static.py            |  4 +-
 mythtv/libs/libmyth/programinfo.cpp                | 75 +++++++++++++---------
 mythtv/libs/libmyth/programinfo.h                  |  9 ++-
 mythtv/libs/libmythbase/mythversion.h              |  4 +-
 .../datacontracts/recording.h                      |  3 +
 mythtv/libs/libmythtv/recordinginfo.cpp            | 18 +++++-
 mythtv/libs/libmythtv/recordinginfo.h              |  2 +
 mythtv/libs/libmythtv/videosource.cpp              |  8 +--
 .../programs/mythbackend/services/serviceUtil.cpp  |  1 +
 mythtv/programs/mythfrontend/progdetails.cpp       |  3 +
 .../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, 101 insertions(+), 52 deletions(-)

diff --git a/mythtv/bindings/perl/MythTV.pm b/mythtv/bindings/perl/MythTV.pm
index f6812cf..588c2a7 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 = "78";
-    our $PROTO_TOKEN = "IceBurns";
+    our $PROTO_VERSION = "79";
+    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 7e3f3cc..c3429ca 100644
--- a/mythtv/bindings/perl/MythTV/Program.pm
+++ b/mythtv/bindings/perl/MythTV/Program.pm
@@ -93,6 +93,8 @@ package MythTV::Program;
         $self->{'partnumber'}        = $_[46]; # part number
         $self->{'parttotal'}         = $_[47]; # part total
 
+        $self->{'recinput'}          = $_[48]; # recording input
+
     # Load the channel data
         if ($self->{'chanid'}) {
             $self->{'channel'} = $self->{'_mythtv'}->channel($self->{'chanid'});
@@ -189,6 +191,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 81be951..c3e6c35 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        = '78';
-    static $protocol_token          = 'IceBurns';
+    static $protocol_version        = '79';
+    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 079a478..b138130 100644
--- a/mythtv/bindings/python/MythTV/mythproto.py
+++ b/mythtv/bindings/python/MythTV/mythproto.py
@@ -841,7 +841,7 @@ class Program( CMPRecord, DictData, RECSTATUS, AUDIO_PROPS, \
                      'airdate',      'playgroup',    'recpriority2',
                      'parentid',     'storagegroup', 'audio_props',
                      'video_props',  'subtitle_type','year',
-                     'part_number',  'part_total']
+                     'part_number',  'part_total',   'recinput']
     _field_type = [  3,      3,      3,
                      0,      0,      0,
                      3,
@@ -858,7 +858,7 @@ class Program( CMPRecord, DictData, RECSTATUS, AUDIO_PROPS, \
                      5,      3,      0,
                      3,      3,      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 +886,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 +914,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 c4e1696..afef132 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 = 1320
 NVSCHEMA_VERSION = 1007
 MUSICSCHEMA_VERSION = 1018
-PROTO_VERSION = '78'
-PROTO_TOKEN = 'IceBurns'
+PROTO_VERSION = '79'
+PROTO_TOKEN = 'SeaBird'
 BACKEND_SEP = '[]:[]'
 INSTALL_PREFIX = '/usr/local'
 
diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp
index 5a50c96..bebdb34 100644
--- a/mythtv/libs/libmyth/programinfo.cpp
+++ b/mythtv/libs/libmyth/programinfo.cpp
@@ -65,7 +65,8 @@ const QString ProgramInfo::kFromRecordedQuery =
     "       p.audioprop+0,      p.videoprop+0,  p.subtitletypes+0, "//42-44
     "       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.season,           p.episode,      p.totalepisodes,   "//51-53
+    "       r.recinput                                             "//54
     "FROM recorded AS r "
     "LEFT JOIN channel AS c "
     "ON (r.chanid    = c.chanid) "
@@ -122,6 +123,7 @@ ProgramInfo::ProgramInfo(void) :
     director(),
 
     recpriority(0),
+    recinput(),
 
     chanid(0),
     chanstr(),
@@ -206,6 +208,7 @@ ProgramInfo::ProgramInfo(const ProgramInfo &other) :
     director(other.director),
 
     recpriority(other.recpriority),
+    recinput(other.recinput),
 
     chanid(other.chanid),
     chanstr(other.chanstr),
@@ -315,6 +318,7 @@ ProgramInfo::ProgramInfo(
     const QString &_inetref,
 
     int _recpriority,
+    const QString &_recinput,
 
     uint64_t _filesize,
 
@@ -355,6 +359,7 @@ ProgramInfo::ProgramInfo(
     director(),
 
     recpriority(_recpriority),
+    recinput(_recinput),
 
     chanid(_chanid),
     chanstr(_channum),
@@ -473,6 +478,7 @@ ProgramInfo::ProgramInfo(
     director(),
 
     recpriority(0),
+    recinput(),
 
     chanid(_chanid),
     chanstr(_channum),
@@ -600,6 +606,7 @@ ProgramInfo::ProgramInfo(
     director(),
 
     recpriority(0),
+    recinput(),
 
     chanid(_chanid),
     chanstr(_channum),
@@ -744,6 +751,7 @@ ProgramInfo::ProgramInfo(
     director(),
 
     recpriority(0),
+    recinput(),
 
     chanid(_chanid),
     chanstr(_channum),
@@ -1008,6 +1016,7 @@ void ProgramInfo::clone(const ProgramInfo &other,
     catType = other.catType;
 
     recpriority = other.recpriority;
+    recinput = other.recinput;
 
     filesize = other.filesize;
 
@@ -1077,6 +1086,8 @@ void ProgramInfo::clone(const ProgramInfo &other,
     programid.detach();
     inetref.detach();
 
+    recinput.detach();
+
     sortTitle.detach();
     inUseForWhat.detach();
 }
@@ -1114,6 +1125,7 @@ void ProgramInfo::clear(void)
     seriesid.clear();
     programid.clear();
     inetref.clear();
+    recinput.clear();
     catType = kCategoryNone;
 
     sortTitle.clear();
@@ -1308,6 +1320,7 @@ void ProgramInfo::ToStringList(QStringList &list) const
     INT_TO_LIST(year);              // 45
     INT_TO_LIST(partnumber);   // 46
     INT_TO_LIST(parttotal);    // 47
+    STR_TO_LIST(recinput);     // 48
 /* do not forget to update the NUMPROGRAMLINES defines! */
 }
 
@@ -1412,6 +1425,8 @@ bool ProgramInfo::FromStringList(QStringList::const_iterator &it,
     INT_FROM_LIST(partnumber);        // 46
     INT_FROM_LIST(parttotal);         // 47
 
+    STR_FROM_LIST(recinput);          // 48
+
     if (!origChanid || !origRecstartts.isValid() ||
         (origChanid != chanid) || (origRecstartts != recstartts))
     {
@@ -1529,6 +1544,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;
@@ -1616,7 +1632,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;
@@ -1939,6 +1954,7 @@ bool ProgramInfo::LoadProgramFromRecorded(
     /**///catType;
 
     recpriority  = query.value(16).toInt();
+    recinput     = query.value(54).toString();
 
     filesize     = query.value(20).toULongLong();
 
@@ -4329,6 +4345,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
@@ -4684,36 +4723,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;
@@ -4838,6 +4847,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%"),
@@ -5301,6 +5311,7 @@ bool LoadFromRecorded(
                 query.value(19).toString(), // inetref
 
                 query.value(16).toInt(),  // recpriority
+                query.value(51).toString(), // recinput
 
                 query.value(20).toULongLong(),  // filesize
 
diff --git a/mythtv/libs/libmyth/programinfo.h b/mythtv/libs/libmyth/programinfo.h
index a44aeac..e08485f 100644
--- a/mythtv/libs/libmyth/programinfo.h
+++ b/mythtv/libs/libmyth/programinfo.h
@@ -111,6 +111,7 @@ class MPUBLIC ProgramInfo
                 const QString &inetref,
 
                 int recpriority,
+                const QString &recinput,
 
                 uint64_t filesize,
 
@@ -415,6 +416,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); }
@@ -502,8 +504,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;
@@ -546,7 +550,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;
@@ -584,6 +587,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;
@@ -686,6 +690,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 f5e32e2..88a8271 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 "78"
-#define MYTH_PROTO_TOKEN "IceBurns"
+#define MYTH_PROTO_VERSION "79"
+#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 6157086..76bc440 100644
--- a/mythtv/libs/libmythservicecontracts/datacontracts/recording.h
+++ b/mythtv/libs/libmythservicecontracts/datacontracts/recording.h
@@ -40,6 +40,7 @@ class SERVICE_PUBLIC RecordingInfo : public QObject
     Q_PROPERTY( int                     DupMethod    READ DupMethod    WRITE setDupMethod    DESIGNABLE SerializeDetails )
     Q_PROPERTY( int                     EncoderId    READ EncoderId    WRITE setEncoderId    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
@@ -64,6 +65,7 @@ class SERVICE_PUBLIC RecordingInfo : public QObject
     PROPERTYIMP_ENUM( RecordingDupMethodType , DupMethod   )
     PROPERTYIMP     ( int                    , EncoderId   )
     PROPERTYIMP     ( QString                , Profile     )
+    PROPERTYIMP     ( QString                , InputName   )
 
     // Used only by Serializer
     PROPERTYIMP( bool, SerializeDetails )
@@ -107,6 +109,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 e670292..b4170d0 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())
@@ -156,6 +157,8 @@ RecordingInfo::RecordingInfo(
     inputid = _inputid;
     cardid = _cardid;
 
+    SetRecInput(CardUtil::GetDisplayName(inputid));
+
     findid = _findid;
 
     properties = ((_subtitleType    << 11) |
@@ -781,6 +784,16 @@ void RecordingInfo::ApplyTranscoderProfileChange(const QString &profile) const
     }
 }
 
+/** \fn RecordingInfo::SetInputID(uint id)
+ *  \brief Extend ProgramInfo's method to set the recording input
+ &         name as a side effect.
+ */
+void RecordingInfo::SetInputID(uint id)
+{
+    ProgramInfo::SetInputID(id);
+    SaveRecInput(CardUtil::GetDisplayName(id));
+}
+
 /** \fn RecordingInfo::QuickRecord(void)
  *  \brief Create a kSingleRecord if not already scheduled.
  */
@@ -949,7 +962,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,          "
@@ -958,7 +971,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)
@@ -992,6 +1005,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/recordinginfo.h b/mythtv/libs/libmythtv/recordinginfo.h
index 806fe2f..9a2cbbd 100644
--- a/mythtv/libs/libmythtv/recordinginfo.h
+++ b/mythtv/libs/libmythtv/recordinginfo.h
@@ -271,6 +271,8 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
     QDateTime desiredrecstartts;
     QDateTime desiredrecendts;
 
+    void SetInputID(uint id);
+
   private:
     mutable class RecordingRule *record;
 
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 1601098..ade5d3d 100644
--- a/mythtv/programs/mythbackend/services/serviceUtil.cpp
+++ b/mythtv/programs/mythbackend/services/serviceUtil.cpp
@@ -126,6 +126,7 @@ void FillProgramInfo( DTC::Program *pProgram,
             pRecording->setDupInType   ( pInfo->GetDuplicateCheckSource() );
             pRecording->setDupMethod   ( pInfo->GetDuplicateCheckMethod() );
             pRecording->setEncoderId   ( pInfo->GetCardID()               );
+            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..a1f72ad 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;
@@ -674,6 +675,7 @@ void ProgDetails::loadPage(void)
     if (recorded)
     {
         recordingHost = m_progInfo.GetHostname();
+        recordingInput = m_progInfo.GetRecInput();
         recordedFilename = m_progInfo.GetBasename();
         recordedFileSize = QString("%1 ")
             .arg(m_progInfo.GetFilesize()/((double)(1<<30)),0,'f',2);
@@ -698,6 +700,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.7.12.4 (Apple Git-37)

