diff --git a/docs/widgets/services/emby.md b/docs/widgets/services/emby.md index e658d73b..33f6c8d1 100644 --- a/docs/widgets/services/emby.md +++ b/docs/widgets/services/emby.md @@ -9,6 +9,8 @@ You can create an API key from inside Emby 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. +After version v0.9.10, Add `maxShowNowPlayingCount` option to limit the number of Now Playing items displayed. + ```yaml widget: type: emby @@ -19,4 +21,5 @@ widget: enableUser: true # optional, defaults to false showEpisodeNumber: true # optional, defaults to false expandOneStreamToTwoRows: false # optional, defaults to true + maxShowNowPlayingCount: 2 # optional, defaults to Infinity ``` diff --git a/docs/widgets/services/jellyfin.md b/docs/widgets/services/jellyfin.md index b6724a15..49baf36e 100644 --- a/docs/widgets/services/jellyfin.md +++ b/docs/widgets/services/jellyfin.md @@ -9,6 +9,8 @@ You can create an API key from inside Jellyfin at `Settings > Advanced > Api Key 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. +After version v0.9.10, Add `maxShowNowPlayingCount` option to limit the number of Now Playing items displayed. + ```yaml widget: type: jellyfin @@ -19,4 +21,5 @@ widget: enableUser: true # optional, defaults to false showEpisodeNumber: true # optional, defaults to false expandOneStreamToTwoRows: false # optional, defaults to true + maxShowNowPlayingCount: 2 # optional, defaults to Infinity ``` diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index 0dfbc944..e53a43fe 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -397,6 +397,7 @@ export function cleanServiceGroups(groups) { // emby, jellyfin enableBlocks, enableNowPlaying, + maxShowNowPlayingCount, // emby, jellyfin, tautulli enableUser, @@ -543,6 +544,7 @@ export function cleanServiceGroups(groups) { if (["emby", "jellyfin"].includes(type)) { if (enableBlocks !== undefined) cleanedService.widget.enableBlocks = JSON.parse(enableBlocks); if (enableNowPlaying !== undefined) cleanedService.widget.enableNowPlaying = JSON.parse(enableNowPlaying); + if (maxShowNowPlayingCount !== undefined) cleanedService.widget.maxShowNowPlayingCount = JSON.parse(maxShowNowPlayingCount); } if (["emby", "jellyfin", "tautulli"].includes(type)) { if (expandOneStreamToTwoRows !== undefined) diff --git a/src/widgets/emby/component.jsx b/src/widgets/emby/component.jsx index 6f66d1dc..ecc40802 100644 --- a/src/widgets/emby/component.jsx +++ b/src/widgets/emby/component.jsx @@ -241,6 +241,7 @@ export default function Component({ service }) { const enableUser = !!service.widget?.enableUser; // default is false const expandOneStreamToTwoRows = service.widget?.expandOneStreamToTwoRows !== false; // default is true const showEpisodeNumber = !!service.widget?.showEpisodeNumber; // default is false + const maxShowNowPlayingCount = service.widget?.maxShowNowPlayingCount ?? Infinity; // default is Infinity if (!sessionsData || !countData) { return ( @@ -273,7 +274,8 @@ export default function Component({ service }) { return -1; } return 0; - }); + }) + .slice(0, maxShowNowPlayingCount); if (playing.length === 0) { return (