diff --git a/frontend/src/api/actions/queueReindex.ts b/frontend/src/api/actions/queueReindex.ts index 18a611a1..9038e400 100644 --- a/frontend/src/api/actions/queueReindex.ts +++ b/frontend/src/api/actions/queueReindex.ts @@ -8,7 +8,7 @@ export const ReindexTypeEnum = { playlist: 'playlist', }; -const queueReindex = async (id: string, type: ReindexType, reindexVideos = false) => { +const queueReindex = async (id: string[], type: ReindexType, reindexVideos = false) => { let params = ''; if (reindexVideos) { params = '?extract_videos=true'; @@ -16,7 +16,7 @@ const queueReindex = async (id: string, type: ReindexType, reindexVideos = false return APIClient(`/api/refresh/${params}`, { method: 'POST', - body: { [type]: [id] }, + body: { [type]: id }, }); }; diff --git a/frontend/src/components/Filterbar.tsx b/frontend/src/components/Filterbar.tsx index 24bc0999..0c9788d6 100644 --- a/frontend/src/components/Filterbar.tsx +++ b/frontend/src/components/Filterbar.tsx @@ -22,6 +22,9 @@ import { useVideoSelectionStore } from '../stores/VideoSelectionStore'; import Button from './Button'; import updateDownloadQueue from '../api/actions/updateDownloadQueue'; import { HideWatchedType } from '../configuration/constants/HideWatched'; +import queueReindex from '../api/actions/queueReindex'; +import { useOutletContext } from 'react-router-dom'; +import { ChannelBaseOutletContextType } from '../pages/ChannelAbout'; type FilterbarProps = { viewStyle: ViewStyleNamesType; @@ -49,6 +52,7 @@ const Filterbar = ({ const [showHidden, setShowHidden] = useState(false); const { filterHeight, setFilterHeight, showFilterItems, setShowFilterItems } = useFilterBarTempConf(); + const { setStartNotification } = useOutletContext() as ChannelBaseOutletContextType; const currentViewStyle = userConfig[viewStyle]; const currentHideWatched = userConfig[hideWatched]; @@ -84,11 +88,20 @@ const Filterbar = ({ }); }; + const reindexSelected = async (ids: string[]) => { + queueReindex(ids, 'video'); + if (setStartNotification !== undefined) setStartNotification(true); + }; + const actionList = [ { label: 'Redownload', handler: redownloadSelected, }, + { + label: 'Reindex', + handler: reindexSelected, + }, ]; const handleActionSelectChange = (e: React.ChangeEvent) => { diff --git a/frontend/src/pages/ChannelAbout.tsx b/frontend/src/pages/ChannelAbout.tsx index 3e966182..1e8f3c59 100644 --- a/frontend/src/pages/ChannelAbout.tsx +++ b/frontend/src/pages/ChannelAbout.tsx @@ -183,7 +183,7 @@ const ChannelAbout = () => { label="Reindex" title={`Reindex Channel ${channel.channel_name}`} onClick={async () => { - await queueReindex(channelId, ReindexTypeEnum.channel as ReindexType); + await queueReindex([channelId], ReindexTypeEnum.channel as ReindexType); setReindex(true); setStartNotification(true); @@ -194,7 +194,7 @@ const ChannelAbout = () => { title={`Reindex Videos of ${channel.channel_name}`} onClick={async () => { await queueReindex( - channelId, + [channelId], ReindexTypeEnum.channel as ReindexType, true, ); diff --git a/frontend/src/pages/Playlist.tsx b/frontend/src/pages/Playlist.tsx index 31cf00ef..818542f5 100644 --- a/frontend/src/pages/Playlist.tsx +++ b/frontend/src/pages/Playlist.tsx @@ -284,7 +284,7 @@ const Playlist = () => { onClick={async () => { setReindex(true); - await queueReindex(playlist.playlist_id, 'playlist'); + await queueReindex([playlist.playlist_id], 'playlist'); }} /> )}{' '} @@ -294,7 +294,7 @@ const Playlist = () => { onClick={async () => { setReindex(true); - await queueReindex(playlist.playlist_id, 'playlist', true); + await queueReindex([playlist.playlist_id], 'playlist', true); }} /> diff --git a/frontend/src/pages/Video.tsx b/frontend/src/pages/Video.tsx index abd1e8ef..7c105743 100644 --- a/frontend/src/pages/Video.tsx +++ b/frontend/src/pages/Video.tsx @@ -342,7 +342,7 @@ const Video = () => { label="Reindex" title={`Reindex ${video.title}`} onClick={async () => { - await queueReindex(video.youtube_id, 'video'); + await queueReindex([video.youtube_id], 'video'); setReindex(true); }} />