source: add scanlator for mangadex
This commit is contained in:
parent
b1ceaa14da
commit
c4346d8a06
3 changed files with 46 additions and 6 deletions
|
|
@ -95,14 +95,29 @@ class Attributes {
|
|||
class Relationships {
|
||||
String? id;
|
||||
String? type;
|
||||
|
||||
Relationships({
|
||||
this.id,
|
||||
this.type,
|
||||
});
|
||||
RAttributes? attributes;
|
||||
Relationships({this.id, this.type, this.attributes});
|
||||
|
||||
Relationships.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
type = json['type'];
|
||||
// log(json['attributes'].toString());
|
||||
attributes = json['attributes'] != null
|
||||
? RAttributes.fromJson(json['attributes'])
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
class RAttributes {
|
||||
String? name;
|
||||
String? username;
|
||||
RAttributes({
|
||||
this.name,
|
||||
this.username,
|
||||
});
|
||||
|
||||
RAttributes.fromJson(Map<String, dynamic> json) {
|
||||
name = json['name'];
|
||||
username = json['username'];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ class MangaDex extends MangaYomiServices {
|
|||
var limit = chapterListResponse.limit!;
|
||||
var offset = chapterListResponse.offset!;
|
||||
var hasMoreResults = (limit + offset) < chapterListResponse.total!;
|
||||
|
||||
while (hasMoreResults) {
|
||||
offset += limit;
|
||||
var newRequest =
|
||||
|
|
@ -150,6 +149,30 @@ class MangaDex extends MangaYomiServices {
|
|||
}
|
||||
|
||||
for (var chapterData in chapterListResults!) {
|
||||
List<String> scan = [];
|
||||
var groups = chapterData.relationships!
|
||||
.where((element) => element.id != legacyNoGroupId)
|
||||
.toList();
|
||||
for (var element in groups) {
|
||||
scan.add(
|
||||
element.attributes != null ? element.attributes!.name ?? "" : "");
|
||||
}
|
||||
final scann = scan.join(" ").trim();
|
||||
if (scann.isEmpty) {
|
||||
scan = [];
|
||||
for (var element in groups) {
|
||||
scan.add(element.attributes != null
|
||||
? element.attributes!.username != null
|
||||
? "Uploaded by ${element.attributes!.username}"
|
||||
: ""
|
||||
: "");
|
||||
}
|
||||
}
|
||||
if (scann.isEmpty) {
|
||||
scan = [];
|
||||
scan.add("No Group");
|
||||
}
|
||||
|
||||
List<String> chapName = [];
|
||||
var chapAttr = chapterData.attributes!;
|
||||
if (chapAttr.volume != null && chapAttr.volume!.isNotEmpty) {
|
||||
|
|
@ -167,6 +190,7 @@ class MangaDex extends MangaYomiServices {
|
|||
if (chapName.isEmpty) {
|
||||
chapName.add("Oneshot");
|
||||
}
|
||||
scanlators.add(scan.join(" ").trim());
|
||||
chapterUrl.add("/chapter/${chapterData.id}");
|
||||
chapterTitle.add(chapName.join(" "));
|
||||
chapterDate.add(parseDate(chapAttr.publishAt!, source));
|
||||
|
|
|
|||
|
|
@ -87,3 +87,4 @@ Status getPublicationStatus(Aggregate? aggregate, mdx_detail.Attributes attr) {
|
|||
|
||||
const tagAnthologyUuid = "51d83883-4103-437c-b4b1-731cb73d786c";
|
||||
const tagOneShotUuid = "0234a31e-a729-4e28-9d6a-3f87c4966b9e";
|
||||
const legacyNoGroupId = "00e03853-1b96-4f41-9542-c71b8692033b";
|
||||
|
|
|
|||
Loading…
Reference in a new issue