fff
This commit is contained in:
@@ -1011,11 +1011,28 @@ class VideoRepository:
|
||||
)
|
||||
return cursor.rowcount > 0
|
||||
|
||||
def clear_sentence_translations(self, video_hash: str) -> None:
|
||||
def clear_sentence_translations(
|
||||
self,
|
||||
video_hash: str,
|
||||
indexes: Optional[Sequence[int]] = None,
|
||||
) -> None:
|
||||
normalized_hash = normalize_video_hash(video_hash)
|
||||
with self._connect() as connection:
|
||||
connection.execute(
|
||||
"UPDATE sentences SET zh_text = NULL WHERE video_hash = ?",
|
||||
(normalize_video_hash(video_hash),),
|
||||
if indexes is None:
|
||||
connection.execute(
|
||||
"UPDATE sentences SET zh_text = NULL WHERE video_hash = ?",
|
||||
(normalized_hash,),
|
||||
)
|
||||
return
|
||||
unique_indexes = list(dict.fromkeys(indexes))
|
||||
if not unique_indexes:
|
||||
return
|
||||
connection.executemany(
|
||||
"""
|
||||
UPDATE sentences SET zh_text = NULL
|
||||
WHERE video_hash = ? AND sentence_index = ?
|
||||
""",
|
||||
[(normalized_hash, index) for index in unique_indexes],
|
||||
)
|
||||
|
||||
def save_sentence_translations(
|
||||
|
||||
Reference in New Issue
Block a user