modify scripts

This commit is contained in:
oscarz
2025-04-23 17:43:30 +08:00
parent f6385b83e4
commit 2e2218b623
2 changed files with 50 additions and 5 deletions

View File

@ -172,6 +172,34 @@ def insert_or_update_actor(actor):
logging.error(f"插入/更新演员 {actor['name']} 失败: {e}")
conn.rollback()
# """插入或更新电影数据(异常url的处理比如404链接)"""
def insert_or_update_actor_404(name, href, is_full_data=1):
try:
# 插入或更新电影信息
cursor.execute(
"""
INSERT INTO javdb_actors (name, href, is_full_data, updated_at)
VALUES (?, ?, ?, datetime('now', 'localtime'))
ON CONFLICT(href) DO UPDATE SET
name=excluded.name, is_full_data=excluded.is_full_data, updated_at = datetime('now', 'localtime')
""",
(name, href, is_full_data)
)
conn.commit()
# 获取插入的 movie_id
actor_id = get_id_by_href('javdb_actors', href)
if actor_id is None:
return None
return actor_id
except Exception as e:
conn.rollback()
logging.error("Error inserting movie: %s", e)
return None
# 删除演员
def delete_actor_by_href(href):
try: