Decode tags from files to pass to mpd in server urls
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "httpserver.h"
|
||||
#include "httpsocket.h"
|
||||
#include "utils.h"
|
||||
#include "tags.h"
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QThread>
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
@@ -149,13 +150,9 @@ QByteArray HttpServer::encodeUrl(const Song &s) const
|
||||
|
||||
QByteArray HttpServer::encodeUrl(const QString &file) const
|
||||
{
|
||||
QUrl url;
|
||||
url.setScheme("http");
|
||||
url.setHost("127.0.0.1");
|
||||
url.setPort(socket->port());
|
||||
url.setPath(file);
|
||||
url.addQueryItem("cantata", "file");
|
||||
return url.toEncoded();
|
||||
Song s=Tags::read(file);
|
||||
s.fillEmptyFields();
|
||||
return encodeUrl(s);
|
||||
}
|
||||
|
||||
Song HttpServer::decodeUrl(const QString &url) const
|
||||
@@ -198,16 +195,3 @@ 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,7 +52,6 @@ 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;
|
||||
|
||||
@@ -210,12 +210,6 @@ public:
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user