From 48edc1d7b2b07d567e5ae1086b34e55d5bc4e7ca Mon Sep 17 00:00:00 2001 From: craig Date: Sun, 4 Mar 2012 19:45:15 +0000 Subject: [PATCH] Decoded Cantata streamed file URLs --- http/httpserver.cpp | 13 +++++++++++++ http/httpserver.h | 1 + widgets/playqueueview.cpp | 14 ++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/http/httpserver.cpp b/http/httpserver.cpp index e8b42b5fc..b21015269 100644 --- a/http/httpserver.cpp +++ b/http/httpserver.cpp @@ -198,3 +198,16 @@ Song HttpServer::decodeUrl(const QString &url) const return s; } + +QString HttpServer::decodeFileUrl(const QString &file) const +{ + if (isAlive()) { + QUrl u(file); + + if (u.hasQueryItem("cantata") && u.queryItemValue("cantata")=="file") { + return u.path(); + } + } + + return QString(); +} diff --git a/http/httpserver.h b/http/httpserver.h index 1b598e5bb..7b19a55a1 100644 --- a/http/httpserver.h +++ b/http/httpserver.h @@ -52,6 +52,7 @@ public: QByteArray encodeUrl(const Song &s) const; QByteArray encodeUrl(const QString &file) const; Song decodeUrl(const QString &url) const; + QString decodeFileUrl(const QString &file) const; private: QThread *thread; diff --git a/widgets/playqueueview.cpp b/widgets/playqueueview.cpp index be1452a0f..be796ec65 100644 --- a/widgets/playqueueview.cpp +++ b/widgets/playqueueview.cpp @@ -28,6 +28,7 @@ #include "treeview.h" #include "settings.h" #include "mpdstatus.h" +#include "httpserver.h" #include #include #include @@ -207,6 +208,19 @@ public: case AlbumHeader: { QString album=song.album; + if (stream && album.isEmpty() && song.albumArtist().isEmpty()) { + title=song.file; + if (HttpServer::self()->isOurs(title)) { + QString decoded=HttpServer::self()->decodeFileUrl(title); + if (!decoded.isEmpty()) { + title=decoded; + } + } + if (song.title.isEmpty()) { + trackTitle=QString(); + } + break; + } if (song.year>0) { album+=QString(" (%1)").arg(song.year); }