Closed dunxd closed 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...
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.
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 :-)
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.
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.
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.
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.