Merge pull request #163 from JazzFisch/add-lidarr

Add Lidarr widget
pull/183/head
Ben Phelps 2 years ago committed by GitHub
commit 6dc53052b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -80,6 +80,11 @@
"queued": "Queued",
"movies": "Movies"
},
"lidarr": {
"wanted": "Wanted",
"queued": "Queued",
"albums": "Albums"
},
"readarr": {
"wanted": "Wanted",
"queued": "Queued",

@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";
import Sonarr from "./widgets/service/sonarr";
import Radarr from "./widgets/service/radarr";
import Lidarr from "./widgets/service/lidarr";
import Readarr from "./widgets/service/readarr";
import Bazarr from "./widgets/service/bazarr";
import Ombi from "./widgets/service/ombi";
@ -29,6 +30,7 @@ const widgetMappings = {
docker: Docker,
sonarr: Sonarr,
radarr: Radarr,
lidarr: Lidarr,
readarr: Readarr,
bazarr: Bazarr,
ombi: Ombi,

@ -0,0 +1,41 @@
import useSWR from "swr";
import { useTranslation } from "react-i18next";
import Widget from "../widget";
import Block from "../block";
import { formatApiUrl } from "utils/api-helpers";
export default function Lidarr({ service }) {
const { t } = useTranslation();
const config = service.widget;
const { data: albumsData, error: albumsError } = useSWR(formatApiUrl(config, "album"));
const { data: wantedData, error: wantedError } = useSWR(formatApiUrl(config, "wanted/missing"));
const { data: queueData, error: queueError } = useSWR(formatApiUrl(config, "queue/status"));
if (albumsError || wantedError || queueError) {
return <Widget error={t("widget.api_error")} />;
}
if (!albumsData || !wantedData || !queueData) {
return (
<Widget>
<Block label={t("lidarr.wanted")} />
<Block label={t("lidarr.queued")} />
<Block label={t("lidarr.albums")} />
</Widget>
);
}
const have = albumsData.filter((album) => album.statistics.percentOfTracks === 100);
return (
<Widget>
<Block label={t("lidarr.wanted")} value={wantedData.totalRecords} />
<Block label={t("lidarr.queued")} value={queueData.totalCount} />
<Block label={t("lidarr.albums")} value={have.length} />
</Widget>
);
}

@ -12,6 +12,7 @@ const serviceProxyHandlers = {
pihole: genericProxyHandler,
radarr: genericProxyHandler,
sonarr: genericProxyHandler,
lidarr: genericProxyHandler,
readarr: genericProxyHandler,
bazarr: genericProxyHandler,
speedtest: genericProxyHandler,

@ -14,6 +14,7 @@ const formats = {
overseerr: `{url}/api/v1/{endpoint}`,
ombi: `{url}/api/v1/{endpoint}`,
npm: `{url}/api/{endpoint}`,
lidarr: `{url}/api/v1/{endpoint}?apikey={key}`,
readarr: `{url}/api/v1/{endpoint}?apikey={key}`,
bazarr: `{url}/api/{endpoint}/wanted?apikey={key}`,
sabnzbd: `{url}/api/?apikey={key}&output=json&mode={endpoint}`,

Loading…
Cancel
Save