Implement manual metadata refresh

This commit is contained in:
Zoe Roux
2026-03-27 17:46:55 +01:00
parent 59187a024b
commit 93bc58a2d0
6 changed files with 122 additions and 29 deletions
+17 -16
View File
@@ -1,11 +1,12 @@
// import Download from "@material-symbols/svg-400/rounded/download.svg";
import Refresh from "@material-symbols/svg-400/rounded/autorenew.svg";
import Info from "@material-symbols/svg-400/rounded/info.svg";
import MoreVert from "@material-symbols/svg-400/rounded/more_vert.svg";
import MovieInfo from "@material-symbols/svg-400/rounded/movie_info.svg";
import type { ComponentProps } from "react";
import { useTranslation } from "react-i18next";
import { WatchStatusV } from "~/models";
import { IconButton, Menu, tooltip } from "~/primitives";
import { HR, IconButton, Menu, tooltip } from "~/primitives";
import { useAccount } from "~/providers/account-context";
import { useMutation } from "~/query";
import { cn } from "~/utils";
@@ -89,11 +90,11 @@ export const ItemContext = ({
invalidate: [kind, slug],
});
// const metadataRefreshMutation = useMutation({
// method: "POST",
// path: [kind, slug, "refresh"],
// invalidate: null,
// });
const metadataRefreshMutation = useMutation({
method: "POST",
path: ["scanner", `${kind}s`, slug, "refresh"],
invalidate: null,
});
return (
<Menu
@@ -139,16 +140,16 @@ export const ItemContext = ({
/>
</>
)}
{/* {account?.isAdmin === true && ( */}
{/* <> */}
{/* <HR /> */}
{/* <Menu.Item */}
{/* label={t("home.refreshMetadata")} */}
{/* icon={Refresh} */}
{/* onSelect={() => metadataRefreshMutation.mutate()} */}
{/* /> */}
{/* </> */}
{/* )} */}
{account?.isAdmin === true && (
<>
<HR />
<Menu.Item
label={t("home.refreshMetadata")}
icon={Refresh}
onSelect={() => metadataRefreshMutation.mutate()}
/>
</>
)}
</Menu>
);
};
+13 -10
View File
@@ -1,3 +1,4 @@
import Refresh from "@material-symbols/svg-400/rounded/autorenew.svg";
import BookmarkAdd from "@material-symbols/svg-400/rounded/bookmark_add.svg";
import Delete from "@material-symbols/svg-400/rounded/delete.svg";
import MoreHoriz from "@material-symbols/svg-400/rounded/more_horiz.svg";
@@ -83,11 +84,11 @@ const ButtonList = ({
invalidate: ["api", "shows"],
});
// const metadataRefreshMutation = useMutation({
// method: "POST",
// path: [kind, slug, "refresh"],
// invalidate: null,
// });
const metadataRefreshMutation = useMutation({
method: "POST",
path: ["scanner", `${kind}s`, slug, "refresh"],
invalidate: null,
});
return (
<View className="flex-row items-center justify-center">
@@ -163,6 +164,13 @@ const ButtonList = ({
href={`/${kind === "movie" ? "movies" : "series"}/${slug}/videos`}
/>
{kind !== "collection" && <HR />}
{kind !== "collection" && (
<Menu.Item
label={t("home.refreshMetadata")}
icon={Refresh}
onSelect={() => metadataRefreshMutation.mutate()}
/>
)}
<Menu.Item
label={t("misc.delete")}
icon={Delete}
@@ -185,11 +193,6 @@ const ButtonList = ({
);
}}
/>
{/* <Menu.Item */}
{/* label={t("home.refreshMetadata")} */}
{/* icon={Refresh} */}
{/* onSelect={() => metadataRefreshMutation.mutate()} */}
{/* /> */}
</>
)}
</Menu>
+1 -1
View File
@@ -126,7 +126,7 @@ export const VideoMenu = ({
key={x.id}
label={getDisplayName({ title: x.label, language: x.language })}
selected={x.selected}
onSelect={() => player.selectAudioTrack(x)}
onSelect={() => player.selectVideoTrack(x)}
/>
))}
</Menu>