forked from platypush/platypush
[#414] Support for Jellyfin book items [backend].
This commit is contained in:
parent
ec8fe401d2
commit
825593a445
2 changed files with 22 additions and 0 deletions
|
@ -7,6 +7,7 @@ from platypush.plugins import Plugin, action
|
||||||
from platypush.schemas.media.jellyfin import (
|
from platypush.schemas.media.jellyfin import (
|
||||||
JellyfinAlbumSchema,
|
JellyfinAlbumSchema,
|
||||||
JellyfinArtistSchema,
|
JellyfinArtistSchema,
|
||||||
|
JellyfinBookSchema,
|
||||||
JellyfinCollectionSchema,
|
JellyfinCollectionSchema,
|
||||||
JellyfinEpisodeSchema,
|
JellyfinEpisodeSchema,
|
||||||
JellyfinMovieSchema,
|
JellyfinMovieSchema,
|
||||||
|
@ -158,6 +159,8 @@ class MediaJellyfinPlugin(Plugin):
|
||||||
result = JellyfinVideoSchema().dump(result)
|
result = JellyfinVideoSchema().dump(result)
|
||||||
elif result['Type'] == 'Photo':
|
elif result['Type'] == 'Photo':
|
||||||
result = JellyfinPhotoSchema().dump(result)
|
result = JellyfinPhotoSchema().dump(result)
|
||||||
|
elif result['Type'] == 'Book':
|
||||||
|
result = JellyfinBookSchema().dump(result)
|
||||||
elif result['Type'] == 'Episode':
|
elif result['Type'] == 'Episode':
|
||||||
result = JellyfinEpisodeSchema().dump(result)
|
result = JellyfinEpisodeSchema().dump(result)
|
||||||
elif result['Type'] == 'Audio':
|
elif result['Type'] == 'Audio':
|
||||||
|
|
|
@ -294,3 +294,22 @@ class JellyfinPhotoSchema(JellyfinSchema):
|
||||||
)
|
)
|
||||||
data['url'] = f'{base_url}/Download?api_key={self._api_key}'
|
data['url'] = f'{base_url}/Download?api_key={self._api_key}'
|
||||||
return data
|
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
|
||||||
|
|
Loading…
Reference in a new issue