Skip to content

Commit

Permalink
Allow relative path when using dvd: or bd: URIs
Browse files Browse the repository at this point in the history
ProgramInfo(const QString &_pathname) constructor would assume that any path containing ./ would be a relative path and use QFileInfo::absoluteFilePath() to determine the absolute path.
This would fail should _pathname actually be a URI.

This change allows playing a URI such as bd:../mount
  • Loading branch information
jyavenard committed Feb 22, 2012
1 parent 93d3631 commit ea22304
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/programinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ ProgramInfo::ProgramInfo(const QString &_pathname) :
QString basename = _pathname.section('/', -1);
if (_pathname == basename)
SetPathname(QDir::currentPath() + '/' + _pathname);
else if (_pathname.contains("./"))
else if (_pathname.contains("./") && !_pathname.contains(":"))
SetPathname(QFileInfo(_pathname).absoluteFilePath());
else
SetPathname(_pathname);
Expand Down
24 changes: 8 additions & 16 deletions mythtv/libs/libmythtv/ringbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,31 +138,23 @@ RingBuffer *RingBuffer::Create(

if (!stream_only && (dvdurl || dvddir || dvdext))
{
if (lfilename.left(6) == "dvd://") // 'Play DVD' sends "dvd:/" + dev
lfilename.remove(0,5); // e.g. "dvd://dev/sda"
else if (lfilename.left(5) == "dvd:/") // Less correct URI "dvd:" + path
lfilename.remove(0,4); // e.g. "dvd:/videos/ET"
else if (lfilename.left(4) == "dvd:") // Win32 URI "dvd:" + abs path
lfilename.remove(0,4); // e.g. "dvd:D:\"

if (mythurl || QFile::exists(lfilename))
LOG(VB_PLAYBACK, LOG_INFO, "Trying DVD at " + lfilename);
else
if (lfilename.left(4) == "dvd:") // URI "dvd:" + path
lfilename.remove(0,4); // e.g. "dvd:/dev/dvd"

if (!(mythurl || QFile::exists(lfilename)))
lfilename = "/dev/dvd";
LOG(VB_PLAYBACK, LOG_INFO, "Trying DVD at " + lfilename);

return new DVDRingBuffer(lfilename);
}
else if (!stream_only && (bdurl || bddir))
{
if (lfilename.left(5) == "bd://") // 'Play DVD' sends "bd:/" + dev
lfilename.remove(0,4); // e.g. "bd://dev/sda"
else if (lfilename.left(4) == "bd:/") // Less correct URI "bd:" + path
if (lfilename.left(3) == "bd:") // URI "bd:" + path
lfilename.remove(0,3); // e.g. "bd:/videos/ET"

if (mythurl || QFile::exists(lfilename))
LOG(VB_PLAYBACK, LOG_INFO, "Trying BD at " + lfilename);
else
if (!(mythurl || QFile::exists(lfilename)))
lfilename = "/dev/dvd";
LOG(VB_PLAYBACK, LOG_INFO, "Trying BD at " + lfilename);

return new BDRingBuffer(lfilename);
}
Expand Down

0 comments on commit ea22304

Please sign in to comment.