shish / shimmie2

An easy-to-install community image gallery (aka booru)
http://code.shishnet.org/shimmie2/
GNU General Public License v2.0
404 stars 112 forks source link

Search videos by duration #777

Open shish opened 3 years ago

shish commented 3 years ago

"Ability to exclude videos from search that have above/below a certain duration, and/or to sort search results by duration. I guess we'd treat non-videos as having duration 0?"

(I thought we had this, but I can't find the code for it, maybe I imagined it...)

sanmadjack commented 3 years ago

I've almost got an implementation ready for this. It's using the same format that we display lengths with, so you'd search length>10s or length<1d21h.

The only issue I'm seeing is that if someone searches for an exact length that isn't down to the millisecond it won't likely find anything. Since we store the length to the millisecond, an equal match wouldn't work for anything more precise than what is being searched for.

A solution would be to always search for a range, determine that max/min milliseconds for the smallest specified unit of time, and go from that, but do we carry that beyond the millisecond? Does searching length=1h mean you get results from 1h0m to 1h59m?

Additionally, it's really easy to search for a value larger than the database can handle since we're using a 32-bit column for the length. I don't know that this needs addressed since you're not likely to find a file in the wild that long.