gotson / komga

Media server for comics/mangas/BDs/magazines/eBooks with API, OPDS and Kobo Sync support
https://komga.org
MIT License
3.89k stars 232 forks source link

[Feature Request] Add ability to limit series APIs by libraryId #360

Closed Kussie closed 3 years ago

Kussie commented 3 years ago

I have kind of an odd use case here so it may not be feasible. But I would love to see the ability to limit the latest, new and updated series and book endpoints in the rest API to be optionally limited to a specific library id.

So I could do something like /api/v1/series/added?library_id=“libraryIdHere”

At the moment i go through each page of the API until a have enough entries per library myself but this is a pretty big overhead, especially considering the books and series in the DB have libraryId as a key already and the top level /books and /series endpoints also support the library_id parameter

gotson commented 3 years ago

You should be able to get the same results from the /series endpoint, and using the sort parameter.

Kussie commented 3 years ago

That’s true, I had that thought after posting this. I’ll have a look into that more deeply tomorrow and see if I can pull it off using the sort parameters. The advantage of the latest and added endpoints makes it really easy to seperate newly added series from modified ones.

My use case is a bit unique as I mentioned basically I use a combination of YACReader/YACServer and komga for my collection. Basically I use komga when online and YACReader when offline (As I wasn’t a huge fan of the exisiting iOS clients) and YACReader lets me download my comics when I am expecting to go offline and then sync that progress back to YACServer. I have written a CLI script that syncs my reading progress between komga and YACServer (Along with tags/collections). But YACReader lacks a lot of the niceness of komga so to make it easier to read offline I am replicating the Recently Added and Recently Modified sections of komga inside YACReader as reading lists so I can more quickly download the comics I want for offline reading and because it completely lacks that ability to sort or show anything other then the first letter of the title.

gotson commented 3 years ago

It will work for latest and new, but not for updated, as updated is excluding the new ones (as they would have the same added and updated time)

gotson commented 3 years ago

I checked the code, it should be fairly easy to add a library ID param to those endpoints, the underlying search already supports it, so it's a matter of exposing it and wiring it.

Let me know if you can get away with the above proposed solution, if not I'll consider adding it.

Kussie commented 3 years ago

If you could consider adding it that would be awesome

gotson commented 3 years ago

Check with the sort first?

Kussie commented 3 years ago

I got something pretty close to it by using the sort parameter. Enough that it's workable for me anyway.

So happy to close this, unless you plan/want to make some of the API parameters consistent across the other endpoints

gotson commented 3 years ago

I'll probably do them but not with all parameters, maybe just library id, as the updated one cannot be replicated by sort

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 0.65.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: