feat: add books field to jellyfin widget
This commit is contained in:
parent
7cbba1ff90
commit
65b57ea7d0
@ -7,7 +7,7 @@ Learn more about [Jellyfin](https://github.com/jellyfin/jellyfin).
|
||||
|
||||
You can create an API key from inside Jellyfin at `Settings > Advanced > Api Keys`.
|
||||
|
||||
As of v0.6.11 the widget supports fields `["movies", "series", "episodes", "songs"]`. These blocks are disabled by default but can be enabled with the `enableBlocks` option, and the "Now Playing" feature (enabled by default) can be disabled with the `enableNowPlaying` option.
|
||||
As of v0.6.11 the widget supports fields `["movies", "series", "episodes", "songs", "books"]`. These blocks are disabled by default but can be enabled with the `enableBlocks` option, and the "Now Playing" feature (enabled by default) can be disabled with the `enableNowPlaying` option.
|
||||
|
||||
```yaml
|
||||
widget:
|
||||
|
||||
@ -105,7 +105,8 @@
|
||||
"movies": "Movies",
|
||||
"series": "Series",
|
||||
"episodes": "Episodes",
|
||||
"songs": "Songs"
|
||||
"songs": "Songs",
|
||||
"books": "Books"
|
||||
},
|
||||
"esphome": {
|
||||
"offline": "Offline",
|
||||
|
||||
@ -175,26 +175,31 @@ function SessionEntry({ playCommand, session, enableUser, showEpisodeNumber }) {
|
||||
function CountBlocks({ service, countData }) {
|
||||
const { t } = useTranslation();
|
||||
// allows filtering
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
if (service.widget?.type === "jellyfin") service.widget.type = "emby";
|
||||
const isJellyfin = service.widget?.type === "jellyfin";
|
||||
// Create a new service object instead of modifying the original
|
||||
const modifiedService = isJellyfin
|
||||
? { ...service, widget: { ...service.widget, type: "emby" }}
|
||||
: service;
|
||||
|
||||
if (!countData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Container service={modifiedService}>
|
||||
<Block label="emby.movies" />
|
||||
<Block label="emby.series" />
|
||||
<Block label="emby.episodes" />
|
||||
<Block label="emby.songs" />
|
||||
{isJellyfin && <Block label="emby.books" />}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Container service={modifiedService}>
|
||||
<Block label="emby.movies" value={t("common.number", { value: countData.MovieCount })} />
|
||||
<Block label="emby.series" value={t("common.number", { value: countData.SeriesCount })} />
|
||||
<Block label="emby.episodes" value={t("common.number", { value: countData.EpisodeCount })} />
|
||||
<Block label="emby.songs" value={t("common.number", { value: countData.SongCount })} />
|
||||
{isJellyfin && <Block label="emby.books" value={t("common.number", { value: countData.BookCount })} />}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user