modify scripts
This commit is contained in:
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user