修复了一个分发提取过程中的问题
This commit is contained in:
parent
90397ee4db
commit
26086e2a1d
@ -450,9 +450,9 @@ def send_emails(distribution_csv, output_dir, email_from, email_password,
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
article_content = f.read()
|
||||
product_name = row.get('product', '')
|
||||
object_name = row.get('object', '')
|
||||
article_contents.append(f"【{product_name} - {object_name}】\n\n{article_content}\n\n{'='*50}\n\n")
|
||||
# product_name = row.get('product', '')
|
||||
# object_name = row.get('object', '')
|
||||
article_contents.append(f"\n\n{article_content}\n\n{'='*50}\n\n")
|
||||
except Exception as e:
|
||||
logger.warning(f"读取文章内容失败: {file_path}, 错误: {e}")
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ def init_database(db_path):
|
||||
"""初始化数据库,创建表结构"""
|
||||
try:
|
||||
conn = sqlite3.connect(db_path)
|
||||
conn.execute("PRAGMA foreign_keys = ON")
|
||||
conn.execute("PRAGMA foreign_keys = OFF") # 禁用外键约束
|
||||
cursor = conn.cursor()
|
||||
|
||||
# 创建内容表
|
||||
@ -80,7 +80,7 @@ def record_to_database(
|
||||
else:
|
||||
try:
|
||||
conn = sqlite3.connect(db_path)
|
||||
conn.execute("PRAGMA foreign_keys = ON")
|
||||
conn.execute("PRAGMA foreign_keys = OFF") # 禁用外键约束
|
||||
except sqlite3.Error as e:
|
||||
logger.error(f"连接数据库失败: {e}")
|
||||
return False
|
||||
@ -535,8 +535,8 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
# 默认值设置
|
||||
source = args.source if args.source else "/root/autodl-tmp/TravelContentCreator/result/2025-05-12_21-36-33"
|
||||
output = args.output if args.output else "/root/autodl-tmp/TravelContentCreator/output/2025-05-12_21-36-33"
|
||||
source = args.source if args.source else "/root/autodl-tmp/TravelContentCreator/result/2025-05-14_22-10-37"
|
||||
output = args.output if args.output else "/root/autodl-tmp/TravelContentCreator/output/2025-05-14_22-10-37"
|
||||
run_id = args.run_id if args.run_id else os.path.basename(source)
|
||||
prefer_original = args.prefer_original
|
||||
db_path = args.db_path if args.db_path else '/root/autodl-tmp/TravelContentCreator/distribution.db'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user