C9Glax / tranga

Docker-Container to monitor (Manga) Scanlation-Sites for download new chapters.
GNU General Public License v3.0
157 stars 15 forks source link

[It broke]: Mangadex connector fails to add chapter if chapter is null #140

Closed dare2try closed 7 months ago

dare2try commented 9 months ago

What is broken?

When attempting to add "a gyaru childhold friend like it here" using the Mangadex connector, the cover is rendered correctly but 0 chapters are found.

The resulting API call looks like this:

https://api.mangadex.org/manga/d82f5749-25eb-4e2e-a71c-221a376b77fc/feed?limit=96&offset=0&translatedLanguage[]=en

From the following lines of code, it appears that it explicitly avoids adding in the chapter, if the chapter attribute is null. Since your handling the chapter as a string and not as an Int, maybe it would be better to assign a default of N/A or if you want to go the JavaScript route NaN (though I personally prefer N/A), or maybe even 0 if that doesn't conflict with something else.

I was going to PR this change myself but I need to get setup to work in .NET again, so it might take a while and I wanted to let you know since this seems like a pretty minor fix.

Log-output

[03/06/2024 10:26:49.687]      MangaDex | Retrieved 1 publications. Term="a gyaru childhold friend like it here"
[03/06/2024 10:26:53.781]       JobBoss | Added Tranga.Jobs.DownloadNewChapters-YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0 Manga: Publication A Gyaru Childhood Friend Likes It Here YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0
[03/06/2024 10:26:53.782]       JobBoss | Exporting Job /usr/share/tranga-api/jobs/Tranga.Jobs.DownloadNewChapters-YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0.json
[03/06/2024 10:26:53.847]       JobBoss | Adding Job to Queue. Tranga.Jobs.DownloadNewChapters-YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0 Manga: Publication A Gyaru Childhood Friend Likes It Here YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0
[03/06/2024 10:26:53.860]      MangaDex | Getting new Chapters for Publication A Gyaru Childhood Friend Likes It Here YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0
[03/06/2024 10:26:53.860]      MangaDex | Getting chapters Publication A Gyaru Childhood Friend Likes It Here YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0
[03/06/2024 10:26:54.243]      MangaDex | Got 0 chapters. Publication A Gyaru Childhood Friend Likes It Here YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0
[03/06/2024 10:26:54.259]      MangaDex | Copy cover Publication A Gyaru Childhood Friend Likes It Here YWd5YXJ1Y2hpbGRob29kZnJpZW5kbGlrZXNpdGhlcmUyMDI0

Additional stuff

No response

dare2try commented 9 months ago

Here is response from the API, which I forgot to include originally

{
    "result": "ok",
    "response": "collection",
    "data": [
        {
            "id": "ddb5fb82-affb-49b2-93c3-6d2906340d9a",
            "type": "chapter",
            "attributes": {
                "volume": null,
                "chapter": null,
                "title": null,
                "translatedLanguage": "en",
                "externalUrl": null,
                "publishAt": "2024-03-05T19:29:47+00:00",
                "readableAt": "2024-03-05T19:29:47+00:00",
                "createdAt": "2024-03-05T19:29:46+00:00",
                "updatedAt": "2024-03-05T19:37:12+00:00",
                "pages": 20,
                "version": 4
            },
            "relationships": [
                {
                    "id": "d82f5749-25eb-4e2e-a71c-221a376b77fc",
                    "type": "manga"
                },
                {
                    "id": "249659bc-b517-42be-9192-ddee8197e1f4",
                    "type": "user"
                }
            ]
        }
    ],
    "limit": 96,
    "offset": 0,
    "total": 1
}
C9Glax commented 7 months ago

I think this was fixed with 21a7392493e1e13f488bfa6544ac9673d2e002dc Rated Manga had an issue with 0 chapters returning. So should be fixed.

dare2try commented 7 months ago

Confirmed that this seems to be fixed now