Fix wrong status at completed titles. (#3432)

This commit is contained in:
Alessandro Jean 2020-06-07 13:27:49 -03:00 committed by GitHub
parent 2f0e88d18c
commit 2d5e12b768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 25 deletions

View File

@ -6,7 +6,7 @@ ext {
appName = 'Tachiyomi: MANGA Plus by SHUEISHA' appName = 'Tachiyomi: MANGA Plus by SHUEISHA'
pkgNameSuffix = 'all.mangaplus' pkgNameSuffix = 'all.mangaplus'
extClass = '.MangaPlusFactory' extClass = '.MangaPlusFactory'
extVersionCode = 7 extVersionCode = 8
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -193,12 +193,13 @@ abstract class MangaPlus(
val details = result.success.titleDetailView!! val details = result.success.titleDetailView!!
val title = details.title val title = details.title
val isCompleted = details.nonAppearanceInfo.contains(COMPLETE_REGEX)
return SManga.create().apply { return SManga.create().apply {
author = title.author author = title.author
artist = title.author artist = title.author
description = details.overview + "\n\n" + details.viewingPeriodDescription description = details.overview + "\n\n" + details.viewingPeriodDescription
status = SManga.ONGOING status = if (isCompleted) SManga.COMPLETED else SManga.ONGOING
thumbnail_url = title.portraitImageUrl.toWeservUrl() thumbnail_url = title.portraitImageUrl.toWeservUrl()
} }
} }
@ -445,5 +446,7 @@ abstract class MangaPlus(
private const val SPLIT_PREF_TITLE = "Split double pages" private const val SPLIT_PREF_TITLE = "Split double pages"
private const val SPLIT_PREF_SUMMARY = "Not all titles support disabling this." private const val SPLIT_PREF_SUMMARY = "Not all titles support disabling this."
private const val SPLIT_PREF_DEFAULT_VALUE = true private const val SPLIT_PREF_DEFAULT_VALUE = true
private val COMPLETE_REGEX = "completado|complete".toRegex()
} }
} }

View File

@ -57,6 +57,7 @@ data class TitleDetailView(
@ProtoId(5) val nextTimeStamp: Int = 0, @ProtoId(5) val nextTimeStamp: Int = 0,
@ProtoId(6) val updateTiming: UpdateTiming? = UpdateTiming.DAY, @ProtoId(6) val updateTiming: UpdateTiming? = UpdateTiming.DAY,
@ProtoId(7) val viewingPeriodDescription: String = "", @ProtoId(7) val viewingPeriodDescription: String = "",
@ProtoId(8) val nonAppearanceInfo: String = "",
@ProtoId(9) val firstChapterList: List<Chapter> = emptyList(), @ProtoId(9) val firstChapterList: List<Chapter> = emptyList(),
@ProtoId(10) val lastChapterList: List<Chapter> = emptyList(), @ProtoId(10) val lastChapterList: List<Chapter> = emptyList(),
@ProtoId(14) val isSimulReleased: Boolean = true, @ProtoId(14) val isSimulReleased: Boolean = true,
@ -129,37 +130,37 @@ const val DECODE_SCRIPT: String = """
return helper.getProtobuf(); return helper.getProtobuf();
throw new Error("Cannot find module: " + id); throw new Error("Cannot find module: " + id);
} }
var protobuf = require("protobufjs"); var protobuf = require("protobufjs");
var Root = protobuf.Root; var Root = protobuf.Root;
var Type = protobuf.Type; var Type = protobuf.Type;
var Field = protobuf.Field; var Field = protobuf.Field;
var Enum = protobuf.Enum; var Enum = protobuf.Enum;
var OneOf = protobuf.OneOf; var OneOf = protobuf.OneOf;
var Response = new Type("Response") var Response = new Type("Response")
.add( .add(
new OneOf("data") new OneOf("data")
.add(new Field("success", 1, "SuccessResult")) .add(new Field("success", 1, "SuccessResult"))
.add(new Field("error", 2, "ErrorResult")) .add(new Field("error", 2, "ErrorResult"))
); );
var ErrorResult = new Type("ErrorResult") var ErrorResult = new Type("ErrorResult")
.add(new Field("action", 1, "Action")) .add(new Field("action", 1, "Action"))
.add(new Field("englishPopup", 2, "Popup")) .add(new Field("englishPopup", 2, "Popup"))
.add(new Field("spanishPopup", 3, "Popup")); .add(new Field("spanishPopup", 3, "Popup"));
var Action = new Enum("Action") var Action = new Enum("Action")
.add("DEFAULT", 0) .add("DEFAULT", 0)
.add("UNAUTHORIZED", 1) .add("UNAUTHORIZED", 1)
.add("MAINTAINENCE", 2) .add("MAINTAINENCE", 2)
.add("GEOIP_BLOCKING", 3); .add("GEOIP_BLOCKING", 3);
var Popup = new Type("Popup") var Popup = new Type("Popup")
.add(new Field("subject", 1, "string")) .add(new Field("subject", 1, "string"))
.add(new Field("body", 2, "string")); .add(new Field("body", 2, "string"));
var SuccessResult = new Type("SuccessResult") var SuccessResult = new Type("SuccessResult")
.add(new Field("isFeaturedUpdated", 1, "bool")) .add(new Field("isFeaturedUpdated", 1, "bool"))
.add( .add(
@ -170,16 +171,16 @@ const val DECODE_SCRIPT: String = """
.add(new Field("mangaViewer", 10, "MangaViewer")) .add(new Field("mangaViewer", 10, "MangaViewer"))
.add(new Field("webHomeView", 11, "WebHomeView")) .add(new Field("webHomeView", 11, "WebHomeView"))
); );
var TitleRankingView = new Type("TitleRankingView") var TitleRankingView = new Type("TitleRankingView")
.add(new Field("titles", 1, "Title", "repeated")); .add(new Field("titles", 1, "Title", "repeated"));
var AllTitlesView = new Type("AllTitlesView") var AllTitlesView = new Type("AllTitlesView")
.add(new Field("titles", 1, "Title", "repeated")); .add(new Field("titles", 1, "Title", "repeated"));
var WebHomeView = new Type("WebHomeView") var WebHomeView = new Type("WebHomeView")
.add(new Field("groups", 2, "UpdatedTitleGroup", "repeated")); .add(new Field("groups", 2, "UpdatedTitleGroup", "repeated"));
var TitleDetailView = new Type("TitleDetailView") var TitleDetailView = new Type("TitleDetailView")
.add(new Field("title", 1, "Title")) .add(new Field("title", 1, "Title"))
.add(new Field("titleImageUrl", 2, "string")) .add(new Field("titleImageUrl", 2, "string"))
@ -192,7 +193,7 @@ const val DECODE_SCRIPT: String = """
.add(new Field("lastChapterList", 10, "Chapter", "repeated")) .add(new Field("lastChapterList", 10, "Chapter", "repeated"))
.add(new Field("isSimulReleased", 14, "bool")) .add(new Field("isSimulReleased", 14, "bool"))
.add(new Field("chaptersDescending", 17, "bool")); .add(new Field("chaptersDescending", 17, "bool"));
var UpdateTiming = new Enum("UpdateTiming") var UpdateTiming = new Enum("UpdateTiming")
.add("NOT_REGULARLY", 0) .add("NOT_REGULARLY", 0)
.add("MONDAY", 1) .add("MONDAY", 1)
@ -203,10 +204,10 @@ const val DECODE_SCRIPT: String = """
.add("SATURDAY", 6) .add("SATURDAY", 6)
.add("SUNDAY", 7) .add("SUNDAY", 7)
.add("DAY", 8); .add("DAY", 8);
var MangaViewer = new Type("MangaViewer") var MangaViewer = new Type("MangaViewer")
.add(new Field("pages", 1, "Page", "repeated")); .add(new Field("pages", 1, "Page", "repeated"));
var Title = new Type("Title") var Title = new Type("Title")
.add(new Field("titleId", 1, "uint32")) .add(new Field("titleId", 1, "uint32"))
.add(new Field("name", 2, "string")) .add(new Field("name", 2, "string"))
@ -215,21 +216,21 @@ const val DECODE_SCRIPT: String = """
.add(new Field("landscapeImageUrl", 5, "string")) .add(new Field("landscapeImageUrl", 5, "string"))
.add(new Field("viewCount", 6, "uint32")) .add(new Field("viewCount", 6, "uint32"))
.add(new Field("language", 7, "Language", {"default": 0})); .add(new Field("language", 7, "Language", {"default": 0}));
var Language = new Enum("Language") var Language = new Enum("Language")
.add("ENGLISH", 0) .add("ENGLISH", 0)
.add("SPANISH", 1); .add("SPANISH", 1);
var UpdatedTitleGroup = new Type("UpdatedTitleGroup") var UpdatedTitleGroup = new Type("UpdatedTitleGroup")
.add(new Field("groupName", 1, "string")) .add(new Field("groupName", 1, "string"))
.add(new Field("titles", 2, "UpdatedTitle", "repeated")); .add(new Field("titles", 2, "UpdatedTitle", "repeated"));
var UpdatedTitle = new Type("UpdatedTitle") var UpdatedTitle = new Type("UpdatedTitle")
.add(new Field("title", 1, "Title")) .add(new Field("title", 1, "Title"))
.add(new Field("chapterId", 2, "uint32")) .add(new Field("chapterId", 2, "uint32"))
.add(new Field("chapterName", 3, "string")) .add(new Field("chapterName", 3, "string"))
.add(new Field("chapterSubtitle", 4, "string")); .add(new Field("chapterSubtitle", 4, "string"));
var Chapter = new Type("Chapter") var Chapter = new Type("Chapter")
.add(new Field("titleId", 1, "uint32")) .add(new Field("titleId", 1, "uint32"))
.add(new Field("chapterId", 2, "uint32")) .add(new Field("chapterId", 2, "uint32"))
@ -237,16 +238,16 @@ const val DECODE_SCRIPT: String = """
.add(new Field("subTitle", 4, "string", "optional")) .add(new Field("subTitle", 4, "string", "optional"))
.add(new Field("startTimeStamp", 6, "uint32")) .add(new Field("startTimeStamp", 6, "uint32"))
.add(new Field("endTimeStamp", 7, "uint32")); .add(new Field("endTimeStamp", 7, "uint32"));
var Page = new Type("Page") var Page = new Type("Page")
.add(new Field("page", 1, "MangaPage")); .add(new Field("page", 1, "MangaPage"));
var MangaPage = new Type("MangaPage") var MangaPage = new Type("MangaPage")
.add(new Field("imageUrl", 1, "string")) .add(new Field("imageUrl", 1, "string"))
.add(new Field("width", 2, "uint32")) .add(new Field("width", 2, "uint32"))
.add(new Field("height", 3, "uint32")) .add(new Field("height", 3, "uint32"))
.add(new Field("encryptionKey", 5, "string", "optional")); .add(new Field("encryptionKey", 5, "string", "optional"));
var root = new Root() var root = new Root()
.define("mangaplus") .define("mangaplus")
.add(Response) .add(Response)
@ -267,13 +268,13 @@ const val DECODE_SCRIPT: String = """
.add(Chapter) .add(Chapter)
.add(Page) .add(Page)
.add(MangaPage); .add(MangaPage);
function decode(arr) { function decode(arr) {
var Response = root.lookupType("Response"); var Response = root.lookupType("Response");
var message = Response.decode(arr); var message = Response.decode(arr);
return Response.toObject(message, {defaults: true}); return Response.toObject(message, {defaults: true});
} }
(function () { (function () {
return JSON.stringify(decode(BYTE_ARR)).replace(/\,\{\}/g, ""); return JSON.stringify(decode(BYTE_ARR)).replace(/\,\{\}/g, "");
})(); })();