2
0

Merge branch 'refs/heads/cuttingedge-merge-ServerV2' into cuttingedge

This commit is contained in:
Glax 2024-07-09 11:17:58 +02:00
commit dd2fa3fbd7

View File

@ -83,7 +83,7 @@ public class Kavita : LibraryConnector
private IEnumerable<KavitaLibrary> GetLibraries() private IEnumerable<KavitaLibrary> GetLibraries()
{ {
Log("Getting libraries."); Log("Getting libraries.");
Stream data = NetClient.MakeRequest($"{baseUrl}/api/Library", "Bearer", auth, logger); Stream data = NetClient.MakeRequest($"{baseUrl}/api/Library/libraries", "Bearer", auth, logger);
if (data == Stream.Null) if (data == Stream.Null)
{ {
Log("No libraries returned"); Log("No libraries returned");
@ -96,11 +96,13 @@ public class Kavita : LibraryConnector
return Array.Empty<KavitaLibrary>(); return Array.Empty<KavitaLibrary>();
} }
HashSet<KavitaLibrary> ret = new(); List<KavitaLibrary> ret = new();
foreach (JsonNode? jsonNode in result) foreach (JsonNode? jsonNode in result)
{ {
var jObject = (JsonObject?)jsonNode; JsonObject? jObject = (JsonObject?)jsonNode;
if(jObject is null)
continue;
int libraryId = jObject!["id"]!.GetValue<int>(); int libraryId = jObject!["id"]!.GetValue<int>();
string libraryName = jObject["name"]!.GetValue<string>(); string libraryName = jObject["name"]!.GetValue<string>();
ret.Add(new KavitaLibrary(libraryId, libraryName)); ret.Add(new KavitaLibrary(libraryId, libraryName));