| @@ -141,7 +141,6 @@ def update_tables ( | |||||
| api_data: list[VideoResult], | api_data: list[VideoResult], | ||||
| now: datetime, | now: datetime, | ||||
| ) -> None: | ) -> None: | ||||
| video_ids: list[int] = [] | |||||
| for datum in api_data: | for datum in api_data: | ||||
| tag_names: list[str] = datum['tags'].split () | tag_names: list[str] = datum['tags'].split () | ||||
| video = VideoDto (code = datum['contentId'], | video = VideoDto (code = datum['contentId'], | ||||
| @@ -150,7 +149,6 @@ def update_tables ( | |||||
| uploaded_at = datetime.fromisoformat (datum['startTime'])) | uploaded_at = datetime.fromisoformat (datum['startTime'])) | ||||
| video_dao.upsert (video, False) | video_dao.upsert (video, False) | ||||
| if video.id_ is not None: | if video.id_ is not None: | ||||
| video_ids.append (video.id_) | |||||
| video_history = VideoHistoryDto (video_id = video.id_, | video_history = VideoHistoryDto (video_id = video.id_, | ||||
| fetched_at = now, | fetched_at = now, | ||||
| views_count = datum['viewCounter']) | views_count = datum['viewCounter']) | ||||
| @@ -160,7 +158,7 @@ def update_tables ( | |||||
| for vt in video_tags: | for vt in video_tags: | ||||
| tag = tag_dao.find (vt.tag_id) | tag = tag_dao.find (vt.tag_id) | ||||
| if (tag is not None | if (tag is not None | ||||
| and (tag.name.upper () not in [tn.upper () for tn in tag_names]) | |||||
| and (tag.name.upper () not in map (str.upper, tag_names)) | |||||
| and (tag.id_ is not None)): | and (tag.id_ is not None)): | ||||
| tag_ids.append (tag.id_) | tag_ids.append (tag.id_) | ||||
| video_tag_dao.untag_all (video.id_, tag_ids, now) | video_tag_dao.untag_all (video.id_, tag_ids, now) | ||||
| @@ -535,7 +533,7 @@ class VideoTagDao: | |||||
| video_tags | video_tags | ||||
| WHERE | WHERE | ||||
| video_id = %s | video_id = %s | ||||
| AND (untagged_at IS NULL) | |||||
| AND untagged_at IS NULL | |||||
| ORDER BY | ORDER BY | ||||
| id""", (video_id,)) | id""", (video_id,)) | ||||
| print (c._executed) | print (c._executed) | ||||
| @@ -562,7 +560,8 @@ class VideoTagDao: | |||||
| video_tags | video_tags | ||||
| WHERE | WHERE | ||||
| video_id = %s | video_id = %s | ||||
| AND tag_id = %s""", (video_id, tag_id)) | |||||
| AND tag_id = %s | |||||
| AND untagged_at IS NULL""", (video_id, tag_id)) | |||||
| print (c._executed) | print (c._executed) | ||||
| row = cast (VideoTagRow, c.fetchone ()) | row = cast (VideoTagRow, c.fetchone ()) | ||||
| if row is None: | if row is None: | ||||