diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp index 56e3ed5..154deaf 100644 --- a/mythtv/libs/libmythtv/ringbuffer.cpp +++ b/mythtv/libs/libmythtv/ringbuffer.cpp @@ -13,11 +13,13 @@ // Qt headers #include #include +#include #include "ThreadedFileWriter.h" #include "fileringbuffer.h" #include "dvdringbuffer.h" #include "bdringbuffer.h" +#include "storagegroup.h" #include "streamingringbuffer.h" #include "livetvchain.h" #include "mythcontext.h" @@ -128,11 +130,12 @@ RingBuffer *RingBuffer::Create( if (!stream_only && lfilename.startsWith("myth://")) { + QString tmpFile; struct stat fileInfo; if ((RemoteFile::Exists(lfilename, &fileInfo)) && (S_ISDIR(fileInfo.st_mode))) { - QString tmpFile = lfilename + "/VIDEO_TS"; + tmpFile = lfilename + "/VIDEO_TS"; if (RemoteFile::Exists(tmpFile)) { is_dvd = true; @@ -144,6 +147,32 @@ RingBuffer *RingBuffer::Create( is_bd = true; } } + + // Use the local path if this myth:// URL points locally + QUrl qurl(lfilename); + QString host = qurl.host(); + if (host == gCoreContext->GetHostName()) + { + StorageGroup sgroup(qurl.userName()); + tmpFile = qurl.path().mid(1); // strip leading "/" + + if (qurl.hasQuery()) + tmpFile += "?" + QUrl::fromPercentEncoding(qurl.encodedQuery()); + + if (qurl.hasFragment()) + tmpFile += "#" + qurl.fragment(); + + tmpFile = sgroup.FindRecordingFile(tmpFile); + if (!tmpFile.isEmpty()) + { + if (is_dvd) + lfilename = QString("dvd:/%1").arg(tmpFile); + else if (is_bd) + lfilename = QString("bd:/%1").arg(tmpFile); + else + lfilename = tmpFile; + } + } } if ((lfilename.left(1) == "/") || (QFile::exists(lfilename)))