diff --git a/src/widgets/emby/component.jsx b/src/widgets/emby/component.jsx
index a61cd7aa..79fe2240 100644
--- a/src/widgets/emby/component.jsx
+++ b/src/widgets/emby/component.jsx
@@ -161,6 +161,13 @@ export default function Component({ service }) {
refreshInterval: 5000,
});
+ const {
+ data: countData,
+ error: countError,
+ } = useWidgetAPI(widget, "Count", {
+ refreshInterval: 600000,
+ });
+
async function handlePlayCommand(session, command) {
const url = formatProxyUrlWithSegments(widget, "PlayControl", {
sessionId: session.Id,
@@ -171,6 +178,21 @@ export default function Component({ service }) {
});
}
+ if (countError) {
+ return ;
+ }
+
+ if (countData){
+ return (
+
+
+
+
+
+
+ );
+ }
+
if (sessionsError) {
return ;
}
diff --git a/src/widgets/emby/widget.js b/src/widgets/emby/widget.js
index 27fc749b..1295ddda 100644
--- a/src/widgets/emby/widget.js
+++ b/src/widgets/emby/widget.js
@@ -1,19 +1,28 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
- api: "{url}/emby/{endpoint}?api_key={key}",
- proxyHandler: genericProxyHandler,
+ api: "{url}/emby/{endpoint}?api_key={key}",
+ proxyHandler: genericProxyHandler,
- mappings: {
- Sessions: {
- endpoint: "Sessions",
+ mappings: {
+ Sessions: {
+ endpoint: "Sessions",
+ },
+ Count: {
+ endpoint: "Items/Counts",
+ validate: [
+ "MovieCount",
+ "SeriesCount",
+ "EpisodeCount",
+ "SongCount"
+ ]
+ },
+ PlayControl: {
+ method: "POST",
+ endpoint: "Sessions/{sessionId}/Playing/{command}",
+ segments: ["sessionId", "command"],
+ },
},
- PlayControl: {
- method: "POST",
- endpoint: "Sessions/{sessionId}/Playing/{command}",
- segments: ["sessionId", "command"],
- },
- },
};
-export default widget;
+export default widget;
\ No newline at end of file