From f64437753dda2b827c151daa74c821d6d21ac438 Mon Sep 17 00:00:00 2001 From: "craig.p.drummond@gmail.com" Date: Sat, 12 May 2012 20:07:32 +0000 Subject: [PATCH] - Only attempt to load a cover from MPD dir if the song actually has a file path - For streamed songs, add actual path to URL query --- gui/covers.cpp | 13 ++++++++++--- http/httpserver.cpp | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gui/covers.cpp b/gui/covers.cpp index 9030a50fb..2c1864f68 100644 --- a/gui/covers.cpp +++ b/gui/covers.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -420,11 +421,17 @@ void Covers::clearDummyCache(const Song &song) Covers::Image Covers::getImage(const Song &song) { QString dirName; + QString songFile=song.file; bool haveAbsPath=song.file.startsWith('/'); - if (haveAbsPath || !Settings::self()->mpdDir().isEmpty()) { - dirName=song.file.endsWith('/') ? (haveAbsPath ? QString() : Settings::self()->mpdDir())+song.file - : MPDParseUtils::getDir((haveAbsPath ? QString() : Settings::self()->mpdDir())+song.file); + if (song.isCantataStream()) { + QUrl u(songFile); + songFile=u.hasQueryItem("file") ? u.queryItemValue("file") : QString(); + } + if (!songFile.isEmpty() && + (haveAbsPath || !Settings::self()->mpdDir().isEmpty())) { + dirName=songFile.endsWith('/') ? (haveAbsPath ? QString() : Settings::self()->mpdDir())+songFile + : MPDParseUtils::getDir((haveAbsPath ? QString() : Settings::self()->mpdDir())+songFile); initCoverNames(); foreach (const QString &fileName, coverFileNames) { if (QFile::exists(dirName+fileName)) { diff --git a/http/httpserver.cpp b/http/httpserver.cpp index 3330fed9d..6eb106b57 100644 --- a/http/httpserver.cpp +++ b/http/httpserver.cpp @@ -138,6 +138,9 @@ QByteArray HttpServer::encodeUrl(const Song &s) const if (s.track) { url.addQueryItem("track", QString::number(s.track)); } + if (!s.file.isEmpty()) { + url.addQueryItem("file", s.file); + } url.addQueryItem("cantata", "song"); return url.toEncoded(); }