imtbl / hyve

Expose and consume your hydrus media via HTTP API
GNU Affero General Public License v3.0
31 stars 3 forks source link

Feature Request - Sort by date #26

Open Lopunny1 opened 4 years ago

Lopunny1 commented 4 years ago

Hi, I was wondering if it were possible to be able to sort by date? A lot of my files ID's aren't in order of oldest to newest, so I wanted to know if there was a way of sorting by the files modified date so it looks more like proper online booru's.

Also the random sort retains its order, even once other filters have been applied and you can't change the random order unless the server is restart. Is it possible to reshuffled the random order whilst in the web browser? Maybe even allow someone to manually change the seed?

imtbl commented 4 years ago

Hey,

I was wondering if it were possible to be able to sort by date?

It would certainly be possible to add. Though iirc, hydrus server doesn't store any date, so this would only be useful when pulling the data from hydrus client (and I'm generally somewhat averse to implementing features that don't work with both client and server).

Also the random sort retains its order, even once other filters have been applied and you can't change the random order unless the server is restart.

SQLite doesn't support seeding the random() function; that means it's unusable in combination with paginated results. So instead, whenever a sync runs, we insert a random integer into the random column of the files table and use that for "random" sorting. Updating that on demand would be potentially very slow (depending on the number of files) and would also cause complications with multi-user instances (as the instance would effectively be unusable during this update). So overall, that's not a feature I'd like to see added.


I am not too opposed to the first idea (sorting by date), though I also no longer add new features to hyve; it's basically in a maintenance-only state. I'll leave this open and label it with help wanted in case someone else wants to tackle it.