stash/pkg
SmallCoccinelle 09c4c4173d
Support a minModTime input on metadata scans. (#1951)
* Support a maxAge input on metadata scans.

Extend the GraphQL world with a Duration scalar. It is parsed as a
typical Go duration, i.e., "4h" is 4 hours. Alternatively, one can
pass an integer which is interpreted as seconds.

Extend Mutation.metadataScan(input: $input) to support a new optional
value, maxAge. If set, the scanner will exit early if the file it
is looking at has an mtime older than the cutOff point generated by

now() - maxAge

This speeds up scanning in the case where the user knows how old the
changes on disk are, by exiting the scan early if that is the case.

* Change maxAge into minModTime

Introduce a `Timestamp` scalar, so we have a scalar we control. Let
it accept three formats:

* RFC3339Nano
* @UNIX where UNIX is a unix-timestamp: seconds after 01-01-1970
* '<4h': a timestamp relative to the current server time

This scalar parses to a time.Time.

Use MinModTime in the scanner to filter out a large number of scan
analyzes by exiting the scan operation early.

* Heed the linter, perform errcheck

* Rename test vars for consistency.

* Code review: move minModTime into queuefiles

* Remove the ability to input Unix timestamps

Test failures on the CI-system explains why this is undesirable. It is
not clear what timezone one is operating in when entering a unix
timestamp. We could go with UTC, but it is so much easier to require an
RFC3339 timestamp, which avoids this problem entirely.

* Move the minModTime field into filters

Create a new filter input object for metadata scans, and push the
minModTime field in there. If we come up with new filters, they can
be added to that input object rather than cluttering the main input
object.

* Use utils.ParseDateStringAsTime

Replace time.Parse with utils.ParseDateStringAsTime

While here, add some more test cases for that parser.
2021-11-26 11:48:31 +11:00
..
api Scraper refactor middle (#2043) 2021-11-26 11:20:06 +11:00
autotag Prefer studio name later in filename (#2057) 2021-11-26 08:29:25 +11:00
database Enable gocritic (#1848) 2021-10-18 14:12:40 +11:00
dlna Show duration and filesize in results (#1776) 2021-10-25 11:40:13 +11:00
ffmpeg Varied macOS fixes (#2044) 2021-11-22 12:44:24 +11:00
file File size scanning fixes (#1944) 2021-11-04 10:50:03 +11:00
gallery File size scanning fixes (#1944) 2021-11-04 10:50:03 +11:00
identify Refactor scraper top half (#1893) 2021-11-19 10:55:34 +11:00
image Show duration and filesize in results (#1776) 2021-10-25 11:40:13 +11:00
job Enable gocritic (#1848) 2021-10-18 14:12:40 +11:00
logger Fixups + enable the commentFormatting linter (#1866) 2021-10-20 16:10:46 +11:00
manager Support a minModTime input on metadata scans. (#1951) 2021-11-26 11:48:31 +11:00
match Prefer studio name later in filename (#2057) 2021-11-26 08:29:25 +11:00
models Support a minModTime input on metadata scans. (#1951) 2021-11-26 11:48:31 +11:00
movie Enable gocritic (#1848) 2021-10-18 14:12:40 +11:00
performer Add stash_ids to performer, scene, studio import/export (#1916) 2021-10-29 11:12:39 +11:00
plugin Add a TagMergePost post-hook (#2010) 2021-11-19 11:12:34 +11:00
scene Add stash_ids to performer, scene, studio import/export (#1916) 2021-10-29 11:12:39 +11:00
scraper Scraper refactor middle (#2043) 2021-11-26 11:20:06 +11:00
session Fix parsing ipv6 address with scope id (#1841) 2021-10-20 16:52:15 +11:00
sqlite Add search string parsing (#1982) 2021-11-22 14:59:22 +11:00
static Replace packr with go embed (#1751) 2021-09-22 13:08:34 +10:00
studio Add stash_ids to performer, scene, studio import/export (#1916) 2021-10-29 11:12:39 +11:00
tag Fix tag hierarchy validation (#1926) 2021-11-07 09:33:46 +11:00
utils Identify task (#1839) 2021-10-28 14:25:17 +11:00