feat: 移除DB.py中的冗余字段并优化视频记录字段保留逻辑
This commit is contained in:
parent
3dcc9c39a4
commit
6d102f9e84
8
DB.py
8
DB.py
@ -759,10 +759,13 @@ class DBSA:
|
|||||||
"follow_number": data.get("fans", 0),
|
"follow_number": data.get("fans", 0),
|
||||||
"video_number": data.get("videos", 0),
|
"video_number": data.get("videos", 0),
|
||||||
"is_repeat": 3,
|
"is_repeat": 3,
|
||||||
# "is_piracy": data.get("is_piracy", 3),
|
|
||||||
"ts_status": data.get("ts_status", 1),
|
"ts_status": data.get("ts_status", 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 仅保留 sh_dm_video_v3 表中存在的字段
|
||||||
|
video_fields = {c.name for c in video.columns}
|
||||||
|
vid_row = {k: v for k, v in vid_row.items() if k in video_fields}
|
||||||
|
|
||||||
cls._buf_op.append(op_row)
|
cls._buf_op.append(op_row)
|
||||||
cls._buf_vid.append(vid_row)
|
cls._buf_vid.append(vid_row)
|
||||||
cls._buf_payload.append(data)
|
cls._buf_payload.append(data)
|
||||||
@ -854,7 +857,6 @@ class DBSA:
|
|||||||
upd = {
|
upd = {
|
||||||
"title": stmt.inserted.title,
|
"title": stmt.inserted.title,
|
||||||
"link": stmt.inserted.link,
|
"link": stmt.inserted.link,
|
||||||
# "is_piracy": stmt.inserted.is_piracy,
|
|
||||||
"edition": stmt.inserted.edition,
|
"edition": stmt.inserted.edition,
|
||||||
"duration": stmt.inserted.duration,
|
"duration": stmt.inserted.duration,
|
||||||
"watch_number": stmt.inserted.watch_number,
|
"watch_number": stmt.inserted.watch_number,
|
||||||
@ -892,4 +894,4 @@ class DBSA:
|
|||||||
if getattr(e.orig, "args", [None])[0] == 1213 and attempt < 2:
|
if getattr(e.orig, "args", [None])[0] == 1213 and attempt < 2:
|
||||||
time.sleep(0.5 * (attempt + 1))
|
time.sleep(0.5 * (attempt + 1))
|
||||||
continue
|
continue
|
||||||
raise
|
raise
|
Loading…
x
Reference in New Issue
Block a user