mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-03-30 08:50:17 +08:00
59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
from ..tmdb import TMDb
|
|
|
|
|
|
class Collection(TMDb):
|
|
_urls = {
|
|
"details": "/collection/%s",
|
|
"images": "/collection/%s/images",
|
|
"translations": "/collection/%s/translations"
|
|
}
|
|
|
|
def details(self, collection_id):
|
|
"""
|
|
Get collection details by id.
|
|
:param collection_id: int
|
|
:return:
|
|
"""
|
|
return self._request_obj(self._urls["details"] % collection_id, key="parts")
|
|
|
|
def images(self, collection_id):
|
|
"""
|
|
Get the images for a collection by id.
|
|
:param collection_id: int
|
|
:return:
|
|
"""
|
|
return self._request_obj(self._urls["images"] % collection_id)
|
|
|
|
def translations(self, collection_id):
|
|
"""
|
|
Get the list translations for a collection by id.
|
|
:param collection_id: int
|
|
:return:
|
|
"""
|
|
return self._request_obj(self._urls["translations"] % collection_id, key="translations")
|
|
|
|
# 异步版本方法
|
|
async def async_details(self, collection_id):
|
|
"""
|
|
Get collection details by id.(异步版本)
|
|
:param collection_id: int
|
|
:return:
|
|
"""
|
|
return await self._async_request_obj(self._urls["details"] % collection_id, key="parts")
|
|
|
|
async def async_images(self, collection_id):
|
|
"""
|
|
Get the images for a collection by id.(异步版本)
|
|
:param collection_id: int
|
|
:return:
|
|
"""
|
|
return await self._async_request_obj(self._urls["images"] % collection_id)
|
|
|
|
async def async_translations(self, collection_id):
|
|
"""
|
|
Get the list translations for a collection by id.(异步版本)
|
|
:param collection_id: int
|
|
:return:
|
|
"""
|
|
return await self._async_request_obj(self._urls["translations"] % collection_id, key="translations")
|