mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-06 23:33:41 +01:00
Add Lidarr widget
This commit is contained in:
parent
15a8c4f0d7
commit
1f2639fbb5
@ -80,6 +80,11 @@
|
|||||||
"queued": "Queued",
|
"queued": "Queued",
|
||||||
"movies": "Movies"
|
"movies": "Movies"
|
||||||
},
|
},
|
||||||
|
"lidarr": {
|
||||||
|
"wanted": "Wanted",
|
||||||
|
"queued": "Queued",
|
||||||
|
"albums": "Albums"
|
||||||
|
},
|
||||||
"readarr": {
|
"readarr": {
|
||||||
"wanted": "Wanted",
|
"wanted": "Wanted",
|
||||||
"queued": "Queued",
|
"queued": "Queued",
|
||||||
|
@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
|
|
||||||
import Sonarr from "./widgets/service/sonarr";
|
import Sonarr from "./widgets/service/sonarr";
|
||||||
import Radarr from "./widgets/service/radarr";
|
import Radarr from "./widgets/service/radarr";
|
||||||
|
import Lidarr from "./widgets/service/lidarr";
|
||||||
import Readarr from "./widgets/service/readarr";
|
import Readarr from "./widgets/service/readarr";
|
||||||
import Ombi from "./widgets/service/ombi";
|
import Ombi from "./widgets/service/ombi";
|
||||||
import Portainer from "./widgets/service/portainer";
|
import Portainer from "./widgets/service/portainer";
|
||||||
@ -28,6 +29,7 @@ const widgetMappings = {
|
|||||||
docker: Docker,
|
docker: Docker,
|
||||||
sonarr: Sonarr,
|
sonarr: Sonarr,
|
||||||
radarr: Radarr,
|
radarr: Radarr,
|
||||||
|
lidarr: Lidarr,
|
||||||
readarr: Readarr,
|
readarr: Readarr,
|
||||||
ombi: Ombi,
|
ombi: Ombi,
|
||||||
portainer: Portainer,
|
portainer: Portainer,
|
||||||
|
41
src/components/services/widgets/service/lidarr.jsx
Normal file
41
src/components/services/widgets/service/lidarr.jsx
Normal file
@ -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.trackFileCount > 0);
|
||||||
|
|
||||||
|
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,
|
pihole: genericProxyHandler,
|
||||||
radarr: genericProxyHandler,
|
radarr: genericProxyHandler,
|
||||||
sonarr: genericProxyHandler,
|
sonarr: genericProxyHandler,
|
||||||
|
lidarr: genericProxyHandler,
|
||||||
readarr: genericProxyHandler,
|
readarr: genericProxyHandler,
|
||||||
speedtest: genericProxyHandler,
|
speedtest: genericProxyHandler,
|
||||||
tautulli: genericProxyHandler,
|
tautulli: genericProxyHandler,
|
||||||
|
@ -14,6 +14,7 @@ const formats = {
|
|||||||
overseerr: `{url}/api/v1/{endpoint}`,
|
overseerr: `{url}/api/v1/{endpoint}`,
|
||||||
ombi: `{url}/api/v1/{endpoint}`,
|
ombi: `{url}/api/v1/{endpoint}`,
|
||||||
npm: `{url}/api/{endpoint}`,
|
npm: `{url}/api/{endpoint}`,
|
||||||
|
lidarr: `{url}/api/v1/{endpoint}?apikey={key}`,
|
||||||
readarr: `{url}/api/v1/{endpoint}?apikey={key}`,
|
readarr: `{url}/api/v1/{endpoint}?apikey={key}`,
|
||||||
sabnzbd: `{url}/api/?apikey={key}&output=json&mode={endpoint}`,
|
sabnzbd: `{url}/api/?apikey={key}&output=json&mode={endpoint}`,
|
||||||
coinmarketcap: `https://pro-api.coinmarketcap.com/{endpoint}`,
|
coinmarketcap: `https://pro-api.coinmarketcap.com/{endpoint}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user