Commit Graph

9 Commits

Author SHA1 Message Date
Yevhen Odynets 346369ca11 srrdb: harvest the srrDB search API into a separate SQLite database
New scope reading the API instead of scraping HTML: one search path per run,
passed raw through --single-uri, and the answer stored as-is into its own
SQLite file created from the embedded schema.

Command line: --single-uri carries the path after /v1/search/
(category:flac/date:today/page:1) and must name a category; --sleep sets the
pause between pages, with the config value as fallback. A day named on the
command line is always fetched again and its dump rewritten, so cron can
refresh today hourly and yesterday daily.

Date placeholders: date:auto walks backwards to the newest day in
[srrdb.floor..yesterday] that has no dump yet, closing holes instead of
declaring the archive covered. date:today, date:yesterday and date:tomorrow
stand for the neighbouring days. Today is never taken by the walk, because a
day still being filled would be frozen by its own dump after the first run.

Dumps are the cursor as well as the record, so a missing dump directory is an
error instead of "nothing harvested yet": a renamed, unmounted or mistyped
directory must not send the run silently back to the beginning. An empty day is
a normal result and is remembered as harvested; API warnings never are, and
they reach the exit code.

Writes go through one transaction, so a day lands completely or not at all.
group and category come from the release line and the search path; status, nfo,
content and synced_at stay NULL. srrdb.log.jsonl records one line per finished
run, srrdb.error_log.jsonl keeps failures and API warnings apart by a kind
field.

Also: the console command contract returns (string, error), so a failing scope
reaches the process exit code and cron can tell a failed run from a successful
one. config/scope/srrdb.yaml is untracked because its paths differ per host.
modernc.org/sqlite replaces the archived libsql client, which only ever talked
to a server. pkg/repository/srrdb.go is split by responsibility and covered by
table-driven tests.
2026-09-30 09:27:33 +03:00
Yevhen Odynets e11c82bd76 Fixed rutracker after changing stucture of the atom file of theirs own 2026-08-31 20:24:07 +03:00
Yevhen Odynets fedb470da6 minor changes 2026-08-31 19:00:09 +03:00
Yevhen Odynets 0979bf5ad8 tuned default precene fetch 2026-01-18 01:07:51 +02:00
yevhen b26c43ee4b change git imports 2025-10-06 12:28:15 +03:00
yevhen 1544b943fc cahnge git server and fixed time parsing 2025-10-06 12:21:22 +03:00
yevhen 203f834f65 upadted to 1.24.0; fixed stb and spiddped doubles in precene 2025-03-03 09:28:41 +02:00
yevhen 0ecf0ddec1 preset scraper added 2024-09-10 15:57:48 +03:00
yevhen e587e645fc add scraping the torrent topics rss files 2024-09-09 08:54:29 +03:00