From b437fd602131bd6a0302035a0a15ad48efd8a01b Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 27 Apr 2024 00:30:17 +0800 Subject: [PATCH] fix bug --- app/modules/themoviedb/tmdbapi.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/modules/themoviedb/tmdbapi.py b/app/modules/themoviedb/tmdbapi.py index ebbe8eb7..34d9dd3f 100644 --- a/app/modules/themoviedb/tmdbapi.py +++ b/app/modules/themoviedb/tmdbapi.py @@ -1233,9 +1233,13 @@ class TmdbApi: return [] try: logger.info(f"正在获取人物参演作品:{person_id}...") - info = self.person.movie_credits(person_id=person_id) or {} - cast = info.get('cast') or [] + movies = self.person.movie_credits(person_id=person_id) or {} + tvs = self.person.tv_credits(person_id=person_id) or {} + cast = (movies.get('cast') or []) + (tvs.get('cast') or []) if cast: + # 按年份降序排列 + cast = sorted(cast, key=lambda x: x.get('release_date') or x.get('first_air_date') or '1900-01-01', + reverse=True) return cast[(page - 1) * count: page * count] return [] except Exception as e: