modify scripts

This commit is contained in:
oscarz
2025-03-30 10:08:03 +08:00
parent 7717ad1f60
commit 6ab14b0771
2 changed files with 30 additions and 2 deletions

View File

@ -428,6 +428,34 @@ def insert_or_update_movie(movie):
logging.error("Error inserting movie: %s", e)
return None
# """插入或更新电影数据(异常url的处理比如404链接)"""
def insert_or_update_movie_404(title, href):
try:
# 插入或更新电影信息
cursor.execute(
"""
INSERT INTO javdb_movies (title, href, is_full_data, updated_at)
VALUES (?, ?, 1, datetime('now', 'localtime'))
ON CONFLICT(href) DO UPDATE SET
title=excluded.title, is_full_data=1, updated_at = datetime('now', 'localtime')
""",
(title, href)
)
conn.commit()
# 获取插入的 movie_id
movie_id = get_id_by_href('javdb_movies', href)
if movie_id is None:
return None
return movie_id
except Exception as e:
conn.rollback()
logging.error("Error inserting movie: %s", e)
return None
# 删除电影数据"""
def delete_movie(identifier):
try: