Enhancement: add enableMediaControl flag to hide play/pause controls for emby/jellyfin (#5402)

This commit is contained in:
André Bürger 2025-06-09 18:41:48 +02:00 committed by GitHub
parent fcfb9c2237
commit a64c83209a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 6 deletions

View File

@ -17,6 +17,7 @@ widget:
enableBlocks: true # optional, defaults to false
enableNowPlaying: true # optional, defaults to true
enableUser: true # optional, defaults to false
enableMediaControl: false # optional, defaults to true
showEpisodeNumber: true # optional, defaults to false
expandOneStreamToTwoRows: false # optional, defaults to true
```

View File

@ -17,6 +17,7 @@ widget:
enableBlocks: true # optional, defaults to false
enableNowPlaying: true # optional, defaults to true
enableUser: true # optional, defaults to false
enableMediaControl: false # optional, defaults to true
showEpisodeNumber: true # optional, defaults to false
expandOneStreamToTwoRows: false # optional, defaults to true
```

View File

@ -295,6 +295,7 @@ export function cleanServiceGroups(groups) {
// emby, jellyfin
enableBlocks,
enableNowPlaying,
enableMediaControl,
// emby, jellyfin, tautulli
enableUser,
@ -471,6 +472,7 @@ export function cleanServiceGroups(groups) {
if (wan) widget.wan = wan;
}
if (["emby", "jellyfin"].includes(type)) {
if (enableMediaControl !== undefined) widget.enableMediaControl = !!JSON.parse(enableMediaControl);
if (enableBlocks !== undefined) widget.enableBlocks = JSON.parse(enableBlocks);
if (enableNowPlaying !== undefined) widget.enableNowPlaying = JSON.parse(enableNowPlaying);
}

View File

@ -45,7 +45,7 @@ function generateStreamTitle(session, enableUser, showEpisodeNumber) {
return enableUser ? `${streamTitle} (${UserName})` : streamTitle;
}
function SingleSessionEntry({ playCommand, session, enableUser, showEpisodeNumber }) {
function SingleSessionEntry({ playCommand, session, enableUser, showEpisodeNumber, enableMediaControl }) {
const {
PlayState: { PositionTicks, IsPaused, IsMuted },
} = session;
@ -85,7 +85,7 @@ function SingleSessionEntry({ playCommand, session, enableUser, showEpisodeNumbe
}}
/>
<div className="text-xs z-10 self-center ml-1">
{IsPaused && (
{enableMediaControl && IsPaused && (
<BsFillPlayFill
onClick={() => {
playCommand(session, "Unpause");
@ -93,7 +93,7 @@ function SingleSessionEntry({ playCommand, session, enableUser, showEpisodeNumbe
className="inline-block w-4 h-4 cursor-pointer -mt-[1px] mr-1 opacity-80"
/>
)}
{!IsPaused && (
{enableMediaControl && !IsPaused && (
<BsPauseFill
onClick={() => {
playCommand(session, "Pause");
@ -114,7 +114,7 @@ function SingleSessionEntry({ playCommand, session, enableUser, showEpisodeNumbe
);
}
function SessionEntry({ playCommand, session, enableUser, showEpisodeNumber }) {
function SessionEntry({ playCommand, session, enableUser, showEpisodeNumber, enableMediaControl }) {
const {
PlayState: { PositionTicks, IsPaused, IsMuted },
} = session;
@ -139,7 +139,7 @@ function SessionEntry({ playCommand, session, enableUser, showEpisodeNumber }) {
}}
/>
<div className="text-xs z-10 self-center ml-1">
{IsPaused && (
{enableMediaControl && IsPaused && (
<BsFillPlayFill
onClick={() => {
playCommand(session, "Unpause");
@ -147,7 +147,7 @@ function SessionEntry({ playCommand, session, enableUser, showEpisodeNumber }) {
className="inline-block w-4 h-4 cursor-pointer -mt-[1px] mr-1 opacity-80"
/>
)}
{!IsPaused && (
{enableMediaControl && !IsPaused && (
<BsPauseFill
onClick={() => {
playCommand(session, "Pause");
@ -238,6 +238,7 @@ export default function Component({ service }) {
const enableBlocks = service.widget?.enableBlocks;
const enableNowPlaying = service.widget?.enableNowPlaying ?? true;
const enableMediaControl = service.widget?.enableMediaControl !== false; // default is true
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
@ -304,6 +305,7 @@ export default function Component({ service }) {
session={session}
enableUser={enableUser}
showEpisodeNumber={showEpisodeNumber}
enableMediaControl={enableMediaControl}
/>
</div>
</>
@ -321,6 +323,7 @@ export default function Component({ service }) {
session={session}
enableUser={enableUser}
showEpisodeNumber={showEpisodeNumber}
enableMediaControl={enableMediaControl}
/>
))}
</div>