getmango / Mango

Mango is a self-hosted manga server and web reader
https://getmango.app
MIT License
1.68k stars 117 forks source link

[Feature Request] MangaDex in API Improvements #170

Open goldbattle opened 3 years ago

goldbattle commented 3 years ago

Thanks for the great project, have been experimenting with it, and am enjoying the automatic mangadex download utility. I am planning on trying to integrate this as a server option for tachiyomi and Neko. There are a few things that would really help me in this process:

Describe the solution you'd like What would be nice is if the local manga has a mangadex id, that the API reports this and the chapter id. I see that it is stored in the queue db, but the actual /api/library or /api/book/ don't report this external manga and chapter id.

I am not sure how this will work for multiple plugins, but a simple way would to have these as additional columns in the database that could then be displayed in the api (for example a id_mangadex in both the titles and entries). If the manga is not one downloaded from mangadex, this value could just report null.

Additionally, it would be nice to have an API endpoint to return a local "book" based on the mangadex id and not the id that mango uses. This would be useful for quickly checking if mango has a given mangadex manga downloaded.

Additional context For example this would be ideal for this manga:

{
  "dir": "/root/mango/library",
  "titles": [
    {
      "dir": "/root/mango/library/Tondemo Skill de Isekai Hourou Meshi_ Sui no Daibouken",
      "title": "Tondemo Skill de Isekai Hourou Meshi_ Sui no Daibouken",
      "id": "8bed99917ac34a63a97987103dcf21c2",
      "id_mangadex": "37392", //< ***THIS HAS BEEN ADDED***
      "signature": 4246339266,
      "display_name": "Tondemo Skill de Isekai Hourou Meshi_ Sui no Daibouken",
      "cover_url": "/api/cover/8bed99917ac34a63a97987103dcf21c2/a85eeb6ca9f34b1caefc0402e4920217",
      "mtime": 1614579729,
      "titles": [],
      "entries": [
        {
          "zip_path": "/root/mango/library/Tondemo Skill de Isekai Hourou Meshi_ Sui no Daibouken/Vol.1 Ch.1 The Man Dragged into Another World, Fenrir, and the Slime.cbz",
          "title": "Vol.1 Ch.1 The Man Dragged into Another World, Fenrir, and the Slime",
          "size": "6.22MiB",
          "id": "a85eeb6ca9f34b1caefc0402e4920217",
          "id_mangadex": "635134", //< ***THIS HAS BEEN ADDED***
          "title_id": "8bed99917ac34a63a97987103dcf21c2",
          "display_name": "Vol.1 Ch.1 The Man Dragged into Another World, Fenrir, and the Slime",
          "cover_url": "/api/cover/8bed99917ac34a63a97987103dcf21c2/a85eeb6ca9f34b1caefc0402e4920217",
          "pages": 22,
          "mtime": 1614579069
        }
      ],
      "parents": []
    }
  ]
}
hkalexling commented 3 years ago

Hi, thank you for your interest in working on the Tachiyomi integration!

Yes I agree these are all useful features to have, but currently we do not store the MangaDex IDs of chapters and manga downloaded from MD. The queue.db contains the download queue, but after the download is completed the rows will be deleted. We could store the MD IDs for future downloads, but then the old chapters won't have the IDs and this would break the user expectations. I can't think of a user-friendly way to handle this, but any suggestions are welcome!

Nerothos commented 3 years ago

Maybe notice the user that he need to redownload said manga for it to be integrated. Or add a id field in the manga edit. Both are not great I reckon but do the job.

goldbattle commented 3 years ago

Yeah, I am not sure about how to support existing manga's / chapters downloaded, but I think for new ones download this would be a nice addition.

As Nerothos mentioned, the web interface could also show this id / chapter and I think it would be nice to have it linked directly to the mangdex (similar to how the download plugin rows gives links to the chapters so you can click and view it on mangadex).

Seems like a bit of work, so I think just having it would be stored for newly downloaded chapters / mangas would be the best solution for me (right now I am fine with re-downloading everything)

goldbattle commented 3 years ago

I created a first version of it here: https://github.com/tachiyomiorg/tachiyomi-extensions/pull/6034

Some improvements that would be make this work really nicely:

hkalexling commented 3 years ago

@Nerothos Adding an extra field for the MD ID sounds like a good idea šŸ‘ Will try to implement this.

@goldbattle Thanks for your effort on the extension! Hopefully we can close #33 with it. Regarding the improvements:

hkalexling commented 3 years ago

So to summarize, the features requested in this issue are:

Nerothos commented 3 years ago

I was wondering, @goldbattle, I'm not sure if that's feasible from source plugin on Tachiyomi but would it be possible to sync read chapter between the two? I doubt source plugin allow API call while reading though

goldbattle commented 3 years ago

Correct, this type of support is being tracked here: https://github.com/tachiyomiorg/tachiyomi/issues/4282

hkalexling commented 3 years ago

@goldbattle Congrats on getting the PR merged! I wanted to try the extension but encountered an issue, and would appreciate your help.

I was trying to configure the extension by tapping the gear icon, but this crashed the app. The same icon works without any issues for other extensions. Is this a bug or am I missing something? I am using the latest version of Tachiyomi (0.10.9).

Bmswad1 commented 3 years ago

@hkalexling He is already working on it This is what he said in a new PR "Would crash on startup if the address field is empty since it has zero length so you can't get a .last()."

hkalexling commented 3 years ago

@dmswd Ah I didn't see the new PR. Thanks for letting me know!

Bmswad1 commented 3 years ago

@hkalexling you're welcome šŸ˜Š