From 3afbf0c6a976e630a678afd5da627b2651ddfdbb Mon Sep 17 00:00:00 2001 From: Dion Woolley Date: Sat, 13 Aug 2016 21:59:10 +1200 Subject: [PATCH] Fix path redeclaration in local scope --- dcplusplusreleaseannouncer.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dcplusplusreleaseannouncer.js b/dcplusplusreleaseannouncer.js index e53a121..b9590c0 100755 --- a/dcplusplusreleaseannouncer.js +++ b/dcplusplusreleaseannouncer.js @@ -134,7 +134,7 @@ function prepareRelease() { } (function announce() { - let path, + let releasePath, airDate; if (!config || !config.address || !config.port) { @@ -144,7 +144,7 @@ function prepareRelease() { if (process.env.sonarr_episodefile_path) { console.info("Detected Sonarr environment variables"); - path = process.env.sonarr_episodefile_path; + releasePath = process.env.sonarr_episodefile_path; if (process.env.sonarr_episodefile_episodeairdatesutc) { airDate = chrono.parseDate(process.env.sonarr_episodefile_episodeairdatesutc).toISOString(); } @@ -153,16 +153,16 @@ function prepareRelease() { } } else { - path = process.argv[2]; + releasePath = process.argv[2]; airDate = process.argv[3]; } - if (path == null || airDate == null) { - console.error('problem with script arguments, path: ' + path + ' airDate: ' + airDate); + if (releasePath == null || airDate == null) { + console.error('problem with script arguments, path: ' + releasePath + ' airDate: ' + airDate); return; } - release.filePath = path.normalize(path); + release.filePath = path.normalize(releasePath); release.fileSize = parseInt(fs.statSync(release.filePath).size); release.airDate = Date.parse(airDate); release.name = encodeURIComponent(path.basename(release.filePath));