Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions apps/mirrarr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arr-scripts/arr-scripts",
"version": "1.0.1",
"version": "1.0.2",
"author": "Nicholas O'Donnell <nicholas@nicholasodonnell.com>",
"license": "SEE LICENSE",
"private": true,
Expand Down