title modification
This commit is contained in:
@@ -349,6 +349,22 @@ class VideoRepository:
|
||||
(remote_url, utc_now(), normalize_video_hash(video_hash)),
|
||||
)
|
||||
|
||||
def update_title(self, video_hash: str, title: str) -> Optional[Dict[str, Any]]:
|
||||
normalized_hash = normalize_video_hash(video_hash)
|
||||
cleaned_title = title.strip()[:200]
|
||||
if not cleaned_title:
|
||||
raise ValueError("Title cannot be empty.")
|
||||
|
||||
with self._connect() as connection:
|
||||
cursor = connection.execute(
|
||||
"UPDATE videos SET title = ?, updated_at = ? WHERE video_hash = ?",
|
||||
(cleaned_title, utc_now(), normalized_hash),
|
||||
)
|
||||
if cursor.rowcount == 0:
|
||||
return None
|
||||
|
||||
return self.get_video(normalized_hash)
|
||||
|
||||
def list_videos(self) -> List[Dict[str, Any]]:
|
||||
with self._connect() as connection:
|
||||
rows = connection.execute(
|
||||
|
||||
Reference in New Issue
Block a user