mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
fix: await durable subscribe deletion reports
This commit is contained in:
Vendored
+20
@@ -662,6 +662,15 @@ class MoviePilotServerHelper:
|
||||
"""
|
||||
return cls._post_json(cls._server_url(cls._SUBSCRIBE_DONE_PATH), payload, timeout=5)
|
||||
|
||||
@classmethod
|
||||
async def async_subscribe_done(cls, payload: Dict[str, Any]):
|
||||
"""异步完成订阅统计,并返回可检查 HTTP 状态的响应对象。"""
|
||||
return await cls._async_post_json(
|
||||
cls._server_url(cls._SUBSCRIBE_DONE_PATH),
|
||||
payload,
|
||||
timeout=5,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def subscribe_report(cls, subscribes: List[Dict[str, Any]]):
|
||||
"""
|
||||
@@ -874,6 +883,17 @@ class MoviePilotServerHelper:
|
||||
res = cls.subscribe_done(payload)
|
||||
return bool(res is not None and res.status_code == 200)
|
||||
|
||||
@classmethod
|
||||
async def async_sub_done(cls, sub: dict) -> bool:
|
||||
"""异步完成订阅统计,并仅在服务端确认成功时返回 True。"""
|
||||
if not settings.SUBSCRIBE_STATISTIC_SHARE:
|
||||
return False
|
||||
payload = cls._build_subscribe_statistic_payload(sub)
|
||||
if not payload:
|
||||
return False
|
||||
res = await cls.async_subscribe_done(payload)
|
||||
return bool(res is not None and res.status_code == 200)
|
||||
|
||||
@classmethod
|
||||
def sub_reg_async(cls, sub: dict) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user