Subsonic API: do not return an error if the artist is not found in getTopSongs
This commit is contained in:
@@ -580,13 +580,12 @@ namespace lms::api::subsonic
|
|||||||
|
|
||||||
auto transaction{ context.dbSession.createReadTransaction() };
|
auto transaction{ context.dbSession.createReadTransaction() };
|
||||||
|
|
||||||
const auto artists{ Artist::find(context.dbSession, artistName) };
|
|
||||||
if (artists.size() != 1)
|
|
||||||
throw RequestedDataNotFoundError{};
|
|
||||||
|
|
||||||
Response response{ Response::createOkResponse(context.serverProtocolVersion) };
|
Response response{ Response::createOkResponse(context.serverProtocolVersion) };
|
||||||
Response::Node& topSongs{ response.createNode("topSongs") };
|
Response::Node& topSongs{ response.createNode("topSongs") };
|
||||||
|
|
||||||
|
const auto artists{ Artist::find(context.dbSession, artistName) };
|
||||||
|
if (artists.size() == 1)
|
||||||
|
{
|
||||||
scrobbling::IScrobblingService::FindParameters params;
|
scrobbling::IScrobblingService::FindParameters params;
|
||||||
params.setUser(context.user->getId());
|
params.setUser(context.user->getId());
|
||||||
params.setRange(db::Range{ 0, count });
|
params.setRange(db::Range{ 0, count });
|
||||||
@@ -598,6 +597,7 @@ namespace lms::api::subsonic
|
|||||||
if (Track::pointer track{ Track::find(context.dbSession, trackId) })
|
if (Track::pointer track{ Track::find(context.dbSession, trackId) })
|
||||||
topSongs.addArrayChild("song", createSongNode(context, track, context.user));
|
topSongs.addArrayChild("song", createSongNode(context, track, context.user));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user