diff --git a/TorrentToMedia.py b/TorrentToMedia.py index a5758aa6..94d15b39 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -40,8 +40,13 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): for category in categories: if category == inputCategory: - outputDestination = os.path.normpath(os.path.join(outputDirectory, category, safeName(inputName))) - Logger.info("MAIN: Output directory set to: %s", outputDestination) + if os.path.basename(inputDirectory) == inputName: + Logger.info("MAIN: Download is a directory") + outputDestination = os.path.normpath(os.path.join(outputDirectory, category, safeName(inputName))) + else: + Logger.info("MAIN: Download is not a directory") + outputDestination = os.path.normpath(os.path.join(outputDirectory, category, os.path.splitext(safeName(inputName))[0])) + Logger.info("MAIN: Output directory set to: %s", outputDestination) break else: continue diff --git a/autoProcess/nzbToMediaUtil.py b/autoProcess/nzbToMediaUtil.py index e81b4537..0ce52b52 100644 --- a/autoProcess/nzbToMediaUtil.py +++ b/autoProcess/nzbToMediaUtil.py @@ -149,6 +149,10 @@ def is_sample(filePath, inputName, minSampleSize): def copy_link(filePath, targetDirectory, useLink, outputDestination): + if os.path.isfile(targetDirectory): + Logger.info("COPYLINK: target file already exists. Nothing to be done") + return True + create_destination(outputDestination) if useLink == "hard": try: diff --git a/changelog.txt b/changelog.txt index 4bc3d834..5ae626b6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ Impacts Torrents Don't include 720p or 1080p as parts for extracting. Extracts all sub-folders. Added option to Move files. +Fix for single file torrents linked to subfolder of same name. Impacts All Added option for SickBeard delay (for forks that use 1 minute check.