Added username to Tautulli and Emby/Jellyfin Widget. New setting added "enableUser" that is optional and can be added to both of these widgets. User name is displayed after the title as (UserName).
This commit is contained in:
parent
787fb0f3bc
commit
0485031bce
@ -16,4 +16,5 @@ widget:
|
|||||||
key: apikeyapikeyapikeyapikeyapikey
|
key: apikeyapikeyapikeyapikeyapikey
|
||||||
enableBlocks: true # optional, defaults to false
|
enableBlocks: true # optional, defaults to false
|
||||||
enableNowPlaying: true # optional, defaults to true
|
enableNowPlaying: true # optional, defaults to true
|
||||||
|
enableUser: true # optional, defaults to false
|
||||||
```
|
```
|
||||||
|
|||||||
@ -14,4 +14,5 @@ widget:
|
|||||||
type: tautulli
|
type: tautulli
|
||||||
url: http://tautulli.host.or.ip
|
url: http://tautulli.host.or.ip
|
||||||
key: apikeyapikeyapikeyapikeyapikey
|
key: apikeyapikeyapikeyapikeyapikey
|
||||||
|
enableUser: true # optional, defaults to false
|
||||||
```
|
```
|
||||||
|
|||||||
@ -393,6 +393,9 @@ export function cleanServiceGroups(groups) {
|
|||||||
enableBlocks,
|
enableBlocks,
|
||||||
enableNowPlaying,
|
enableNowPlaying,
|
||||||
|
|
||||||
|
// emby, jellyfin, tautulli
|
||||||
|
enableUser,
|
||||||
|
|
||||||
// glances, pihole
|
// glances, pihole
|
||||||
version,
|
version,
|
||||||
|
|
||||||
@ -517,6 +520,20 @@ export function cleanServiceGroups(groups) {
|
|||||||
if (["emby", "jellyfin"].includes(type)) {
|
if (["emby", "jellyfin"].includes(type)) {
|
||||||
if (enableBlocks !== undefined) cleanedService.widget.enableBlocks = JSON.parse(enableBlocks);
|
if (enableBlocks !== undefined) cleanedService.widget.enableBlocks = JSON.parse(enableBlocks);
|
||||||
if (enableNowPlaying !== undefined) cleanedService.widget.enableNowPlaying = JSON.parse(enableNowPlaying);
|
if (enableNowPlaying !== undefined) cleanedService.widget.enableNowPlaying = JSON.parse(enableNowPlaying);
|
||||||
|
if (enableUser !== undefined) {
|
||||||
|
cleanedService.widget.enableUser = JSON.parse(enableUser);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cleanedService.widget.enableUser = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (["tautulli"].includes(type)) {
|
||||||
|
if (enableUser !== undefined) {
|
||||||
|
cleanedService.widget.enableUser = JSON.parse(enableUser);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cleanedService.widget.enableUser = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (["sonarr", "radarr"].includes(type)) {
|
if (["sonarr", "radarr"].includes(type)) {
|
||||||
if (enableQueue !== undefined) cleanedService.widget.enableQueue = JSON.parse(enableQueue);
|
if (enableQueue !== undefined) cleanedService.widget.enableQueue = JSON.parse(enableQueue);
|
||||||
|
|||||||
@ -27,10 +27,11 @@ function ticksToString(ticks) {
|
|||||||
return parts.map((part) => part.toString().padStart(2, "0")).join(":");
|
return parts.map((part) => part.toString().padStart(2, "0")).join(":");
|
||||||
}
|
}
|
||||||
|
|
||||||
function SingleSessionEntry({ playCommand, session }) {
|
function SingleSessionEntry({ playCommand, session, enableUser }) {
|
||||||
const {
|
const {
|
||||||
NowPlayingItem: { Name, SeriesName },
|
NowPlayingItem: { Name, SeriesName },
|
||||||
PlayState: { PositionTicks, IsPaused, IsMuted },
|
PlayState: { PositionTicks, IsPaused, IsMuted },
|
||||||
|
UserName,
|
||||||
} = session;
|
} = session;
|
||||||
|
|
||||||
const RunTimeTicks =
|
const RunTimeTicks =
|
||||||
@ -49,6 +50,7 @@ function SingleSessionEntry({ playCommand, session }) {
|
|||||||
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden">
|
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden">
|
||||||
{Name}
|
{Name}
|
||||||
{SeriesName && ` - ${SeriesName}`}
|
{SeriesName && ` - ${SeriesName}`}
|
||||||
|
{enableUser && ` (${UserName})`}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="self-center text-xs flex justify-end mr-1.5 pl-1">
|
<div className="self-center text-xs flex justify-end mr-1.5 pl-1">
|
||||||
@ -97,10 +99,11 @@ function SingleSessionEntry({ playCommand, session }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SessionEntry({ playCommand, session }) {
|
function SessionEntry({ playCommand, session, enableUser }) {
|
||||||
const {
|
const {
|
||||||
NowPlayingItem: { Name, SeriesName },
|
NowPlayingItem: { Name, SeriesName },
|
||||||
PlayState: { PositionTicks, IsPaused, IsMuted },
|
PlayState: { PositionTicks, IsPaused, IsMuted },
|
||||||
|
UserName,
|
||||||
} = session;
|
} = session;
|
||||||
|
|
||||||
const RunTimeTicks =
|
const RunTimeTicks =
|
||||||
@ -142,6 +145,7 @@ function SessionEntry({ playCommand, session }) {
|
|||||||
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden">
|
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden">
|
||||||
{Name}
|
{Name}
|
||||||
{SeriesName && ` - ${SeriesName}`}
|
{SeriesName && ` - ${SeriesName}`}
|
||||||
|
{enableUser && ` (${UserName})`}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="self-center text-xs flex justify-end mr-1 z-10">{IsMuted && <BsVolumeMuteFill />}</div>
|
<div className="self-center text-xs flex justify-end mr-1 z-10">{IsMuted && <BsVolumeMuteFill />}</div>
|
||||||
@ -215,6 +219,7 @@ export default function Component({ service }) {
|
|||||||
|
|
||||||
const enableBlocks = service.widget?.enableBlocks;
|
const enableBlocks = service.widget?.enableBlocks;
|
||||||
const enableNowPlaying = service.widget?.enableNowPlaying ?? true;
|
const enableNowPlaying = service.widget?.enableNowPlaying ?? true;
|
||||||
|
const enableUser = service.widget?.enableUser ?? true;
|
||||||
|
|
||||||
if (!sessionsData || !countData) {
|
if (!sessionsData || !countData) {
|
||||||
return (
|
return (
|
||||||
@ -272,6 +277,7 @@ export default function Component({ service }) {
|
|||||||
<SingleSessionEntry
|
<SingleSessionEntry
|
||||||
playCommand={(currentSession, command) => handlePlayCommand(currentSession, command)}
|
playCommand={(currentSession, command) => handlePlayCommand(currentSession, command)}
|
||||||
session={session}
|
session={session}
|
||||||
|
enableUser={enableUser}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@ -288,6 +294,7 @@ export default function Component({ service }) {
|
|||||||
key={session.Id}
|
key={session.Id}
|
||||||
playCommand={(currentSession, command) => handlePlayCommand(currentSession, command)}
|
playCommand={(currentSession, command) => handlePlayCommand(currentSession, command)}
|
||||||
session={session}
|
session={session}
|
||||||
|
enableUser={enableUser}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -25,14 +25,17 @@ function millisecondsToString(milliseconds) {
|
|||||||
return parts.map((part) => part.toString().padStart(2, "0")).join(":");
|
return parts.map((part) => part.toString().padStart(2, "0")).join(":");
|
||||||
}
|
}
|
||||||
|
|
||||||
function SingleSessionEntry({ session }) {
|
function SingleSessionEntry({ session, enableUser }) {
|
||||||
const { full_title, duration, view_offset, progress_percent, state, video_decision, audio_decision } = session;
|
const { full_title, duration, view_offset, progress_percent, state, video_decision, audio_decision, username } = session;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="text-theme-700 dark:text-theme-200 relative h-5 w-full rounded-md bg-theme-200/50 dark:bg-theme-900/20 mt-1 flex">
|
<div className="text-theme-700 dark:text-theme-200 relative h-5 w-full rounded-md bg-theme-200/50 dark:bg-theme-900/20 mt-1 flex">
|
||||||
<div className="text-xs z-10 self-center ml-2 relative w-full h-4 grow mr-2">
|
<div className="text-xs z-10 self-center ml-2 relative w-full h-4 grow mr-2">
|
||||||
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden">{full_title}</div>
|
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden">
|
||||||
|
{full_title}
|
||||||
|
{enableUser && ` (${username})`}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="self-center text-xs flex justify-end mr-1.5 pl-1">
|
<div className="self-center text-xs flex justify-end mr-1.5 pl-1">
|
||||||
{video_decision === "direct play" && audio_decision === "direct play" && (
|
{video_decision === "direct play" && audio_decision === "direct play" && (
|
||||||
@ -74,8 +77,8 @@ function SingleSessionEntry({ session }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SessionEntry({ session }) {
|
function SessionEntry({ session, enableUser }) {
|
||||||
const { full_title, view_offset, progress_percent, state, video_decision, audio_decision } = session;
|
const { full_title, view_offset, progress_percent, state, video_decision, audio_decision, username } = session;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="text-theme-700 dark:text-theme-200 relative h-5 w-full rounded-md bg-theme-200/50 dark:bg-theme-900/20 mt-1 flex">
|
<div className="text-theme-700 dark:text-theme-200 relative h-5 w-full rounded-md bg-theme-200/50 dark:bg-theme-900/20 mt-1 flex">
|
||||||
@ -94,7 +97,10 @@ function SessionEntry({ session }) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-xs z-10 self-center ml-2 relative w-full h-4 grow mr-2">
|
<div className="text-xs z-10 self-center ml-2 relative w-full h-4 grow mr-2">
|
||||||
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden">{full_title}</div>
|
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden">
|
||||||
|
{full_title}
|
||||||
|
{enableUser && ` (${username})`}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="self-center text-xs flex justify-end mr-1.5 pl-1 z-10">
|
<div className="self-center text-xs flex justify-end mr-1.5 pl-1 z-10">
|
||||||
{video_decision === "direct play" && audio_decision === "direct play" && (
|
{video_decision === "direct play" && audio_decision === "direct play" && (
|
||||||
@ -162,11 +168,13 @@ export default function Component({ service }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const enableUser = service.widget?.enableUser ?? true;
|
||||||
|
|
||||||
if (playing.length === 1) {
|
if (playing.length === 1) {
|
||||||
const session = playing[0];
|
const session = playing[0];
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col pb-1 mx-1">
|
<div className="flex flex-col pb-1 mx-1">
|
||||||
<SingleSessionEntry session={session} />
|
<SingleSessionEntry session={session} enableUser={enableUser}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -174,7 +182,7 @@ export default function Component({ service }) {
|
|||||||
return (
|
return (
|
||||||
<div className="flex flex-col pb-1 mx-1">
|
<div className="flex flex-col pb-1 mx-1">
|
||||||
{playing.map((session) => (
|
{playing.map((session) => (
|
||||||
<SessionEntry key={session.Id} session={session} />
|
<SessionEntry key={session.Id} session={session} enableUser={enableUser}/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user