Skip to content

Commit

Permalink
fix: 修复订阅关键词缺失
Browse files Browse the repository at this point in the history
  • Loading branch information
linyuan0213 committed Jul 7, 2024
1 parent d531cd4 commit 1437732
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
16 changes: 16 additions & 0 deletions app/media/meta/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,13 @@ def set_tmdb_info(self, info):
self.original_title = info.get('original_title')
self.runtime = info.get("runtime")
self.release_date = info.get('release_date')
if info.original_language == "en":
self.en_name = info.original_title
else:
if hasattr(self.tmdb_info, 'translations'):
en_list = list(filter(lambda x : x.get('iso_639_1') == 'en', self.tmdb_info.translations.translations)) or [{}]
self.en_name = en_list[0].get('data', {}).get('name')
self.cn_name = info.get('title')
if self.release_date:
self.year = self.release_date[0:4]
self.category = self.category_handler.get_movie_category(info)
Expand All @@ -548,6 +555,15 @@ def set_tmdb_info(self, info):
self.original_title = info.get('original_name')
self.runtime = info.get("episode_run_time")[0] if info.get("episode_run_time") else None
self.release_date = info.get('first_air_date')
self.cn_name = info.get('name')
if info.original_language == "en":
self.en_name = info.original_name
else:
if hasattr(self.tmdb_info, 'translations'):
en_list = list(filter(lambda x : x.get('iso_639_1') == 'en', self.tmdb_info.translations.translations)) or [{}]
self.en_name = en_list[0].get('data', {}).get('name')

self.cn_name = info.get('name')
if self.release_date:
self.year = self.release_date[0:4]
if self.type == MediaType.TV:
Expand Down
5 changes: 2 additions & 3 deletions app/searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ def search_one_media(self, media_info,
search_name_list = []
if media_info.keyword:
# 直接使用搜索词搜索
first_search_name = media_info.keyword
second_search_name = None
search_name_list.append(media_info.keyword)
else:
# 中文名
if media_info.cn_name:
Expand Down Expand Up @@ -141,7 +140,7 @@ def search_one_media(self, media_info,
# 简体中文和繁体中文是否相同
if search_zhtw_name != search_cn_name:
search_name_list.append(search_zhtw_name)
if media_info.original_language != 'cn':
if media_info.original_language != 'cn' and search_en_name != media_info.original_title:
search_name_list.append(media_info.original_title)

if Config().get_config("laboratory").get("search_en_title"):
Expand Down
2 changes: 1 addition & 1 deletion web/backend/search_torrents.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def search_medias_for_web(content, ident_flag=True, filters=None, tmdbid=None, m
# 简体中文和繁体中文是否相同
if search_zhtw_name != search_cn_name:
search_name_list.append(search_zhtw_name)
if media_info.original_language != 'cn':
if media_info.original_language != 'cn' and search_en_name != media_info.original_title:
search_name_list.append(media_info.original_title)

# 去除空元素
Expand Down

0 comments on commit 1437732

Please sign in to comment.