Document WCX processing scripts

This commit is contained in:
2026-07-17 17:52:53 +02:00
parent 402a859a0b
commit 0d56cfe523
4 changed files with 555 additions and 0 deletions

View File

@ -1,5 +1,36 @@
#!/usr/bin/env python3
"""
Import WCX site metadata into the local SQLite movie index.
The script reads the JSON snapshot produced by the WCX site scraper and
synchronizes it with the movie table in the local SQLite database.
Import rules:
- A movie whose ID does not exist in the database is inserted.
- An existing movie is updated only when the site provides an update date
and that date is newer than the value currently stored in the database.
- If the database has no update date but the site does, the movie is updated.
- Movies without a newer site update date are left unchanged.
When an existing movie is updated, all fields owned by the site are replaced:
name, duration, web URL, thumbnail URL, publication date, and update date.
Manually maintained metadata fields are not modified.
Durations from the site are accepted as mm:ss or hh:mm:ss and stored as
seconds in the duration_seconds column.
Input:
/storage/disk1/WCX/import/wcx_site_index.json
Database:
/storage/disk1/WCX/database/wcx.db
The script prints a summary showing the number of inserted, updated, and
unchanged records.
"""
import json
import sqlite3
from pathlib import Path