modify scripts
This commit is contained in:
@ -264,7 +264,9 @@ def fetch_performers_detail_once(perfomers_list):
|
|||||||
if data:
|
if data:
|
||||||
# 检查影片数量是否有更新
|
# 检查影片数量是否有更新
|
||||||
page_movies_cnt = int(data.get('movies_cnt', '0'))
|
page_movies_cnt = int(data.get('movies_cnt', '0'))
|
||||||
|
movies_changed = True
|
||||||
if page_movies_cnt <= movies_cnt:
|
if page_movies_cnt <= movies_cnt:
|
||||||
|
movies_changed = False
|
||||||
if not force:
|
if not force:
|
||||||
logging.info(f"actor already update. skipping... person: ({person}), url: {url}")
|
logging.info(f"actor already update. skipping... person: ({person}), url: {url}")
|
||||||
last_performer_id = curr_id
|
last_performer_id = curr_id
|
||||||
@ -274,7 +276,9 @@ def fetch_performers_detail_once(perfomers_list):
|
|||||||
'href': url,
|
'href': url,
|
||||||
'person': person,
|
'person': person,
|
||||||
**data
|
**data
|
||||||
})
|
},
|
||||||
|
movies_update=movies_changed
|
||||||
|
)
|
||||||
if performer_id:
|
if performer_id:
|
||||||
logging.debug(f'insert one person, id: {performer_id}, person: ({person}), url: {url}')
|
logging.debug(f'insert one person, id: {performer_id}, person: ({person}), url: {url}')
|
||||||
last_performer_id = performer_id
|
last_performer_id = performer_id
|
||||||
|
|||||||
@ -172,7 +172,7 @@ def insert_movie_appears_in(movie_id, appears_in_id, gradation=0, notes=''):
|
|||||||
|
|
||||||
|
|
||||||
# 插入演员信息
|
# 插入演员信息
|
||||||
def insert_or_update_performer(data):
|
def insert_or_update_performer(data, movies_update=True):
|
||||||
try:
|
try:
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
INSERT INTO iafd_performers (href, name, gender, birthday, astrology, birthplace, years_active, ethnicity, nationality, hair_colors,
|
INSERT INTO iafd_performers (href, name, gender, birthday, astrology, birthplace, years_active, ethnicity, nationality, hair_colors,
|
||||||
@ -225,6 +225,7 @@ def insert_or_update_performer(data):
|
|||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
# 插入影片列表,可能有 personal 和 director 两个身份
|
# 插入影片列表,可能有 personal 和 director 两个身份
|
||||||
|
if movies_update:
|
||||||
credits = data.get('credits', {})
|
credits = data.get('credits', {})
|
||||||
for role, movies in credits.items():
|
for role, movies in credits.items():
|
||||||
if movies:
|
if movies:
|
||||||
|
|||||||
Reference in New Issue
Block a user