mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix(rousi): 精简并修正分类映射
This commit is contained in:
@@ -27,10 +27,15 @@ class RousiSpider(metaclass=SingletonClass):
|
|||||||
_proxy = None
|
_proxy = None
|
||||||
_cookie = None
|
_cookie = None
|
||||||
_ua = None
|
_ua = None
|
||||||
_size = 20
|
_size = 100
|
||||||
_searchurl = "https://%s/api/v1/torrents"
|
_searchurl = "https://%s/api/v1/torrents"
|
||||||
_downloadurl = "https://%s/api/v1/torrents/%s"
|
_downloadurl = "https://%s/api/v1/torrents/%s"
|
||||||
_timeout = 15
|
_timeout = 15
|
||||||
|
|
||||||
|
# 分类定义
|
||||||
|
_movie_category = ['movie']
|
||||||
|
_tv_category = ['tv', 'documentary', 'animation', 'variety']
|
||||||
|
|
||||||
_apikey = None
|
_apikey = None
|
||||||
|
|
||||||
def __init__(self, indexer: dict):
|
def __init__(self, indexer: dict):
|
||||||
@@ -72,18 +77,14 @@ class RousiSpider(metaclass=SingletonClass):
|
|||||||
# 用户选择了特定分类,需要将分类 ID 映射回 API 的 category name
|
# 用户选择了特定分类,需要将分类 ID 映射回 API 的 category name
|
||||||
category_names = self.__get_category_names_by_ids(cat)
|
category_names = self.__get_category_names_by_ids(cat)
|
||||||
if category_names:
|
if category_names:
|
||||||
# 如果只有一个分类,使用 category=xxx
|
# 使用数组格式 category[]=xxx
|
||||||
if len(category_names) == 1:
|
params["category[]"] = category_names
|
||||||
params["category"] = category_names[0]
|
|
||||||
else:
|
|
||||||
# 多个分类使用数组格式 category[]=xxx
|
|
||||||
params["category[]"] = category_names
|
|
||||||
elif mtype:
|
elif mtype:
|
||||||
# 用户未选择分类,根据媒体类型推断
|
# 用户未选择分类,根据媒体类型推断
|
||||||
if mtype == MediaType.MOVIE:
|
if mtype == MediaType.MOVIE:
|
||||||
params["category"] = "movie"
|
params["category[]"] = self._movie_category
|
||||||
elif mtype == MediaType.TV:
|
elif mtype == MediaType.TV:
|
||||||
params["category"] = "tv"
|
params["category[]"] = self._tv_category
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
@@ -103,12 +104,7 @@ class RousiSpider(metaclass=SingletonClass):
|
|||||||
'2': 'tv',
|
'2': 'tv',
|
||||||
'3': 'documentary',
|
'3': 'documentary',
|
||||||
'4': 'animation',
|
'4': 'animation',
|
||||||
'5': 'variety',
|
'6': 'variety'
|
||||||
'6': 'sports',
|
|
||||||
'7': 'music',
|
|
||||||
'8': 'software',
|
|
||||||
'9': 'ebook',
|
|
||||||
'10': 'other'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 分割多个分类 ID 并映射为 category names
|
# 分割多个分类 ID 并映射为 category names
|
||||||
|
|||||||
Reference in New Issue
Block a user