mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-06 23:28:53 +08:00
refactor(types): govern TMDb change response contract
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
from ..tmdb import TMDb
|
||||
from ..tmdb import TMDb, TMDbJson
|
||||
|
||||
|
||||
class Change(TMDb):
|
||||
"""提供电影、剧集和人物的变更列表查询。"""
|
||||
|
||||
_urls = {
|
||||
"movie": "/movie/changes",
|
||||
"tv": "/tv/changes",
|
||||
"person": "/person/changes"
|
||||
}
|
||||
|
||||
def _change_list(self, change_type, start_date="", end_date="", page=1):
|
||||
def _change_list(self, change_type: str, start_date: str | None = "", end_date: str | None = "", page: int | None = 1) -> TMDbJson:
|
||||
"""拼装可选时间范围和页码,并原样返回变更列表。"""
|
||||
params = "page=%s" % page
|
||||
if start_date:
|
||||
params += "&start_date=%s" % start_date
|
||||
@@ -20,7 +23,8 @@ class Change(TMDb):
|
||||
key="results"
|
||||
)
|
||||
|
||||
async def _async_change_list(self, change_type, start_date="", end_date="", page=1):
|
||||
async def _async_change_list(self, change_type: str, start_date: str | None = "", end_date: str | None = "", page: int | None = 1) -> TMDbJson:
|
||||
"""拼装可选时间范围和页码,并原样返回变更列表。"""
|
||||
params = "page=%s" % page
|
||||
if start_date:
|
||||
params += "&start_date=%s" % start_date
|
||||
@@ -32,7 +36,7 @@ class Change(TMDb):
|
||||
key="results"
|
||||
)
|
||||
|
||||
def movie_change_list(self, start_date="", end_date="", page=1):
|
||||
def movie_change_list(self, start_date: str | None = "", end_date: str | None = "", page: int | None = 1) -> TMDbJson:
|
||||
"""
|
||||
Get the changes for a movie. By default only the last 24 hours are returned.
|
||||
You can query up to 14 days in a single query by using the start_date and end_date query parameters.
|
||||
@@ -43,7 +47,7 @@ class Change(TMDb):
|
||||
"""
|
||||
return self._change_list("movie", start_date=start_date, end_date=end_date, page=page)
|
||||
|
||||
async def async_movie_change_list(self, start_date="", end_date="", page=1):
|
||||
async def async_movie_change_list(self, start_date: str | None = "", end_date: str | None = "", page: int | None = 1) -> TMDbJson:
|
||||
"""
|
||||
Get the changes for a movie. By default only the last 24 hours are returned.(异步版本)
|
||||
You can query up to 14 days in a single query by using the start_date and end_date query parameters.
|
||||
@@ -54,7 +58,7 @@ class Change(TMDb):
|
||||
"""
|
||||
return await self._async_change_list("movie", start_date=start_date, end_date=end_date, page=page)
|
||||
|
||||
def tv_change_list(self, start_date="", end_date="", page=1):
|
||||
def tv_change_list(self, start_date: str | None = "", end_date: str | None = "", page: int | None = 1) -> TMDbJson:
|
||||
"""
|
||||
Get a list of all of the TV show ids that have been changed in the past 24 hours.
|
||||
You can query up to 14 days in a single query by using the start_date and end_date query parameters.
|
||||
@@ -65,7 +69,7 @@ class Change(TMDb):
|
||||
"""
|
||||
return self._change_list("tv", start_date=start_date, end_date=end_date, page=page)
|
||||
|
||||
async def async_tv_change_list(self, start_date="", end_date="", page=1):
|
||||
async def async_tv_change_list(self, start_date: str | None = "", end_date: str | None = "", page: int | None = 1) -> TMDbJson:
|
||||
"""
|
||||
Get a list of all of the TV show ids that have been changed in the past 24 hours.(异步版本)
|
||||
You can query up to 14 days in a single query by using the start_date and end_date query parameters.
|
||||
@@ -76,7 +80,7 @@ class Change(TMDb):
|
||||
"""
|
||||
return await self._async_change_list("tv", start_date=start_date, end_date=end_date, page=page)
|
||||
|
||||
def person_change_list(self, start_date="", end_date="", page=1):
|
||||
def person_change_list(self, start_date: str | None = "", end_date: str | None = "", page: int | None = 1) -> TMDbJson:
|
||||
"""
|
||||
Get a list of all of the person ids that have been changed in the past 24 hours.
|
||||
You can query up to 14 days in a single query by using the start_date and end_date query parameters.
|
||||
@@ -87,7 +91,7 @@ class Change(TMDb):
|
||||
"""
|
||||
return self._change_list("person", start_date=start_date, end_date=end_date, page=page)
|
||||
|
||||
async def async_person_change_list(self, start_date="", end_date="", page=1):
|
||||
async def async_person_change_list(self, start_date: str | None = "", end_date: str | None = "", page: int | None = 1) -> TMDbJson:
|
||||
"""
|
||||
Get a list of all of the person ids that have been changed in the past 24 hours.(异步版本)
|
||||
You can query up to 14 days in a single query by using the start_date and end_date query parameters.
|
||||
|
||||
Reference in New Issue
Block a user