diff --git a/src/core/urlhandler.cpp b/src/core/urlhandler.cpp index fca86cb6..c92f4746 100644 --- a/src/core/urlhandler.cpp +++ b/src/core/urlhandler.cpp @@ -28,6 +28,8 @@ #include "song.h" #include "urlhandler.h" +UrlHandler::UrlHandler(QObject *parent) : QObject(parent) {} + UrlHandler::LoadResult::LoadResult(const QUrl &original_url, const Type type, const QUrl &stream_url, const Song::FileType filetype, const int samplerate, const int bit_depth, const qint64 length_nanosec, const QString &error) : original_url_(original_url), type_(type), @@ -48,5 +50,3 @@ UrlHandler::LoadResult::LoadResult(const QUrl &original_url, const Type type, co length_nanosec_(-1), error_(error) {} - -UrlHandler::UrlHandler(QObject *parent) : QObject(parent) {} diff --git a/src/core/urlhandler.h b/src/core/urlhandler.h index f5bd97f1..cffedd80 100644 --- a/src/core/urlhandler.h +++ b/src/core/urlhandler.h @@ -65,6 +65,7 @@ class UrlHandler : public QObject { // Might be something unplayable like lastfm://... QUrl original_url_; + // Result type Type type_; // The actual url to something that gstreamer can play. diff --git a/src/subsonic/subsonicurlhandler.cpp b/src/subsonic/subsonicurlhandler.cpp index d229d43f..935f701e 100644 --- a/src/subsonic/subsonicurlhandler.cpp +++ b/src/subsonic/subsonicurlhandler.cpp @@ -38,11 +38,11 @@ SubsonicUrlHandler::SubsonicUrlHandler(Application *app, SubsonicService *servic UrlHandler::LoadResult SubsonicUrlHandler::StartLoading(const QUrl &url) { if (!server_url().isValid()) { - return LoadResult(url, LoadResult::Error, url, Song::FileType_Stream, -1, -1, -1, tr("Subsonic server URL is invalid.")); + return LoadResult(url, LoadResult::Error, tr("Subsonic server URL is invalid.")); } if (username().isEmpty() || password().isEmpty()) { - return LoadResult(url, LoadResult::Error, url, Song::FileType_Stream, -1, -1, -1, tr("Missing Subsonic username or password.")); + return LoadResult(url, LoadResult::Error, tr("Missing Subsonic username or password.")); } ParamList params = ParamList() << Param("c", service_->client_name()) @@ -62,8 +62,9 @@ UrlHandler::LoadResult SubsonicUrlHandler::StartLoading(const QUrl &url) { if (!stream_url.path().isEmpty() && stream_url.path().right(1) == "/") { stream_url.setPath(stream_url.path() + QString("rest/stream.view")); } - else + else { stream_url.setPath(stream_url.path() + QString("/rest/stream.view")); + } stream_url.setQuery(url_query); diff --git a/src/tidal/tidalurlhandler.cpp b/src/tidal/tidalurlhandler.cpp index 9afe7bf9..b6590c6e 100644 --- a/src/tidal/tidalurlhandler.cpp +++ b/src/tidal/tidalurlhandler.cpp @@ -54,10 +54,12 @@ void TidalUrlHandler::GetStreamURLFinished(const QUrl &original_url, const QUrl if (task_id_ == -1) return; CancelTask(); - if (error.isEmpty()) + if (error.isEmpty()) { emit AsyncLoadComplete(LoadResult(original_url, LoadResult::TrackAvailable, stream_url, filetype, samplerate, bit_depth, duration)); - else - emit AsyncLoadComplete(LoadResult(original_url, LoadResult::Error, stream_url, filetype, -1, -1, -1, error)); + } + else { + emit AsyncLoadComplete(LoadResult(original_url, LoadResult::Error, error)); + } }