diff --git a/src/widgets/navidrome/widget.js b/src/widgets/navidrome/widget.js
index 9b8614350..9d7c03d45 100644
--- a/src/widgets/navidrome/widget.js
+++ b/src/widgets/navidrome/widget.js
@@ -1,7 +1,7 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
- api: "{url}/rest/{endpoint}?u={user}&t={token}&s={salt}&v={version}&c={client}&f=json",
+ api: "{url}/rest/{endpoint}?u={user}&t={token}&s={salt}&v=1.16.1&c=homepage&f=json",
proxyHandler: genericProxyHandler,
mappings: {
From 3e73fb65ead76accca59f0ad327dc027062838b8 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+shamoon@users.noreply.github.com>
Date: Mon, 7 Nov 2022 11:06:53 -0800
Subject: [PATCH 3/3] Use compact now playing format
---
public/locales/en/common.json | 6 ++--
src/widgets/navidrome/component.jsx | 51 +++++++++++++++--------------
2 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 94ac652be..afba679a1 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -169,10 +169,8 @@
"middleware": "Middleware"
},
"navidrome": {
- "user": "User",
- "artist": "Artist",
- "song": "Song",
- "album": "Album"
+ "nothing_streaming": "No Active Streams",
+ "please_wait": "Please Wait"
},
"npm": {
"enabled": "Enabled",
diff --git a/src/widgets/navidrome/component.jsx b/src/widgets/navidrome/component.jsx
index 360dac97e..f4f3e6721 100644
--- a/src/widgets/navidrome/component.jsx
+++ b/src/widgets/navidrome/component.jsx
@@ -1,9 +1,24 @@
import { useTranslation } from "next-i18next";
import Container from "components/services/widget/container";
-import Block from "components/services/widget/block";
import useWidgetAPI from "utils/proxy/use-widget-api";
+function SinglePlayingEntry({ entry }) {
+ const { username, artist, title, album } = entry;
+ let fullTitle = title;
+ if (artist) fullTitle = `${artist} - ${title}`;
+ if (album) fullTitle += ` — ${album}`;
+ if (username) fullTitle += ` (${username})`;
+
+ return (
+
+ );
+}
+
export default function Component({ service }) {
const { t } = useTranslation();
@@ -17,37 +32,25 @@ export default function Component({ service }) {
if (!navidromeData) {
return (
-
-
-
-
-
-
+
);
}
- const nowPlaying = navidromeData["subsonic-response"].nowPlaying;
+ const { nowPlaying } = navidromeData["subsonic-response"];
if (!nowPlaying.entry) {
// nothing playing
return (
-
+
);
}
const nowPlayingEntries = Object.values(nowPlaying.entry);
- const songList = [];
-
- nowPlayingEntries.forEach(userPlay => {
- const playing = (
-
-
-
-
-
-
- );
- songList.unshift(playing);
- });
-
- return songList;
+
+ return (
+
+ {nowPlayingEntries.map((entry) => (
+
+ ))}
+
+ );
}