Enhancement: use tubearchivist stats endpoints (#3814)

pull/3815/head
shamoon 4 months ago
parent 0d6aabc737
commit 8fba3eee1d

@ -5,7 +5,7 @@ description: Tube Archivist Widget Configuration
Learn more about [Tube Archivist](https://github.com/tubearchivist/tubearchivist).
Requires API key.
You must be running at least version 0.4.4
Allowed fields: `["downloads", "videos", "channels", "playlists"]`.
@ -13,5 +13,5 @@ Allowed fields: `["downloads", "videos", "channels", "playlists"]`.
widget:
type: tubearchivist
url: http://tubearchivist.host.or.ip
key: apikeyapikeyapikeyapikeyapikey
key: tubearchivistapikey
```

@ -32,16 +32,10 @@ export default function Component({ service }) {
return (
<Container service={service}>
<Block
label="tubearchivist.downloads"
value={t("common.number", { value: downloadsData?.paginate?.total_hits })}
/>
<Block label="tubearchivist.videos" value={t("common.number", { value: videosData?.paginate?.total_hits })} />
<Block label="tubearchivist.channels" value={t("common.number", { value: channelsData?.paginate?.total_hits })} />
<Block
label="tubearchivist.playlists"
value={t("common.number", { value: playlistsData?.paginate?.total_hits })}
/>
<Block label="tubearchivist.downloads" value={t("common.number", { value: downloadsData.pending ?? 0 })} />
<Block label="tubearchivist.videos" value={t("common.number", { value: videosData.doc_count ?? 0 })} />
<Block label="tubearchivist.channels" value={t("common.number", { value: channelsData.doc_count ?? 0 })} />
<Block label="tubearchivist.playlists" value={t("common.number", { value: playlistsData.doc_count ?? 0 })} />
</Container>
);
}

@ -6,20 +6,23 @@ const widget = {
mappings: {
downloads: {
endpoint: "download",
validate: ["paginate"],
endpoint: "stats/download",
validate: ["pending"],
},
videos: {
endpoint: "video",
validate: ["paginate"],
endpoint: "stats/video",
validate: ["doc_count"],
},
channels: {
endpoint: "channel",
validate: ["paginate"],
endpoint: "stats/channel",
validate: ["doc_count"],
},
playlists: {
endpoint: "playlist",
validate: ["paginate"],
endpoint: "stats/playlist",
validate: ["doc_count"],
},
stats: {
endpoint: "stats",
},
},
};

Loading…
Cancel
Save