Index: libs/libmythtv/programinfo.h
===================================================================
--- libs/libmythtv/programinfo.h	(revision 17406)
+++ libs/libmythtv/programinfo.h	(working copy)
@@ -21,7 +21,7 @@
    mythtv/bindings/perl/MythTV.pm
    mythtv/bindings/python/MythTV.py
 */
-#define NUMPROGRAMLINES 46
+#define NUMPROGRAMLINES 47
 
 typedef enum {
     MARK_UNSET = -10,
@@ -332,6 +332,7 @@
     int chancommfree;
 
     QString pathname;
+    QString dirname;
     long long filesize;
     QString hostname;
     QString storagegroup;
Index: libs/libmythtv/programinfo.cpp
===================================================================
--- libs/libmythtv/programinfo.cpp	(revision 17406)
+++ libs/libmythtv/programinfo.cpp	(working copy)
@@ -189,6 +189,7 @@
     chanOutputFilters = QDeepCopy<QString>(other.chanOutputFilters);
     
     pathname = QDeepCopy<QString>(other.pathname);
+    dirname = QDeepCopy<QString>(other.dirname);
     storagegroup = QDeepCopy<QString>(other.storagegroup);
     filesize = other.filesize;
     hostname = QDeepCopy<QString>(other.hostname);
@@ -339,6 +340,7 @@
     INT_TO_LIST(audioproperties)
     INT_TO_LIST(videoproperties)
     INT_TO_LIST(subtitleType)
+    STR_TO_LIST(dirname)
 /* do not forget to update the NUMPROGRAMLINES defines! */
 }
 
@@ -452,6 +454,7 @@
     INT_FROM_LIST(audioproperties)
     INT_FROM_LIST(videoproperties)
     INT_FROM_LIST(subtitleType)
+    STR_FROM_LIST(dirname)
 
     return true;
 }
@@ -865,7 +868,7 @@
                   "lastmodified,stars,previouslyshown,originalairdate, "
                   "hostname,recordid,transcoder,playgroup, "
                   "recorded.recpriority,progstart,progend,basename,recgroup, "
-                  "storagegroup "
+                  "storagegroup, dirname "
                   "FROM recorded "
                   "LEFT JOIN channel "
                   "ON recorded.chanid = channel.chanid "
@@ -936,6 +939,7 @@
         proginfo->recpriority = query.value(22).toInt();
 
         proginfo->pathname = QString::fromUtf8(query.value(25).toString());
+        proginfo->dirname = QString::fromUtf8(query.value(28).toString());
 
         return proginfo;
     }
@@ -1559,7 +1563,7 @@
     {
         // Check to see if the file exists locally
         StorageGroup sgroup(storagegroup);
-        tmpURL = sgroup.FindRecordingFile(basename);
+        tmpURL = sgroup.FindRecordingFile(basename,dirname);
 
         if (tmpURL != "")
         {
@@ -1606,12 +1610,15 @@
  *  
  *  This method, of course, only works if a recording has been scheduled
  *  and started.
+ * 
+ * The sheduler sticks the best dir in pathname, then this function replces it
+ * with the basename to store it, then puts the full pathname.
  *
  *  \param ext    File extension for recording
  */
 void ProgramInfo::StartedRecording(QString ext)
 {
-    QString dirname = pathname;
+    dirname = pathname;
 
     if (!record)
     {
@@ -1727,7 +1734,7 @@
         "    programid, stars,       previouslyshown, originalairdate,  "
         "    findid,    transcoder,  playgroup,       recpriority,      "
         "    basename,  progstart,   progend,         profile,          "
-        "    duplicate, storagegroup) "
+        "    duplicate, storagegroup, dirname) "
         "VALUES"
         "  (:CHANID,   :STARTS,     :ENDS,           :TITLE,            "
         "   :SUBTITLE, :DESC,       :HOSTNAME,       :CATEGORY,         "
@@ -1735,7 +1742,7 @@
         "   :PROGRAMID,:STARS,      :REPEAT,         :ORIGAIRDATE,      "
         "   :FINDID,   :TRANSCODER, :PLAYGROUP,      :RECPRIORITY,      "
         "   :BASENAME, :PROGSTART,  :PROGEND,        :PROFILE,          "
-        "   0,         :STORGROUP) "
+        "   0,         :STORGROUP,  :DIRNAME) "
         );
 
     if (pg->rectype == kOverrideRecord)
@@ -1767,6 +1774,7 @@
     query.bindValue(":PLAYGROUP",   pg->playgroup.utf8());
     query.bindValue(":RECPRIORITY", schd->getRecPriority());
     query.bindValue(":BASENAME",    pg->pathname);
+    query.bindValue(":DIRNAME",     pg->dirname);
     query.bindValue(":STORGROUP",   pg->storagegroup.utf8());
     query.bindValue(":PROGSTART",   pg->startts);
     query.bindValue(":PROGEND",     pg->endts);
@@ -4795,7 +4803,7 @@
         "recorded.progend, recorded.stars, "
         "recordedprogram.audioprop+0, recordedprogram.videoprop+0, "
         "recordedprogram.subtitletypes+0, recorded.watched, "
-        "recorded.storagegroup "
+        "recorded.storagegroup, recorded.dirname "
         "FROM recorded "
         "LEFT JOIN record ON recorded.recordid = record.recordid "
         "LEFT JOIN channel ON recorded.chanid = channel.chanid "
@@ -4921,6 +4929,7 @@
             proginfo->recgroup     = QString::fromUtf8(query.value(16).toString());
             proginfo->playgroup    = QString::fromUtf8(query.value(27).toString());
             proginfo->storagegroup = QString::fromUtf8(query.value(36).toString());
+            proginfo->dirname      = QString::fromUtf8(query.value(37).toString());
             proginfo->recstatus    = rsRecorded;
 
             if ((pSchedList != NULL) && (proginfo->recendts > rectime))
Index: libs/libmyth/storagegroup.cpp
===================================================================
--- libs/libmyth/storagegroup.cpp	(revision 17406)
+++ libs/libmyth/storagegroup.cpp	(working copy)
@@ -115,12 +115,12 @@
     }
 }
 
-QString StorageGroup::FindRecordingFile(QString filename)
+QString StorageGroup::FindRecordingFile(QString filename, QString hint)
 {
     VERBOSE(VB_FILE, LOC + QString("FindRecordingFile: Searching for '%1'")
                                    .arg(filename));
 
-    QString recDir = FindRecordingDir(filename);
+    QString recDir = FindRecordingDir(filename, hint);
     QString result = "";
     
     if (!recDir.isEmpty())
@@ -139,11 +139,21 @@
     return result;
 }
 
-QString StorageGroup::FindRecordingDir(QString filename)
+QString StorageGroup::FindRecordingDir(QString filename, QString hint)
 {
     QString result = "";
     QFile checkFile("");
 
+    if( ! hint.isEmpty() ) 
+      {
+        QString testFile = hint + "/" + filename;
+        VERBOSE(VB_FILE, LOC + QString("FindRecordingDir: Checking hint '%1'")
+                .arg(hint));
+        checkFile.setName(testFile);
+        if (checkFile.exists())
+            return hint;
+      }
+    
     unsigned int curDir = 0;
     while (curDir < m_dirlist.size())
     {
Index: libs/libmyth/storagegroup.h
===================================================================
--- libs/libmyth/storagegroup.h	(revision 17406)
+++ libs/libmyth/storagegroup.h	(working copy)
@@ -21,8 +21,8 @@
     QStringList GetDirList(void) const
         { return QDeepCopy<QStringList>(m_dirlist); }
 
-    QString FindRecordingFile(QString filename);
-    QString FindRecordingDir(QString filename);
+    QString FindRecordingFile(QString filename, QString hint = "");
+    QString FindRecordingDir(QString filename, QString hint = "");
 
     QString FindNextDirMostFree(void);
 
Index: programs/mythbackend/mainserver.cpp
===================================================================
--- programs/mythbackend/mainserver.cpp	(revision 17406)
+++ programs/mythbackend/mainserver.cpp	(working copy)
@@ -1128,7 +1128,7 @@
         "recordedprogram.audioprop+0, recordedprogram.videoprop+0, "
         "recordedprogram.subtitletypes+0, transcoded, "
         "recorded.recpriority, watched, recorded.preserve, "
-        "recorded.storagegroup "
+        "recorded.storagegroup, recorded.dirname "
         "FROM recorded "
         "LEFT JOIN record ON recorded.recordid = record.recordid "
         "LEFT JOIN channel ON recorded.chanid = channel.chanid "
@@ -1214,6 +1214,7 @@
             }
 
             proginfo->pathname = QString::fromUtf8(query.value(28).toString());
+            proginfo->dirname = QString::fromUtf8(query.value(40).toString());
 
             if (proginfo->hostname.isEmpty() || proginfo->hostname.isNull())
                 proginfo->hostname = gContext->GetHostName();
Index: bindings/python/MythTV/MythTV.py
===================================================================
--- bindings/python/MythTV/MythTV.py	(revision 17406)
+++ bindings/python/MythTV/MythTV.py	(working copy)
@@ -45,7 +45,7 @@
 
 BACKEND_SEP = '[]:[]'
 PROTO_VERSION = 40
-PROGRAM_FIELDS = 46
+PROGRAM_FIELDS = 47
 
 class MythTV:
 	"""
@@ -302,6 +302,7 @@
 		self.audio_props = data[43]
 		self.video_props = data[44]
 		self.subtitle_type = data[45]
+		self.dirname = data[46]
 
 if __name__ == '__main__':
 	banner = '\'m\' is a MythTV instance.'
Index: bindings/perl/MythTV.pm
===================================================================
--- bindings/perl/MythTV.pm	(revision 17406)
+++ bindings/perl/MythTV.pm	(working copy)
@@ -98,7 +98,7 @@
 # NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
 # the number of items in a ProgramInfo QStringList group used by
 # ProgramInfo::ToSringList and ProgramInfo::FromStringList.
-    our $NUMPROGRAMLINES = 46;
+    our $NUMPROGRAMLINES = 47;
 
 # Reasons a recording wouldn't be happening (from libs/libmythtv/programinfo.h)
     our %RecStatus_Types = (
