29c31beceb
DESIGN.md §15 as amended: a language is satisfied by exactly one sidecar, and no filename segment distinguishes forced from plain from SDH. A unique index over sidecar rows says so; embedded rows keep their own key, since several tracks for one language can legitimately coexist inside a video. Existing databases may hold a duplicate from a manual grab that beat the API's path check, so the migration resolves them rather than failing: a real subtitle beats a machine translation, and of two of the same kind the newest wins. The files stay on disk for the manual delete to clean up. `record_file` no longer swallows every conflict — only the two that mean "arr already knows this file".
27 lines
888 B
JSON
27 lines
888 B
JSON
{
|
|
"db_name": "SQLite",
|
|
"query": "INSERT INTO subtitle_files\n (media_file_id, language, origin, provider, candidate_id, engine,\n forced, sdh, synced, sync_rejected, path)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (path) DO NOTHING\n ON CONFLICT (media_file_id, language, forced, sdh)\n WHERE origin = 'embedded' DO NOTHING\n RETURNING id AS \"id!: i64\"",
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "id!: i64",
|
|
"ordinal": 0,
|
|
"type_info": "Integer",
|
|
"origin": {
|
|
"Table": {
|
|
"table": "subtitle_files",
|
|
"name": "id"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Right": 11
|
|
},
|
|
"nullable": [
|
|
null
|
|
]
|
|
},
|
|
"hash": "3d48b78768bf8dc2e337d0935889a5654089f38bb7ee2a15b7e19f4ed5540262"
|
|
}
|