forked from platypush/platypush
[torrent] Added is_media
attribute to torrent results.
This commit is contained in:
parent
1dd905dc66
commit
1774e464cc
4 changed files with 15 additions and 1 deletions
|
@ -25,6 +25,7 @@ class TorrentSearchResult:
|
||||||
peers: int = 0
|
peers: int = 0
|
||||||
image: Optional[str] = None
|
image: Optional[str] = None
|
||||||
description: Optional[str] = None
|
description: Optional[str] = None
|
||||||
|
is_media: bool = False
|
||||||
imdb_id: Optional[str] = None
|
imdb_id: Optional[str] = None
|
||||||
tvdb_id: Optional[str] = None
|
tvdb_id: Optional[str] = None
|
||||||
year: Optional[int] = None
|
year: Optional[int] = None
|
||||||
|
|
|
@ -160,6 +160,7 @@ class PopcornTimeSearchProvider(TorrentSearchProvider):
|
||||||
[
|
[
|
||||||
TorrentSearchResult(
|
TorrentSearchResult(
|
||||||
provider=cls.provider_name(),
|
provider=cls.provider_name(),
|
||||||
|
is_media=True,
|
||||||
imdb_id=result.get('imdb_id'),
|
imdb_id=result.get('imdb_id'),
|
||||||
type='movies',
|
type='movies',
|
||||||
title=result.get('title', '[No Title]')
|
title=result.get('title', '[No Title]')
|
||||||
|
@ -196,6 +197,7 @@ class PopcornTimeSearchProvider(TorrentSearchProvider):
|
||||||
[
|
[
|
||||||
TorrentSearchResult(
|
TorrentSearchResult(
|
||||||
provider=cls.provider_name(),
|
provider=cls.provider_name(),
|
||||||
|
is_media=True,
|
||||||
imdb_id=result.get('imdb_id'),
|
imdb_id=result.get('imdb_id'),
|
||||||
tvdb_id=result.get('tvdb_id'),
|
tvdb_id=result.get('tvdb_id'),
|
||||||
type='tv',
|
type='tv',
|
||||||
|
|
|
@ -78,7 +78,11 @@ class TorrentsCsvSearchProvider(TorrentsCsvBaseProvider):
|
||||||
:param limit: Number of results to return (default: 25).
|
:param limit: Number of results to return (default: 25).
|
||||||
:param page: Page number (default: 1).
|
:param page: Page number (default: 1).
|
||||||
"""
|
"""
|
||||||
return list(self._delegate.search(query=query, limit=limit, page=page))
|
results = list(self._delegate.search(query=query, limit=limit, page=page))
|
||||||
|
for result in results:
|
||||||
|
result.provider = self.provider_name()
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
# vim:sw=4:ts=4:et:
|
# vim:sw=4:ts=4:et:
|
||||||
|
|
|
@ -60,6 +60,13 @@ class TorrentResultSchema(Schema):
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is_media = fields.Boolean(
|
||||||
|
metadata={
|
||||||
|
'description': 'True if the torrent is a media file',
|
||||||
|
'example': True,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
size = fields.Integer(
|
size = fields.Integer(
|
||||||
missing=0,
|
missing=0,
|
||||||
metadata={
|
metadata={
|
||||||
|
|
Loading…
Reference in a new issue