diff --git a/src/custom-formats.ts b/src/custom-formats.ts index 3af2b13..17792cf 100644 --- a/src/custom-formats.ts +++ b/src/custom-formats.ts @@ -51,13 +51,14 @@ export const manageCf = async (cfProcessing: CFProcessing, serverCfs: Map 0) { + logger.info(`Updated Recyclarr repo.`); + } + } + + logger.info(`Recyclarr repo on '${result.current}'`); }; export const getLocalTemplatePath = () => { diff --git a/src/trash-guide.ts b/src/trash-guide.ts index 7878c53..445be75 100644 --- a/src/trash-guide.ts +++ b/src/trash-guide.ts @@ -20,6 +20,7 @@ const DEFAULT_TRASH_GIT_URL = "https://github.com/TRaSH-Guides/Guides"; export const cloneTrashRepo = async () => { const rootPath = trashRepoPaths.root; + logger.info(`Checking TrashGuide repo (${rootPath})`); if (!fs.existsSync(rootPath)) { fs.mkdirSync(rootPath, { recursive: true }); @@ -34,9 +35,17 @@ export const cloneTrashRepo = async () => { await simpleGit().clone(applicationConfig.trashGuideUrl ?? DEFAULT_TRASH_GIT_URL, rootPath); } - await gitClient.checkout(applicationConfig.trashRevision ?? "master"); + await gitClient.checkout(applicationConfig.trashRevision ?? "master", ["-f"]); + const result = await gitClient.status(); - logger.info(`Updating TrashGuide repo`); + if (!result.detached) { + const res = await gitClient.pull(); + if (res.files.length > 0) { + logger.info(`Updated TrashGuide repo.`); + } + } + + logger.info(`TrashGuide repo on '${result.current}'`); }; export const loadSonarrTrashCFs = async (arrType: ArrType): Promise => { diff --git a/src/util.ts b/src/util.ts index 5b71bab..ade9ad6 100644 --- a/src/util.ts +++ b/src/util.ts @@ -23,7 +23,6 @@ const recyclarrRadarrQPs = `${recyclarrRadarrRoot}/includes/quality-profiles`; const trashRepoPath = "docs/json"; const trashRepoRoot = `${repoPath}/trash-guides`; const trashRepoSonarrRoot = `${trashRepoRoot}/${trashRepoPath}/sonarr`; - const trashRepoRadarrRoot = `${trashRepoRoot}/${trashRepoPath}/radarr`; export const trashRepoPaths = { @@ -162,23 +161,23 @@ export function compareObjectsCarr(object1: any, object2: any): { equal: boolean } if (!isEqual && changes.length <= 0) { - changes.push(`Mismatch found in array element at index ${i} for key ${key}`); + changes.push(`Mismatch found in array element at index ${i} for key '${key}'`); } } } else if (typeof value2 === "object" && value2 !== null) { if (typeof value1 !== "object" || value1 === null) { - changes.push(`Expected object for key ${key} in object1`); + changes.push(`Expected object for key '${key}' in object1`); continue; } const { equal: isEqual, changes: subChanges } = compareObjectsCarr(value1, value2); changes.push(...subChanges.map((subChange) => `${key}.${subChange}`)); if (!isEqual) { - changes.push(`Mismatch found for key ${key}`); + changes.push(`Mismatch found for key '${key}'`); } } else { if (value1 !== value2) { - changes.push(`Mismatch found for key ${key}: server value ${value1}, value to set ${value2}`); + changes.push(`Mismatch found for key '${key}': server value '${value1}', value to set '${value2}'`); } } } else {