Skip to content

Commit

Permalink
feat: add more purge tmdb actions (#1149)
Browse files Browse the repository at this point in the history
Added a new purge tmdb movie collections action and a new purge tmdb show alternate orderigns action. Also fixed some typos and grammar in the existing tmdb actions. I don't like how the actions are added to the list, but i also don't feel like writing it better, so it is what it is.
  • Loading branch information
revam authored Dec 3, 2024
1 parent 925389c commit 3a0e34c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
23 changes: 17 additions & 6 deletions src/components/Dialogs/ActionsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ const actions = {
'purge-all-tvdb-info',
],
},
moviedb: {
tmdb: {
title: 'TMDB',
data: [
'update-all-tmdb-shows',
'delete-ununsed-tmdb-shows',
'delete-unused-tmdb-shows',
'update-all-tmdb-movies',
'delete-ununsed-tmdb-movies',
'delete-unused-tmdb-movies',
],
},
shoko: {
Expand Down Expand Up @@ -124,10 +124,21 @@ function ActionsModal({ onClose, show }: Props) {
const [activeTab, setActiveTab] = useState('import');

const isRepairTmdbPeopleSupported = useIsFeatureSupported(FeatureType.RepairTmdbPeopleAction);
const isPurgeMovieCollectionAndAlternateOrderingActionsSupported = useIsFeatureSupported(
FeatureType.PurgeMovieCollectionAndAlternateOrderingActions,
);
useEffect(() => {
const action = 'download-missing-tmdb-people';
if (isRepairTmdbPeopleSupported && !actions.moviedb.data.includes(action)) actions.moviedb.data.push(action);
}, [isRepairTmdbPeopleSupported]);
const action0 = 'download-missing-tmdb-people';
if (isRepairTmdbPeopleSupported && !actions.tmdb.data.includes(action0)) actions.tmdb.data.push(action0);
const action1 = 'purge-tmdb-movie-collections';
const action2 = 'purge-tmdb-show-alternate-orderings';
if (isPurgeMovieCollectionAndAlternateOrderingActionsSupported && !actions.tmdb.data.includes(action1)) {
actions.tmdb.data.push(action1);
}
if (isPurgeMovieCollectionAndAlternateOrderingActionsSupported && !actions.tmdb.data.includes(action2)) {
actions.tmdb.data.push(action2);
}
}, [isRepairTmdbPeopleSupported, isPurgeMovieCollectionAndAlternateOrderingActionsSupported]);

return (
<ModalPanel
Expand Down
21 changes: 16 additions & 5 deletions src/core/quick-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,31 @@ const quickActions = {
functionName: 'UpdateAllTmdbShows',
info: 'Updates all TMDB Shows in the local database.',
},
'delete-ununsed-tmdb-movies': {
'delete-unused-tmdb-movies': {
name: 'Delete Unused TMDB Movies',
functionName: 'PurgeAllUnusedTmdbMovies',
info: 'Delete all unused TMDB Movies that are not linked to any AniDB anime.',
info: 'Deletes all unused TMDB Movies that are not linked to any AniDB anime.',
},
'delete-ununsed-tmdb-shows': {
'delete-unused-tmdb-shows': {
name: 'Delete Unused TMDB Shows',
functionName: 'PurgeAllUnusedTmdbShows',
info: 'Delete all unused TMDB Shows that are not linked to any AniDB anime.',
info: 'Deletes all unused TMDB Shows that are not linked to any AniDB anime.',
},
'download-missing-tmdb-people': {
name: 'Download Missing TMDB People',
functionName: 'DownloadMissingTmdbPeople',
info: 'Downloads any Tmdb People missing in the local database.',
info: 'Downloads any TMDB People missing in the local database.',
},
'purge-tmdb-movie-collections': {
name: 'Delete All TMDB Movie Collections',
functionName: 'PurgeAllTmdbMovieCollections',
info:
'Deletes all TMDB Movie Collections stored in the local database, and removes any images associated with them.',
},
'purge-tmdb-show-alternate-orderings': {
name: 'Delete All TMDB Show Alternate Orderings',
functionName: 'PurgeAllTmdbShowAlternateOrderings',
info: 'Deletes all TMDB Show Alternate Orderings stored in the local database.',
},
'plex-sync-all': {
name: 'Sync Plex Watch Status',
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useIsFeatureSupported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { VersionType } from '@/core/types/api/init';
export enum FeatureType {
UnairedEpisodeFilter = '5.0.0.18',
RepairTmdbPeopleAction = '5.0.0.61',
PurgeMovieCollectionAndAlternateOrderingActions = '5.0.0.76',
}

const useIsFeatureSupported = (feature: FeatureType) => {
Expand Down

0 comments on commit 3a0e34c

Please sign in to comment.