From 95c2e992b0d369af59a59f5a8c63a13ba2dce9c4 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 19 Dec 2012 11:11:12 +0100 Subject: [PATCH] Use trailer naming from settings. closes #936 --- couchpotato/core/plugins/renamer/__init__.py | 7 ------- couchpotato/core/plugins/trailer/__init__.py | 7 +++++++ couchpotato/core/plugins/trailer/main.py | 9 +++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/couchpotato/core/plugins/renamer/__init__.py b/couchpotato/core/plugins/renamer/__init__.py index e2c65edb..88989695 100644 --- a/couchpotato/core/plugins/renamer/__init__.py +++ b/couchpotato/core/plugins/renamer/__init__.py @@ -133,13 +133,6 @@ config = [{ 'type': 'choice', 'options': rename_options }, - { - 'name': 'trailer_name', - 'label': 'Trailer naming', - 'default': '-trailer.', - 'type': 'choice', - 'options': rename_options - }, ], }, ], diff --git a/couchpotato/core/plugins/trailer/__init__.py b/couchpotato/core/plugins/trailer/__init__.py index f3aa59de..282b3482 100644 --- a/couchpotato/core/plugins/trailer/__init__.py +++ b/couchpotato/core/plugins/trailer/__init__.py @@ -24,6 +24,13 @@ config = [{ 'type': 'dropdown', 'values': [('1080P', '1080p'), ('720P', '720p'), ('480P', '480p')], }, + { + 'name': 'name', + 'label': 'Naming', + 'default': '-trailer', + 'advanced': True, + 'description': 'Use to use above settings.' + }, ], }, ], diff --git a/couchpotato/core/plugins/trailer/main.py b/couchpotato/core/plugins/trailer/main.py index 9a322658..4ab51e78 100644 --- a/couchpotato/core/plugins/trailer/main.py +++ b/couchpotato/core/plugins/trailer/main.py @@ -19,10 +19,11 @@ class Trailer(Plugin): trailers = fireEvent('trailer.search', group = group, merge = True) if not trailers or trailers == []: log.info('No trailers found for: %s', getTitle(group['library'])) - return + return False for trailer in trailers.get(self.conf('quality'), []): - destination = '%s-trailer.%s' % (self.getRootName(group), getExt(trailer)) + filename = self.conf('name').replace('', group['filename']) + ('.%s' % getExt(trailer)) + destination = os.path.join(group['destination_dir'], filename) if not os.path.isfile(destination): fireEvent('file.download', url = trailer, dest = destination, urlopen_kwargs = {'headers': {'User-Agent': 'Quicktime'}}, single = True) else: @@ -33,5 +34,5 @@ class Trailer(Plugin): # Download first and break break - def getRootName(self, data = {}): - return os.path.join(data['destination_dir'], data['filename']) + return True +