[torrent] Added is_media attribute to torrent results.

This commit is contained in:
Fabio Manganiello 2024-06-24 01:12:00 +02:00
parent 1dd905dc66
commit 1774e464cc
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
4 changed files with 15 additions and 1 deletions

View file

@ -25,6 +25,7 @@ class TorrentSearchResult:
peers: int = 0
image: Optional[str] = None
description: Optional[str] = None
is_media: bool = False
imdb_id: Optional[str] = None
tvdb_id: Optional[str] = None
year: Optional[int] = None

View file

@ -160,6 +160,7 @@ class PopcornTimeSearchProvider(TorrentSearchProvider):
[
TorrentSearchResult(
provider=cls.provider_name(),
is_media=True,
imdb_id=result.get('imdb_id'),
type='movies',
title=result.get('title', '[No Title]')
@ -196,6 +197,7 @@ class PopcornTimeSearchProvider(TorrentSearchProvider):
[
TorrentSearchResult(
provider=cls.provider_name(),
is_media=True,
imdb_id=result.get('imdb_id'),
tvdb_id=result.get('tvdb_id'),
type='tv',

View file

@ -78,7 +78,11 @@ class TorrentsCsvSearchProvider(TorrentsCsvBaseProvider):
:param limit: Number of results to return (default: 25).
: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:

View file

@ -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(
missing=0,
metadata={