Decoded Cantata streamed file URLs
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "treeview.h"
|
||||
#include "settings.h"
|
||||
#include "mpdstatus.h"
|
||||
#include "httpserver.h"
|
||||
#include <QtGui/QStyledItemDelegate>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QFontMetrics>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user