mikespub-org / seblucas-cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
55 stars 7 forks source link

Idea: Sort option for series index #44

Closed dunxd closed 9 months ago

dunxd commented 9 months ago

The default sort for a page listing a series is the series index. However, if the sort order is changed, it isn't easy to get back to this. Currently it.sortoptions doesn't include this as an option. It would be nice to have this as a sort option on the series page (page==7).

It would not make sense on other pages.

mikespub commented 9 months ago

Yes, I can see that. Before I hack something together, can you think of any other edge cases where we might want to customize the sort options?

Otherwise we might just use some default "back to original sort order" (meaning reset the sort= to blank) in the sort options that you can use in templates if you want to...

dunxd commented 9 months ago

The other thing that crossed my mind was being able to toggle the sort order (i.e. asc or desc) for each option. Maybe the code allows that already (I think I saw "desc" mentioned somewhere in the it object.

I don't feel any urgency about this though.

mikespub commented 9 months ago

Yes, there is support for changing the sort order in code. Most of the sort fields are ascending by default, except timestamp which is descending to get the Recent Books. You can override the sort order simply by adding +asc or +desc to the sort field in the URL (or %20 - either way, it's a space in PHP).

But when I started thinking about adding all that to the templates, I found this was going a bit too far. What next, make all sort options configurable, add more customizable filters, make the database fields editable, update all books, ...? That's what Calibre itself is for after all :-)

dunxd commented 9 months ago

I agree with seblucas' statement in README.md:

COPS' goal is to provide an alternative to Calibre's content server and not to replace Calibre entirely.

That principle should remain the guide to adding new features. From my point of view, COPS is pretty close to feature complete, with great capacity to add functionality through templates.

mikespub commented 9 months ago

Indeed, although the content server has evolved over the years too, so I may have a peak there to see if anything interesting pops up...

The only other features I'm working on is getting COPS to generate OPDS 2.0 feeds for the future, and having epub-loader available as a loosely coupled option - but they're both still in dev mode only for the moment.

dunxd commented 9 months ago

Testing the sort order - it works as you described for timestamp, title and pubdate.

It doesn't work for author or rating. Author I get, because there may be multiple authors, so what to do in that case? Rating I suspect is due to most books not having any rating in my Calibre library.