[#414] Support for Jellyfin book items [backend].

This commit is contained in:
Fabio Manganiello 2024-10-20 02:35:19 +02:00
parent ec8fe401d2
commit 825593a445
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 22 additions and 0 deletions

View file

@ -7,6 +7,7 @@ from platypush.plugins import Plugin, action
from platypush.schemas.media.jellyfin import (
JellyfinAlbumSchema,
JellyfinArtistSchema,
JellyfinBookSchema,
JellyfinCollectionSchema,
JellyfinEpisodeSchema,
JellyfinMovieSchema,
@ -158,6 +159,8 @@ class MediaJellyfinPlugin(Plugin):
result = JellyfinVideoSchema().dump(result)
elif result['Type'] == 'Photo':
result = JellyfinPhotoSchema().dump(result)
elif result['Type'] == 'Book':
result = JellyfinBookSchema().dump(result)
elif result['Type'] == 'Episode':
result = JellyfinEpisodeSchema().dump(result)
elif result['Type'] == 'Audio':

View file

@ -294,3 +294,22 @@ class JellyfinPhotoSchema(JellyfinSchema):
)
data['url'] = f'{base_url}/Download?api_key={self._api_key}'
return data
class JellyfinBookSchema(JellyfinSchema):
id = fields.String(attribute='Id')
name = fields.String(attribute='Name')
url = fields.URL()
embed_url = fields.URL()
type = fields.Constant('book')
item_type = fields.Constant('book')
path = fields.String(attribute='Path')
@pre_dump
def _gen_book_url(self, data, **_):
data = data or {}
data[
'url'
] = f'{self._server}/Items/{data["Id"]}/Download?api_key={self._api_key}'
data['embed_url'] = f'{self._server}/web/#/details?id={data["Id"]}'
return data