Fix ampache compatibility
This commit is contained in:
parent
fb377c32ea
commit
c0ebbc8e2f
|
@ -74,10 +74,10 @@ QUrl SubsonicBaseRequest::CreateUrl(const QString &ressource_name, const QList<P
|
|||
QUrl url(server_url());
|
||||
|
||||
if (!url.path().isEmpty() && url.path().right(1) == "/") {
|
||||
url.setPath(url.path() + QString("rest/") + ressource_name);
|
||||
url.setPath(url.path() + QString("rest/") + ressource_name + QString(".view"));
|
||||
}
|
||||
else
|
||||
url.setPath(url.path() + QString("/rest/") + ressource_name);
|
||||
url.setPath(url.path() + QString("/rest/") + ressource_name + QString(".view"));
|
||||
|
||||
url.setQuery(url_query);
|
||||
|
||||
|
|
|
@ -264,6 +264,10 @@ void SubsonicRequest::AlbumsReplyReceived(QNetworkReply *reply, const int offset
|
|||
}
|
||||
|
||||
qint64 album_id = json_obj["id"].toString().toLongLong();
|
||||
if (album_id == 0) {
|
||||
album_id = json_obj["id"].toInt();
|
||||
}
|
||||
|
||||
QString artist = json_obj["artist"].toString();
|
||||
QString album;
|
||||
if (json_obj.contains("album")) album = json_obj["album"].toString();
|
||||
|
@ -495,8 +499,13 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
|
|||
}
|
||||
|
||||
qint64 song_id = json_obj["id"].toString().toLongLong();
|
||||
if (song_id == 0) song_id = json_obj["id"].toInt();
|
||||
|
||||
qint64 album_id = json_obj["albumId"].toString().toLongLong();
|
||||
if (album_id == 0) album_id = json_obj["albumId"].toInt();
|
||||
|
||||
qint64 artist_id = json_obj["artistId"].toString().toLongLong();
|
||||
if (artist_id == 0) artist_id = json_obj["artistId"].toInt();
|
||||
|
||||
QString title = json_obj["title"].toString();
|
||||
title.remove(Song::kTitleRemoveMisc);
|
||||
|
@ -511,7 +520,10 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
|
|||
if (json_obj.contains("year")) year = json_obj["year"].toInt();
|
||||
|
||||
int disc = 0;
|
||||
if (json_obj.contains("disc")) disc = json_obj["disc"].toString().toInt();
|
||||
if (json_obj.contains("disc")) {
|
||||
disc = json_obj["disc"].toString().toInt();
|
||||
if (disc == 0) disc = json_obj["disc"].toInt();
|
||||
}
|
||||
|
||||
int track = 0;
|
||||
if (json_obj.contains("track")) track = json_obj["track"].toInt();
|
||||
|
@ -520,7 +532,10 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
|
|||
if (json_obj.contains("genre")) genre = json_obj["genre"].toString();
|
||||
|
||||
int cover_art_id = -1;
|
||||
if (json_obj.contains("coverArt")) cover_art_id = json_obj["coverArt"].toString().toInt();
|
||||
if (json_obj.contains("coverArt")) {
|
||||
cover_art_id = json_obj["coverArt"].toString().toInt();
|
||||
if (cover_art_id == 0) cover_art_id = json_obj["coverArt"].toInt();
|
||||
}
|
||||
|
||||
QUrl url;
|
||||
url.setScheme(url_handler_->scheme());
|
||||
|
|
|
@ -57,7 +57,7 @@ using std::shared_ptr;
|
|||
|
||||
const Song::Source SubsonicService::kSource = Song::Source_Subsonic;
|
||||
const char *SubsonicService::kClientName = "Strawberry";
|
||||
const char *SubsonicService::kApiVersion = "1.13.0";
|
||||
const char *SubsonicService::kApiVersion = "1.11.0";
|
||||
const char *SubsonicService::kSongsTable = "subsonic_songs";
|
||||
const char *SubsonicService::kSongsFtsTable = "subsonic_songs_fts";
|
||||
const int SubsonicService::kMaxRedirects = 3;
|
||||
|
|
|
@ -55,10 +55,10 @@ UrlHandler::LoadResult SubsonicUrlHandler::StartLoading(const QUrl &url) {
|
|||
QUrl stream_url(server_url());
|
||||
|
||||
if (!stream_url.path().isEmpty() && stream_url.path().right(1) == "/") {
|
||||
stream_url.setPath(stream_url.path() + QString("rest/stream"));
|
||||
stream_url.setPath(stream_url.path() + QString("rest/stream.view"));
|
||||
}
|
||||
else
|
||||
stream_url.setPath(stream_url.path() + QString("/rest/stream"));
|
||||
stream_url.setPath(stream_url.path() + QString("/rest/stream.view"));
|
||||
|
||||
stream_url.setQuery(url_query);
|
||||
|
||||
|
|
Loading…
Reference in New Issue