Index: mythvideo/mythvideo/dbcheck.cpp
===================================================================
--- mythvideo/mythvideo/dbcheck.cpp	(revision 19997)
+++ mythvideo/mythvideo/dbcheck.cpp	(working copy)
@@ -1,11 +1,13 @@
 #include <QString>
 #include <QRegExp>
 #include <QStringList>
+#include <QDir>
 
 #include <mythtv/mythcontext.h>
 #include <mythtv/mythdb.h>
 #include <mythtv/mythdbcon.h>
 #include <mythtv/mythdbparams.h>
+#include <mythtv/libmyth/storagegroup.h>
 
 #include "videodlg.h"
 #include "dbcheck.h"
@@ -38,7 +40,7 @@
     const QString lastMythDVDDBVersion = "1002";
     const QString lastMythVideoVersion = "1010";
 
-    const QString currentDatabaseVersion = "1022";
+    const QString currentDatabaseVersion = "1023";
 
     const QString OldMythVideoVersionName = "VideoDBSchemaVer";
     const QString OldMythDVDVersionName = "DVDDBSchemaVer";
@@ -825,6 +827,65 @@
              performActualUpdate(updates, "1022", dbver, MythVideoVersionName);
          }
 
+        if (dbver == "1022")
+        {
+            // 1023 rearranges video filenames from prefixes &
+            // absolute paths to relative paths within storage
+            // groups.
+
+            MSqlQuery loop(MSqlQuery::InitCon());
+            if (!loop.exec("SELECT data, hostname FROM settings "
+                           "WHERE value='VideoStartupDir'"))
+            {
+                MythDB::DBError(QObject::tr("Error: Unable to retrieve "
+                                            "VideoStartupDirs"), loop);
+            } else {
+
+                // Part 1 - create storage group entries based on the
+                // values of VideoStartupDir for each host. N.B. DB
+                // updates are done within the StorageGroup class
+
+                // arrange prefixes by size so we can remove them in
+                // order of decreasing length to avoid problems with
+                // short paths being substrings of longer ones
+                QMap<int, QString> prefixes;
+
+                while (loop.next())
+                {
+                    QString hostname = loop.value(1).toString();
+                    QStringList dirs = loop.value(0).toString().split(":", QString::SkipEmptyParts);
+
+                    StorageGroup sg("Videos", hostname, false);
+
+                    for (int i = 0; i < dirs.size(); i++)
+                    {
+                        QString videoDir = QDir::cleanPath(dirs[i]);
+                        sg.AddDir(videoDir);
+
+                        if (videoDir.right(1) != "/")
+                            videoDir += "/";
+                        prefixes[-videoDir.length()] = videoDir;
+                    }
+
+                    sg.Save();
+                }
+
+                // Part 2 - remove prefixes from video filenames
+
+                QStringList updates;
+
+                foreach (QString dir, prefixes)
+                {
+                    QString sql = QString("UPDATE videometadata "
+                                          "SET filename = SUBSTR(filename,%1) "
+                                          "WHERE LEFT(filename,%2) = '%3'")
+                        .arg(dir.length()+1).arg(dir.length()).arg(dir);
+                    updates += sql;
+                }
+
+                performActualUpdate(updates, "1023", dbver, MythVideoVersionName);
+            }
+        }
     }
 }
 
Index: mythvideo/mythvideo/playercommand.cpp
===================================================================
--- mythvideo/mythvideo/playercommand.cpp	(revision 19997)
+++ mythvideo/mythvideo/playercommand.cpp	(working copy)
@@ -4,6 +4,7 @@
 
 #include <mythtv/libmythui/mythmainwindow.h>
 #include <mythtv/libmythui/mythsystem.h>
+#include <mythtv/libmyth/storagegroup.h>
 
 #include "dbaccess.h"
 #include "metadata.h"
@@ -93,7 +94,10 @@
 
     bool Play() const
     {
-        return gContext->GetMainWindow()->HandleMedia(m_handler, m_mrl,
+        StorageGroup videos("Videos");
+        QString fullName = videos.FindRecordingFile(m_mrl);
+        return gContext->GetMainWindow()->HandleMedia(m_handler,
+                fullName.length() > 0 ? fullName : m_mrl,
                 m_plot, m_title, m_director, m_length, m_year);
     }
 
