c3bd009442
Recording a subtitle is idempotent on both keys the schema carries: the sidecar path, and the language an embedded track satisfies, so a second probe or a re-import converges instead of duplicating. Attempts are upserted per (media file, language); the work list is every language that is not satisfied, newest import first, which is the order §15 wants the daily allowance spent in.
99 lines
2.6 KiB
JSON
99 lines
2.6 KiB
JSON
{
|
|
"db_name": "SQLite",
|
|
"query": "SELECT a.media_file_id AS \"media_file_id!: i64\",\n a.language AS \"language!: String\",\n a.state AS \"state!: SubtitleState\",\n a.attempts AS \"attempts!: i64\",\n a.last_attempt_at,\n a.last_failure,\n f.path AS \"media_file_path!: String\"\n FROM subtitle_attempts a\n JOIN media_files f ON f.id = a.media_file_id\n WHERE a.state IN ('wanted', 'failed')\n ORDER BY f.created_at DESC, a.last_attempt_at, a.language\n LIMIT ?",
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "media_file_id!: i64",
|
|
"ordinal": 0,
|
|
"type_info": "Integer",
|
|
"origin": {
|
|
"Table": {
|
|
"table": "subtitle_attempts",
|
|
"name": "media_file_id"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "language!: String",
|
|
"ordinal": 1,
|
|
"type_info": "Text",
|
|
"origin": {
|
|
"Table": {
|
|
"table": "subtitle_attempts",
|
|
"name": "language"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "state!: SubtitleState",
|
|
"ordinal": 2,
|
|
"type_info": "Text",
|
|
"origin": {
|
|
"Table": {
|
|
"table": "subtitle_attempts",
|
|
"name": "state"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "attempts!: i64",
|
|
"ordinal": 3,
|
|
"type_info": "Integer",
|
|
"origin": {
|
|
"Table": {
|
|
"table": "subtitle_attempts",
|
|
"name": "attempts"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "last_attempt_at",
|
|
"ordinal": 4,
|
|
"type_info": "Text",
|
|
"origin": {
|
|
"Table": {
|
|
"table": "subtitle_attempts",
|
|
"name": "last_attempt_at"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "last_failure",
|
|
"ordinal": 5,
|
|
"type_info": "Text",
|
|
"origin": {
|
|
"Table": {
|
|
"table": "subtitle_attempts",
|
|
"name": "last_failure"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "media_file_path!: String",
|
|
"ordinal": 6,
|
|
"type_info": "Text",
|
|
"origin": {
|
|
"Table": {
|
|
"table": "media_files",
|
|
"name": "path"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Right": 1
|
|
},
|
|
"nullable": [
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
true,
|
|
false
|
|
]
|
|
},
|
|
"hash": "47ad9162ba373dfbdf061898f5f148e65de261b494453804db912a919a78c2c5"
|
|
}
|