_scan.py and update-danbooru-series.py were untracked at the repository root and
absent from the other repository, so a cleanup that deleted them would have lost
them outright. Both compute REPO as their directory's parent, and
update-danbooru-series.py reads CACHE from REPO/scripts/, so scripts/ is the
layout they were written for -- moving them there restores it rather than
imposing something new.
They still do not run from here: their outputs go to apps/playground/public/,
which belongs to a third monorepo, and _scan.py reads a /mnt/e WSL path. Being
tracked is the point; being runnable is a separate job. _scan.py supersedes
update-danbooru-series.py -- same functions plus five more.
_char_prep.py and _char_merge.py move to danbooru-tag-index. They read
character_names.json and write character_official.json, neither of which is here
any more. I had written them off as superseded by translate_prep/translate_merge
and nearly deleted them on that basis; they are not. Those translate …
fix(sync): let the post sync finish, and land the pages still in flight
update_danbooru never returned. Once caught up it polled every two seconds for
new uploads, forever. Run by hand that reads as a feature; in the weekly chain
it is a hang -- the scheduled task would sit there until its six-hour limit
killed it, and the index rebuild that follows would never start. The one
end-to-end run that passed used -SkipSync, so nothing exercised it.
Catching up now exits. --follow restores the old behaviour for interactive use.
That change alone would have synced nothing. latest_id starts at 1 and was
filled by a background thread, so the producer raced it: current_id is around
11.9M, which is >= 1, so the loop would break before the first fetch returned.
The polling loop used to paper over this by sleeping and retrying. Non-follow
mode now fetches the site maximum synchronously and works against that fixed
snapshot, which also makes a run reproducible; the refresh thread only starts
under --follow, where it is actually needed.
drain() replaces the abrupt retu…
refactor: hand the tag index to danbooru-tag-index
This repository archives Danbooru into SQLite. The popularity index built on
top of that archive -- fact tables, name maps, binary bundle, web client -- now
lives in danbooru-tag-index, which opens this database read-only.
Every deleted file is on origin/master over there, verified by rev-parse before
removal rather than by looking at the local disk. Two of them had drifted, and
in both cases this copy was the stale one: build_name_map.py here predates
normalize_chinese, so it still emits the Dark Souls mistranslation. Keeping a
stale duplicate of a script nobody runs is worse than keeping none, which is
what settled the question of where the name mapping belongs.
Dropped duckdb, pyarrow and opencc: nothing left imports them. What remains is
fetching from an API and writing to SQLite -- no columnar storage, no Han
script conversion. INDEX_DIR and TAG_INDEX_STAGING_PATH went the same way.
The README loses 198 lines to the other repo. The death_note example was copied
across first -- …
feat(api): share one rate limiter, and stop dropping pages in silence
Both sync scripts had their own retry loop, each broken differently.
update_danbooru retried a failed page three times, then `break` -- no message,
no exit code, no record. Those 200 posts were simply never archived, and since
incremental mode restarts from the database max id, nothing ever goes back for
them. A hole in an archive is invisible in the finished dataset; it only turns
up years later when someone queries a range and gets less than they should.
Failures are now collected, printed, and force a non-zero exit.
Neither honoured Retry-After, and both throttled per thread. The quota is per
account, so sixteen independently-limited workers overshoot sixteenfold; the
producer's sleep(0.1) then pinned the total at 10 req/s, exactly Danbooru's
documented ceiling, so any jitter tripped a 429. The shared limiter starts at
5 req/s, halves on a 429 and pauses *every* worker -- punishing only the thread
that happened to lose leaves the other fifteen to exhaust the quota again, so
the ag…
feat(sync): read Danbooru credentials from the environment
DANBOORU_API_KEY / DANBOORU_LOGIN, with --api_key / --login still winning. The
weekly scheduled refresh needs credentials without putting them on a command
line, where they would be visible in the task definition, the process list and
shell history.
Also rejects a half-pair up front. Supplying one built a request with
`api_key=None` in the query string and got a 401 several seconds into the run,
which reads as a network problem rather than a configuration one.
Claude-Session: https://claude.ai/code/session_01Y7zhT65juXoYRt6EcDyL76
feat(translations): add multilingual name mapping pipeline
Map each artist/copyright/character tag to one canonical name per
language (en/ja/ko/zh_hans/zh_hant), sourced from wiki/artist
other_names.
export_tag_translations buckets aliases by script (kana->ja, hangul->ko,
latin->en) and falls back to OpenCC glyph detection for Han strings
(simplified->zh_hans, shinjitai->ja, else zh_hant). build_name_map picks
one name per language and uses OpenCC to fill missing CJK forms from any
Han name, since a Japanese kanji name doubles as a usable Chinese name.
Ambiguous tags (a bucket with several aliases) need an official name
chosen over abbreviations, nicknames, ship and event names; that judgment
is delegated to a cheap haiku batch run. _char_prep splits the ambiguous
characters into per-batch input files; _char_merge validates the batch
outputs and merges them into character_official.json.
Artist aliases live in the /artists.json endpoint, not in
wiki_pages.other_names, so archiving them needs a dedicated table and
endpoint. --only re-syncs a single endpoint (e.g. --only artists) without
rerunning the full five-endpoint sweep.
Remove the dataset pipeline (make_ds), image downloaders, quality and
debias statistics, parquet/webp converters, stale tag-group scripts,
and the now-unused danbooru/ and utils/ packages. Drop pyarrow and
declare requires-python >= 3.12.
BREAKING CHANGE: removed scripts remain available in history at 62a4c39.
feat(tags): rewrite tag_frequency to read SQLite and export per-category CSVs
Danbooru returns 403 for the default python-requests User-Agent and
401 when api_key=None is interpolated into the query string, so send
a descriptive UA and append auth params only when credentials are set.
feat(scripts): add dataset and statistic processing scripts && restructure project with modular utilities