Skip to content

Latest commit

 

History

832 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | 简体中文

CAUTION: This program is related to VOCALOID CHINA, so the most of the documentations are written in Chinese. Sorry for inconvenience.

tdd-spider

Data acquisition program of TianDian Daily (https://tdd.bunnyxt.com) based on Python. Feel free to contact us via QQ group: 537793686!

Introduction

TianDian Daily is a personal project by bunnyxt designed to elevate the exchange of Vocaloid China-related data. Our goal is to offer comprehensive, easily accessible data and intuitive visualizations for all enthusiasts interested in Vocaloid China statistics.

The project is composed of three distinct components, all interconnected with a central database. These are:

  • frontend: data presentation and interaction (tdd-frontend)
  • backend: data access api (tdd-backend)
  • spider: original data collection(tdd-spider)

See the structure below.

TianDian Daily structure

Collector runtime

The PostgreSQL collector uses Python 3.12 and parameterized SQL.

Setup

  1. Clone the repository and enter its directory.
  2. Create a virtual environment with python3.12 -m venv .venv, then install the locked dependencies with .venv/bin/python -m pip install -r requirements.txt.
  3. Copy conf/conf.ini.example to conf/conf.ini and configure [db_postgresql]. Copy service/endpoints.json.example to service/endpoints.json and configure your HTTP workers.
  4. Install compatible business tables, partitions and maintenance triggers outside this repository, and grant the collector its business-table and identity-sequence permissions. The application does not create these objects. See setup.
  5. Prepare a restricted failure-file directory. Failed writes trigger a best-effort save of their input. Uncertain commits require manual database reconciliation; any resubmission is also manual, with no automatic replay or resubmission command. Never replay an earlier trial's failure files into a new baseline. See failed writes.

Upgrading an existing PostgreSQL deployment

See runtime upgrade notes before removing an old trial configuration. Normal operation no longer requires migration control tables, trial manifests or a trial UUID.

Run records

Some scripts persist one structured row per run into a SQLite store (runrecord/, data/run-records.sqlite3). Besides the CLI (python -m runrecord, with overview and trend sub-commands), a read-only web page gives an at-a-glance view:

  • / — a per-script overview: one row per script with its latest run's status, duration and a few key metrics, plus a health banner.
  • /script/<name> — one script's recent runs aligned into a per-run metric time series, with simple SVG line charts (key metrics + a built-in duration series; pick other metrics with the checkbox form). A missing run is a gap, never a zero; the charts show magnitude only and imply nothing about good or bad.
  • /runs — the recent-runs stream, filterable by script, status and time.
  • /run/<id> — one run in full: core fields, metrics grouped by scope, log paths.

Every page also serves ?format=json.

It listens on 127.0.0.1 only, never writes, and has no auth. Start it in the foreground on the host that holds the database, and reach it from a workstation over an SSH tunnel (Ctrl-C on the server stops it):

# on the server
python3 -m runrecord.web \
  --host 127.0.0.1 \
  --port 8765 \
  --db data/run-records.sqlite3

# on the workstation
ssh -N -L 8765:127.0.0.1:8765 <server>
# open http://127.0.0.1:8765/

Or as a single command from the workstation:

ssh -t \
  -o ServerAliveInterval=30 \
  -o ServerAliveCountMax=3 \
  -L 8765:127.0.0.1:8765 <server> \
  'cd <project-directory> && exec python3 -m runrecord.web --host 127.0.0.1 --port 8765 --db data/run-records.sqlite3'

The PTY makes the foreground server follow the SSH session lifecycle, while the keepalive options detect a dead connection instead of leaving it unnoticed.

Snapshots

runrecord.maintain holds the snapshot command; the CLI and web page above stay read-only.

# consistent gzipped snapshot + .sha256 into data/runrecord/
python3 -m runrecord.maintain backup

backup uses SQLite's online backup API rather than copying the live file, and checks the copy with PRAGMA integrity_check before publishing it. Snapshots accumulate until they are pulled off the host. The live run-record database has no automatic age-based deletion. To restore a snapshot, verify and unpack it, then point the CLI at the result before replacing anything:

sha256sum -c run-records_<stamp>.sqlite3.gz.sha256   # macOS: shasum -a 256 -c
gunzip -c run-records_<stamp>.sqlite3.gz > restored.sqlite3
python3 -m runrecord --db restored.sqlite3 overview

Used by

Contributors

Languages