diff --git a/bazarr/api.py b/bazarr/api.py index 1f8494c6c..5143ec859 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -716,6 +716,15 @@ class Series(Resource): list_missing_subtitles(no=seriesId, send_event=False) event_stream(type='series', payload=seriesId) + + episode_id_list = TableEpisodes\ + .select(TableEpisodes.sonarrEpisodeId)\ + .where(TableEpisodes.sonarrSeriesId == seriesId)\ + .dicts() + + for item in episode_id_list: + event_stream(type='episode-wanted', payload=item['sonarrEpisodeId']) + event_stream(type='badges') return '', 204 @@ -963,6 +972,7 @@ class Movies(Resource): list_missing_subtitles_movies(no=radarrId, send_event=False) event_stream(type='movie', payload=radarrId) + event_stream(type='movie-wanted', payload=radarrId) event_stream(type='badges') return '', 204 diff --git a/frontend/src/@redux/hooks/index.ts b/frontend/src/@redux/hooks/index.ts index 364871a4f..ac15d5b21 100644 --- a/frontend/src/@redux/hooks/index.ts +++ b/frontend/src/@redux/hooks/index.ts @@ -5,13 +5,11 @@ import { episodeDeleteItems, episodeUpdateBy, episodeUpdateById, - movieDeleteWantedItems, movieUpdateBlacklist, movieUpdateHistoryList, movieUpdateList, movieUpdateWantedList, providerUpdateList, - seriesDeleteWantedItems, seriesUpdateBlacklist, seriesUpdateHistoryList, seriesUpdateList, @@ -324,18 +322,6 @@ export function useWantedSeries() { const update = useReduxAction(seriesUpdateWantedList); const items = useReduxStore((d) => d.series.wantedEpisodesList); - const updateAction = useWrapToOptionalId(update); - const deleteAction = useReduxAction(seriesDeleteWantedItems); - const reducer = useMemo( - () => ({ - key: "episode-wanted", - update: updateAction, - delete: deleteAction, - }), - [updateAction, deleteAction] - ); - useSocketIOReducer(reducer); - return stateBuilder(items, update); } @@ -343,18 +329,6 @@ export function useWantedMovies() { const update = useReduxAction(movieUpdateWantedList); const items = useReduxStore((d) => d.movie.wantedMovieList); - const updateAction = useWrapToOptionalId(update); - const deleteAction = useReduxAction(movieDeleteWantedItems); - const reducer = useMemo( - () => ({ - key: "movie-wanted", - update: updateAction, - delete: deleteAction, - }), - [updateAction, deleteAction] - ); - useSocketIOReducer(reducer); - return stateBuilder(items, update); } diff --git a/frontend/src/@socketio/reducer.ts b/frontend/src/@socketio/reducer.ts index 4b39a5eb2..5ea5fba94 100644 --- a/frontend/src/@socketio/reducer.ts +++ b/frontend/src/@socketio/reducer.ts @@ -3,9 +3,13 @@ import { badgeUpdateAll, bootstrap, movieDeleteItems, + movieDeleteWantedItems, movieUpdateList, + movieUpdateWantedList, seriesDeleteItems, + seriesDeleteWantedItems, seriesUpdateList, + seriesUpdateWantedList, siteAddNotifications, siteAddProgress, siteInitializationFailed, @@ -91,6 +95,24 @@ export function createDefaultReducer(): SocketIO.Reducer[] { update: bindToReduxStore(movieUpdateList), delete: bindToReduxStore(movieDeleteItems), }, + { + key: "episode-wanted", + update: (ids: number[] | undefined) => { + if (ids) { + reduxStore.dispatch(seriesUpdateWantedList(ids) as any); + } + }, + delete: bindToReduxStore(seriesDeleteWantedItems), + }, + { + key: "movie-wanted", + update: (ids: number[] | undefined) => { + if (ids) { + reduxStore.dispatch(movieUpdateWantedList(ids) as any); + } + }, + delete: bindToReduxStore(movieDeleteWantedItems), + }, { key: "settings", any: bindToReduxStore(systemUpdateSettings),