diff --git a/couchpotato/core/downloaders/blackhole/__init__.py b/couchpotato/core/downloaders/blackhole/__init__.py index 290e8d43..6b5279a1 100644 --- a/couchpotato/core/downloaders/blackhole/__init__.py +++ b/couchpotato/core/downloaders/blackhole/__init__.py @@ -35,6 +35,13 @@ config = [{ 'type': 'dropdown', 'values': [('usenet & torrents', 'both'), ('usenet', 'nzb'), ('torrent', 'torrent')], }, + { + 'name': 'create_subdir', + 'default': 0, + 'type': 'bool', + 'advanced': True, + 'description': 'Create a sub directory when saving the .nzb (or .torrent).', + }, { 'name': 'manual', 'default': 0, diff --git a/couchpotato/core/downloaders/blackhole/main.py b/couchpotato/core/downloaders/blackhole/main.py index 9a5a6217..e3e070cc 100644 --- a/couchpotato/core/downloaders/blackhole/main.py +++ b/couchpotato/core/downloaders/blackhole/main.py @@ -35,6 +35,15 @@ class Blackhole(Downloader): fullPath = os.path.join(directory, self.createFileName(data, filedata, movie)) + if self.conf('create_subdir'): + try: + new_path = os.path.splitext(fullPath)[0] + if not os.path.exists(new_path): + os.makedirs(new_path) + fullPath = os.path.join(new_path, self.createFileName(data, filedata, movie)) + except: + log.error('Couldnt create sub dir, reverting to old one: %s', fullPath) + try: if not os.path.isfile(fullPath): log.info('Downloading %s to %s.', (data.get('protocol'), fullPath))