Merge pull request #555 from NBA2K1/Kitsu-Cover-Fix

Fix MAL & Kitsu "No Cover" Exception
This commit is contained in:
Moustapha Kodjo Amadou 2025-08-18 13:10:41 +01:00 committed by GitHub
commit 069ea2ac24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 14 deletions

View file

@ -160,7 +160,7 @@ class Kitsu extends _$Kitsu {
mediaId: jsonRes['id'],
summary: jsonRes['synopsis'] ?? "",
totalChapter: (jsonRes[totalChapter] ?? 0),
coverUrl: jsonRes['posterImage']['original'] ?? "",
coverUrl: jsonRes['posterImage']?['original'] ?? "",
title: jsonRes['canonicalTitle'],
startDate: "",
publishingType: (jsonRes["subtype"] ?? ""),
@ -192,22 +192,23 @@ class Kitsu extends _$Kitsu {
final mediaId = jsonRes['id'] is String
? int.parse(jsonRes['id'])
: jsonRes['id'];
final score = jsonRes['attributes']['averageRating'] is String
? double.parse(jsonRes['attributes']['averageRating'])
: jsonRes['attributes']['averageRating'];
final attributes = jsonRes['attributes'];
final score = attributes['averageRating'] is String
? double.parse(attributes['averageRating'])
: attributes['averageRating'];
return TrackSearch(
libraryId: mediaId,
syncId: syncId,
trackingUrl: _mediaUrl(isManga ? 'manga' : 'anime', mediaId),
mediaId: mediaId,
summary: jsonRes['attributes']['synopsis'] ?? "",
totalChapter: (jsonRes['attributes'][totalChapter] ?? 0),
coverUrl: jsonRes['attributes']['posterImage']['original'] ?? "",
title: jsonRes['attributes']['canonicalTitle'],
summary: attributes['synopsis'] ?? "",
totalChapter: (attributes[totalChapter] ?? 0),
coverUrl: attributes['posterImage']?['original'] ?? "",
title: attributes['canonicalTitle'],
startDate: "",
score: score,
publishingType: (jsonRes['attributes']['subtype'] ?? ""),
publishingStatus: jsonRes['attributes']['endDate'] == null
publishingType: (attributes['subtype'] ?? ""),
publishingStatus: attributes['endDate'] == null
? "Publishing"
: "Finished",
);
@ -250,7 +251,7 @@ class Kitsu extends _$Kitsu {
trackingUrl: _mediaUrl(type, id),
summary: included['synopsis'] ?? "",
totalChapter: included[totalChapter] ?? 0,
coverUrl: included['posterImage']['original'] ?? "",
coverUrl: included['posterImage']?['original'] ?? "",
title: included['canonicalTitle'],
startDate: "",
publishingType: (included["subtype"] ?? ""),

View file

@ -159,7 +159,7 @@ class MyAnimeList extends _$MyAnimeList {
mediaId: res["id"],
summary: res["synopsis"] ?? "",
totalChapter: res[contentUnit],
coverUrl: res["main_picture"]["large"] ?? "",
coverUrl: res["main_picture"]?["large"] ?? "",
title: res["title"],
startDate: res["start_date"] ?? "",
publishingType: res["media_type"].toString().replaceAll("_", " "),
@ -197,7 +197,7 @@ class MyAnimeList extends _$MyAnimeList {
mediaId: node["id"],
summary: node["synopsis"] ?? "",
totalChapter: node[contentUnit],
coverUrl: node["main_picture"]["large"] ?? "",
coverUrl: node["main_picture"]?["large"] ?? "",
title: node["title"],
score: (node["mean"] as num?)?.toDouble(),
startDate: node["start_date"] ?? "",
@ -237,7 +237,7 @@ class MyAnimeList extends _$MyAnimeList {
mediaId: node["id"],
summary: node["synopsis"] ?? "",
totalChapter: node[contentUnit],
coverUrl: node["main_picture"]["large"] ?? "",
coverUrl: node["main_picture"]?["large"] ?? "",
title: node["title"],
score: (node["mean"] as num?)?.toDouble(),
startDate: node["start_date"] ?? "",