diff --git a/apps/mirrarr/src/index.ts b/apps/mirrarr/src/index.ts index 9cb0ece..2600868 100644 --- a/apps/mirrarr/src/index.ts +++ b/apps/mirrarr/src/index.ts @@ -29,7 +29,15 @@ export const mirrarr = async (args: MirrarrArgs) => { logger.info('================= Staring =================') try { - const { chmod, destination, pgid, puid, radarrApiKey, radarrUrl } = args + const { + chmod, + destination: destinationRaw, + pgid, + puid, + radarrApiKey, + radarrUrl, + } = args + const destination = destinationRaw.replace(/\/$/, '') const radarr: Radarr = new Radarr({ apiKey: radarrApiKey, @@ -74,10 +82,7 @@ export const mirrarr = async (args: MirrarrArgs) => { for (const [mirroredFolder, moviePaths] of Object.entries( mirroredFolderAndMoviePaths, )) { - const destinationDir = `${destination.replace( - /\/$/, - '', - )}/${mirroredFolder}` + const destinationDir = `${destination}/${mirroredFolder}` // create missing directory if (createDirectoryIfNotExists(destinationDir, permissions)) { @@ -111,10 +116,9 @@ export const mirrarr = async (args: MirrarrArgs) => { } } - // remove old folders - const removedDirs: string[] = removeFromDirNotInList( - destination, - destinationDirs, + // remove old lists & tags that no longer exists + const removedDirs: string[] = ['lists', 'tags'].flatMap((dir) => + removeFromDirNotInList(`${destination}/${dir}`, destinationDirs), ) for (const removedDir of removedDirs) { diff --git a/package-lock.json b/package-lock.json index 8b2f698..bcfa69b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@arr-scripts/arr-scripts", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@arr-scripts/arr-scripts", - "version": "1.0.1", + "version": "1.0.2", "license": "SEE LICENSE", "workspaces": [ "apps/*", diff --git a/package.json b/package.json index 395a32c..fc94bfe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@arr-scripts/arr-scripts", - "version": "1.0.1", + "version": "1.0.2", "author": "Nicholas O'Donnell ", "license": "SEE LICENSE", "private": true,