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). 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"]`. Allowed fields: `["downloads", "videos", "channels", "playlists"]`.
@ -13,5 +13,5 @@ Allowed fields: `["downloads", "videos", "channels", "playlists"]`.
widget: widget:
type: tubearchivist type: tubearchivist
url: http://tubearchivist.host.or.ip url: http://tubearchivist.host.or.ip
key: apikeyapikeyapikeyapikeyapikey key: tubearchivistapikey
``` ```

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

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

Loading…
Cancel
Save