stash/pkg/models
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
..
mocks Resolve performer/studio stashIDs for scraped scenes (#2006) 2021-11-15 07:51:52 +11:00
errors.go Refactor scraper top half (#1893) 2021-11-19 10:55:34 +11:00
extension_find_filter.go Refactor clean task (#1805) 2021-10-11 16:45:24 +11:00
extension_resolution.go [Feature] Better resolution search (#1568) 2021-08-02 13:22:39 +10:00
gallery.go Add scene/image/gallery popover count buttons for performer/studio/tag cards (#1293) 2021-04-15 10:46:31 +10:00
image.go Convert filesize to float64 for arm32 (#1895) 2021-10-27 11:55:11 +11:00
json_time.go Prevent invalid date tag in video file from aborting scan (#836) 2020-10-11 12:02:41 +11:00
model_file.go Enable gocritic (#1848) 2021-10-18 14:12:40 +11:00
model_gallery.go Scan refactor (#1816) 2021-10-15 10:39:48 +11:00
model_image.go Scan refactor (#1816) 2021-10-15 10:39:48 +11:00
model_joins.go Identify task (#1839) 2021-10-28 14:25:17 +11:00
model_movie.go Data layer restructuring (#997) 2021-01-18 12:23:20 +11:00
model_performer.go Added rating to performers and studios (#1308) 2021-04-26 13:48:32 +10:00
model_saved_filter.go Saved filters (#1474) 2021-06-16 14:53:32 +10:00
model_scene.go Identify task (#1839) 2021-10-28 14:25:17 +11:00
model_scene_marker.go Data layer restructuring (#997) 2021-01-18 12:23:20 +11:00
model_scene_test.go Identify task (#1839) 2021-10-28 14:25:17 +11:00
model_scraped_item.go Unify scrape refactor (#1630) 2021-09-07 11:54:22 +10:00
model_studio.go Added rating to performers and studios (#1308) 2021-04-26 13:48:32 +10:00
model_tag.go Fix tag hierarchy validation (#1926) 2021-11-07 09:33:46 +11:00
movie.go Add movie count to performer and studio card (#1760) 2021-09-27 11:31:49 +10:00
performer.go Resolve performer/studio stashIDs for scraped scenes (#2006) 2021-11-15 07:51:52 +11:00
query.go Show duration and filesize in results (#1776) 2021-10-25 11:40:13 +11:00
repository.go Saved filters (#1474) 2021-06-16 14:53:32 +10:00
saved_filter.go Saved filters (#1474) 2021-06-16 14:53:32 +10:00
scene.go Convert filesize to float64 for arm32 (#1895) 2021-10-27 11:55:11 +11:00
scene_marker.go Data layer restructuring (#997) 2021-01-18 12:23:20 +11:00
scraped.go Identify task (#1839) 2021-10-28 14:25:17 +11:00
search.go Add search string parsing (#1982) 2021-11-22 14:59:22 +11:00
search_test.go Add search string parsing (#1982) 2021-11-22 14:59:22 +11:00
sql.go Identify task (#1839) 2021-10-28 14:25:17 +11:00
sqlite_date.go Validate SQLiteDate (#2052) 2021-11-23 08:18:43 +11:00
sqlite_date_test.go Validate SQLiteDate (#2052) 2021-11-23 08:18:43 +11:00
sqlite_timestamp.go Handle zip file modification (#877) 2020-11-05 10:26:51 +11:00
stash_box.go Identify task (#1839) 2021-10-28 14:25:17 +11:00
stash_ids.go Data layer restructuring (#997) 2021-01-18 12:23:20 +11:00
studio.go Resolve performer/studio stashIDs for scraped scenes (#2006) 2021-11-15 07:51:52 +11:00
tag.go Fix tag hierarchy validation (#1926) 2021-11-07 09:33:46 +11:00
timestamp.go Support a minModTime input on metadata scans. (#1951) 2021-11-26 11:48:31 +11:00
timestamp_test.go Support a minModTime input on metadata scans. (#1951) 2021-11-26 11:48:31 +11:00
transaction.go Enable gocritic (#1848) 2021-10-18 14:12:40 +11:00