Implement episode metadata management: add functionality to refresh episode metadata from external sources, including new API endpoints and UI integration. Enhance Show and Episode models to support additional metadata fields, and update database schema accordingly. Update ShowDetail and ShowMetadataCard components to display refreshed episode information and provide user feedback on metadata updates.

This commit is contained in:
Leonid Pershin
2026-07-25 09:46:19 +03:00
parent 0d2dee815e
commit 7fb46b5e0d
30 changed files with 1563 additions and 81 deletions
@@ -13,6 +13,7 @@ import {
applyMetadata,
clearMetadata,
getMetadataProviders,
refreshEpisodesMetadata,
searchMetadata,
showPosterUrl,
updateMetadata,
@@ -83,6 +84,17 @@ export function ShowMetadataCard({ show, onChanged }: { show: ShowDto; onChanged
onSuccess: changed,
onError,
})
const refreshEpisodes = useMutation({
mutationFn: () => refreshEpisodesMetadata(show.id),
onSuccess: (count) => {
toast.success(t('admin.metadata.refreshedCount', { count }))
onChanged()
},
onError,
})
const linked =
!!show.metadataExternalId && !!show.metadataProvider && show.metadataProvider !== 'manual'
return (
<Card>
@@ -209,10 +221,22 @@ export function ShowMetadataCard({ show, onChanged }: { show: ShowDto; onChanged
/>
</div>
</div>
<div className="flex items-center gap-2">
<div className="flex flex-wrap items-center gap-2">
<Button size="sm" disabled={saveManual.isPending} onClick={() => saveManual.mutate()}>
{t('common.save')}
</Button>
{linked && (
<Button
size="sm"
variant="outline"
disabled={refreshEpisodes.isPending}
onClick={() => refreshEpisodes.mutate()}
>
{refreshEpisodes.isPending
? t('admin.metadata.refreshing')
: t('admin.metadata.refreshEpisodes')}
</Button>
)}
{(show.metadataProvider || show.hasPoster) && (
<Button
size="sm"