From 6250164656e3865fba1ccb64c5c96ad822d1fcf2 Mon Sep 17 00:00:00 2001 From: Lars Behrends Date: Sun, 12 Apr 2026 02:57:34 +0200 Subject: [PATCH] Add updateExisting option to importers & UI Introduce an updateExisting flag across importers and the Importer UI to control whether existing items should be updated or only new items imported. Changes: added updateExisting to XBVR, StashAPP, Playnite, and Jellyfin config types; added checkboxes in ImporterView (enabled by default) to toggle the behavior; import logic now skips existing items when updateExisting is false and logs/skips appropriately (XBVR, StashAPP, Playnite, Jellyfin). Also: minor Playnite env parsing tweak for port (undefined when not provided) and small logging/cleanup in the Jellyfin album handling. --- src/components/ImporterView.tsx | 57 ++++++++++++++++++++++++++++++--- src/lib/jellyfinImporter.ts | 31 ++++++++++++------ src/lib/playniteImporter.ts | 10 ++++++ src/lib/stashappImporter.ts | 14 +++++--- src/lib/xbvrImporter.ts | 14 +++++--- 5 files changed, 101 insertions(+), 25 deletions(-) diff --git a/src/components/ImporterView.tsx b/src/components/ImporterView.tsx index 646d5b8..e662e80 100644 --- a/src/components/ImporterView.tsx +++ b/src/components/ImporterView.tsx @@ -13,15 +13,17 @@ const BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:3000'; export default function ImporterView() { const navigate = useNavigate(); - const [xbvrConfig, setXbvrConfig] = useState({ url: import.meta.env.VITE_XBVR_URL || BASE_URL }); + const [xbvrConfig, setXbvrConfig] = useState({ url: import.meta.env.VITE_XBVR_URL || BASE_URL, updateExisting: true }); const [stashappConfig, setStashappConfig] = useState({ url: import.meta.env.VITE_STASHAPP_URL || '', - apiKey: import.meta.env.VITE_STASHAPP_API_KEY || '' + apiKey: import.meta.env.VITE_STASHAPP_API_KEY || '', + updateExisting: true }); const [playniteConfig, setPlayniteConfig] = useState({ ip: import.meta.env.VITE_PLAYNITE_IP || '', - apiToken: import.meta.env.VITE_PLAYNITE_API_TOKEN || '', - port: parseInt(import.meta.env.VITE_PLAYNITE_PORT || '19821') + apiToken: import.meta.env.VITE_PLAYNITE_API_TOKEN || '', + port: import.meta.env.VITE_PLAYNITE_PORT ? parseInt(import.meta.env.VITE_PLAYNITE_PORT) : undefined, + updateExisting: true }); const [jellyfinConfig, setJellyfinConfig] = useState({ url: import.meta.env.VITE_JELLYFIN_URL || '', @@ -33,7 +35,8 @@ export default function ImporterView() { importMusic: true, importCast: true, limit: undefined, - libraryMappings: [] + libraryMappings: [], + updateExisting: true }); const [jellyfinLibraries, setJellyfinLibraries] = useState>([]); const [libraryMappings, setLibraryMappings] = useState([]); @@ -396,6 +399,17 @@ export default function ImporterView() { placeholder="http://192.168.1.102:10001" /> +
+ setXbvrConfig({ ...xbvrConfig, updateExisting: e.target.checked })} + disabled={progress.stage !== 'idle'} + className="rounded border-border" + /> + +