Formatting
This commit is contained in:
@@ -40,8 +40,8 @@
|
||||
#include "tidalservice.h"
|
||||
#include "tidalbaserequest.h"
|
||||
|
||||
TidalBaseRequest::TidalBaseRequest(TidalService *service, NetworkAccessManager *network, QObject *parent) :
|
||||
QObject(parent),
|
||||
TidalBaseRequest::TidalBaseRequest(TidalService *service, NetworkAccessManager *network, QObject *parent)
|
||||
: QObject(parent),
|
||||
service_(service),
|
||||
network_(network) {}
|
||||
|
||||
@@ -171,7 +171,7 @@ QJsonObject TidalBaseRequest::ExtractJsonObj(const QByteArray &data) {
|
||||
|
||||
QJsonObject json_obj = json_doc.object();
|
||||
if (json_obj.isEmpty()) {
|
||||
Error("Received empty Json object.", json_doc);
|
||||
Error("Received empty Json object.", json_doc);
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
|
||||
@@ -93,10 +93,10 @@ void TidalFavoriteRequest::AddFavorites(const FavoriteType type, const SongList
|
||||
case FavoriteType_Artists:
|
||||
text = "artistIds";
|
||||
break;
|
||||
case FavoriteType_Albums:
|
||||
case FavoriteType_Albums:
|
||||
text = "albumIds";
|
||||
break;
|
||||
case FavoriteType_Songs:
|
||||
case FavoriteType_Songs:
|
||||
text = "trackIds";
|
||||
break;
|
||||
}
|
||||
@@ -109,11 +109,11 @@ void TidalFavoriteRequest::AddFavorites(const FavoriteType type, const SongList
|
||||
if (song.artist_id().isEmpty()) continue;
|
||||
id = song.artist_id();
|
||||
break;
|
||||
case FavoriteType_Albums:
|
||||
case FavoriteType_Albums:
|
||||
if (song.album_id().isEmpty()) continue;
|
||||
id = song.album_id();
|
||||
break;
|
||||
case FavoriteType_Songs:
|
||||
case FavoriteType_Songs:
|
||||
if (song.song_id().isEmpty()) continue;
|
||||
id = song.song_id();
|
||||
break;
|
||||
@@ -175,10 +175,10 @@ void TidalFavoriteRequest::AddFavoritesReply(QNetworkReply *reply, const Favorit
|
||||
case FavoriteType_Artists:
|
||||
emit ArtistsAdded(songs);
|
||||
break;
|
||||
case FavoriteType_Albums:
|
||||
case FavoriteType_Albums:
|
||||
emit AlbumsAdded(songs);
|
||||
break;
|
||||
case FavoriteType_Songs:
|
||||
case FavoriteType_Songs:
|
||||
emit SongsAdded(songs);
|
||||
break;
|
||||
}
|
||||
@@ -210,11 +210,11 @@ void TidalFavoriteRequest::RemoveFavorites(const FavoriteType type, const SongLi
|
||||
if (song.artist_id().isEmpty()) continue;
|
||||
id = song.artist_id();
|
||||
break;
|
||||
case FavoriteType_Albums:
|
||||
case FavoriteType_Albums:
|
||||
if (song.album_id().isEmpty()) continue;
|
||||
id = song.album_id();
|
||||
break;
|
||||
case FavoriteType_Songs:
|
||||
case FavoriteType_Songs:
|
||||
if (song.song_id().isEmpty()) continue;
|
||||
id = song.song_id();
|
||||
break;
|
||||
@@ -280,10 +280,10 @@ void TidalFavoriteRequest::RemoveFavoritesReply(QNetworkReply *reply, const Favo
|
||||
case FavoriteType_Artists:
|
||||
emit ArtistsRemoved(songs);
|
||||
break;
|
||||
case FavoriteType_Albums:
|
||||
case FavoriteType_Albums:
|
||||
emit AlbumsRemoved(songs);
|
||||
break;
|
||||
case FavoriteType_Songs:
|
||||
case FavoriteType_Songs:
|
||||
emit SongsRemoved(songs);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -728,9 +728,8 @@ void TidalRequest::AlbumsFinishCheck(const QString &artist_id, const int limit,
|
||||
|
||||
// Get songs for all the albums.
|
||||
|
||||
QHash<QString, Request> ::iterator i;
|
||||
for (i = album_songs_requests_pending_.begin() ; i != album_songs_requests_pending_.end() ; ++i) {
|
||||
Request request = i.value();
|
||||
for (QHash<QString, Request> ::iterator it = album_songs_requests_pending_.begin() ; it != album_songs_requests_pending_.end() ; ++it) {
|
||||
Request request = it.value();
|
||||
AddAlbumSongsRequest(request.artist_id, request.album_id, request.album_artist, request.album, request.album_explicit);
|
||||
}
|
||||
album_songs_requests_pending_.clear();
|
||||
@@ -1060,7 +1059,7 @@ QString TidalRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Q
|
||||
}
|
||||
|
||||
cover = cover.replace("-", "/");
|
||||
QUrl cover_url (QString("%1/images/%2/%3.jpg").arg(kResourcesUrl, cover, coversize_));
|
||||
QUrl cover_url(QString("%1/images/%2/%3.jpg").arg(kResourcesUrl, cover, coversize_));
|
||||
|
||||
title.remove(Song::kTitleRemoveMisc);
|
||||
|
||||
@@ -1171,7 +1170,7 @@ void TidalRequest::AlbumCoverReceived(QNetworkReply *reply, const QString &album
|
||||
}
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
Error(QString("%1 (%2)").arg(reply->errorString()).arg(reply->error()));
|
||||
Error(QString("%1 (%2)").arg(reply->errorString()).arg(reply->error()));
|
||||
album_covers_requests_sent_.remove(album_id);
|
||||
AlbumCoverFinishCheck();
|
||||
return;
|
||||
|
||||
@@ -638,7 +638,7 @@ void TidalService::HandleAuthReply(QNetworkReply *reply) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_obj.contains("userId") || !json_obj.contains("sessionId") || !json_obj.contains("countryCode") ) {
|
||||
if (!json_obj.contains("userId") || !json_obj.contains("sessionId") || !json_obj.contains("countryCode")) {
|
||||
LoginError("Authentication reply from server is missing userId, sessionId or countryCode", json_obj);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,14 +214,15 @@ void TidalStreamURLRequest::StreamURLReceived() {
|
||||
QString filepath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/tidalstreams";
|
||||
QString filename = "tidal-" + QString::number(song_id_) + ".xml";
|
||||
if (!QDir().mkpath(filepath)) {
|
||||
Error(QString("Failed to create directory %1.").arg(filepath), json_obj);
|
||||
Error(QString("Failed to create directory %1.").arg(filepath), json_obj);
|
||||
emit StreamURLFinished(id_, original_url_, original_url_, Song::FileType_Stream, -1, -1, -1, errors_.first());
|
||||
return;
|
||||
}
|
||||
QUrl url("file://" + filepath + "/" + filename);
|
||||
QFile file(url.toLocalFile());
|
||||
if (file.exists())
|
||||
file.remove();
|
||||
if (file.exists()) {
|
||||
file.remove();
|
||||
}
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
Error(QString("Failed to open file %1 for writing.").arg(url.toLocalFile()), json_obj);
|
||||
emit StreamURLFinished(id_, original_url_, original_url_, Song::FileType_Stream, -1, -1, -1, errors_.first());
|
||||
|
||||
Reference in New Issue
Block a user