From 3d6ec1feba621e6af6d762f5469ec9b9a8ada373 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 24 Aug 2013 15:20:00 +0200 Subject: [PATCH 1/6] Move info providers to proper folder --- couchpotato/core/providers/{movie => info}/__init__.py | 0 .../core/providers/{movie => info}/_modifier/__init__.py | 0 couchpotato/core/providers/{movie => info}/_modifier/main.py | 0 couchpotato/core/providers/{movie => info}/base.py | 0 .../core/providers/{movie => info}/couchpotatoapi/__init__.py | 0 .../core/providers/{movie => info}/couchpotatoapi/main.py | 2 +- couchpotato/core/providers/{movie => info}/omdbapi/__init__.py | 0 couchpotato/core/providers/{movie => info}/omdbapi/main.py | 2 +- .../core/providers/{movie => info}/themoviedb/__init__.py | 0 couchpotato/core/providers/{movie => info}/themoviedb/main.py | 2 +- 10 files changed, 3 insertions(+), 3 deletions(-) rename couchpotato/core/providers/{movie => info}/__init__.py (100%) rename couchpotato/core/providers/{movie => info}/_modifier/__init__.py (100%) rename couchpotato/core/providers/{movie => info}/_modifier/main.py (100%) rename couchpotato/core/providers/{movie => info}/base.py (100%) rename couchpotato/core/providers/{movie => info}/couchpotatoapi/__init__.py (100%) rename couchpotato/core/providers/{movie => info}/couchpotatoapi/main.py (98%) rename couchpotato/core/providers/{movie => info}/omdbapi/__init__.py (100%) rename couchpotato/core/providers/{movie => info}/omdbapi/main.py (98%) rename couchpotato/core/providers/{movie => info}/themoviedb/__init__.py (100%) rename couchpotato/core/providers/{movie => info}/themoviedb/main.py (99%) diff --git a/couchpotato/core/providers/movie/__init__.py b/couchpotato/core/providers/info/__init__.py similarity index 100% rename from couchpotato/core/providers/movie/__init__.py rename to couchpotato/core/providers/info/__init__.py diff --git a/couchpotato/core/providers/movie/_modifier/__init__.py b/couchpotato/core/providers/info/_modifier/__init__.py similarity index 100% rename from couchpotato/core/providers/movie/_modifier/__init__.py rename to couchpotato/core/providers/info/_modifier/__init__.py diff --git a/couchpotato/core/providers/movie/_modifier/main.py b/couchpotato/core/providers/info/_modifier/main.py similarity index 100% rename from couchpotato/core/providers/movie/_modifier/main.py rename to couchpotato/core/providers/info/_modifier/main.py diff --git a/couchpotato/core/providers/movie/base.py b/couchpotato/core/providers/info/base.py similarity index 100% rename from couchpotato/core/providers/movie/base.py rename to couchpotato/core/providers/info/base.py diff --git a/couchpotato/core/providers/movie/couchpotatoapi/__init__.py b/couchpotato/core/providers/info/couchpotatoapi/__init__.py similarity index 100% rename from couchpotato/core/providers/movie/couchpotatoapi/__init__.py rename to couchpotato/core/providers/info/couchpotatoapi/__init__.py diff --git a/couchpotato/core/providers/movie/couchpotatoapi/main.py b/couchpotato/core/providers/info/couchpotatoapi/main.py similarity index 98% rename from couchpotato/core/providers/movie/couchpotatoapi/main.py rename to couchpotato/core/providers/info/couchpotatoapi/main.py index 9f76381a..cdbc513a 100644 --- a/couchpotato/core/providers/movie/couchpotatoapi/main.py +++ b/couchpotato/core/providers/info/couchpotatoapi/main.py @@ -1,7 +1,7 @@ from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.helpers.encoding import tryUrlencode from couchpotato.core.logger import CPLog -from couchpotato.core.providers.movie.base import MovieProvider +from couchpotato.core.providers.info.base import MovieProvider from couchpotato.environment import Env import time diff --git a/couchpotato/core/providers/movie/omdbapi/__init__.py b/couchpotato/core/providers/info/omdbapi/__init__.py similarity index 100% rename from couchpotato/core/providers/movie/omdbapi/__init__.py rename to couchpotato/core/providers/info/omdbapi/__init__.py diff --git a/couchpotato/core/providers/movie/omdbapi/main.py b/couchpotato/core/providers/info/omdbapi/main.py similarity index 98% rename from couchpotato/core/providers/movie/omdbapi/main.py rename to couchpotato/core/providers/info/omdbapi/main.py index c9f4d927..2726ef51 100755 --- a/couchpotato/core/providers/movie/omdbapi/main.py +++ b/couchpotato/core/providers/info/omdbapi/main.py @@ -2,7 +2,7 @@ from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.helpers.encoding import tryUrlencode from couchpotato.core.helpers.variable import tryInt, tryFloat, splitString from couchpotato.core.logger import CPLog -from couchpotato.core.providers.movie.base import MovieProvider +from couchpotato.core.providers.info.base import MovieProvider import json import re import traceback diff --git a/couchpotato/core/providers/movie/themoviedb/__init__.py b/couchpotato/core/providers/info/themoviedb/__init__.py similarity index 100% rename from couchpotato/core/providers/movie/themoviedb/__init__.py rename to couchpotato/core/providers/info/themoviedb/__init__.py diff --git a/couchpotato/core/providers/movie/themoviedb/main.py b/couchpotato/core/providers/info/themoviedb/main.py similarity index 99% rename from couchpotato/core/providers/movie/themoviedb/main.py rename to couchpotato/core/providers/info/themoviedb/main.py index 241fc6b0..e2ff9377 100644 --- a/couchpotato/core/providers/movie/themoviedb/main.py +++ b/couchpotato/core/providers/info/themoviedb/main.py @@ -1,7 +1,7 @@ from couchpotato.core.event import addEvent from couchpotato.core.helpers.encoding import simplifyString, toUnicode from couchpotato.core.logger import CPLog -from couchpotato.core.providers.movie.base import MovieProvider +from couchpotato.core.providers.info.base import MovieProvider from themoviedb import tmdb import traceback From 7eb1d72333f4d0d5eb1b474ad22f83105c9eb37f Mon Sep 17 00:00:00 2001 From: mano3m <-> Date: Sat, 24 Aug 2013 15:35:20 +0200 Subject: [PATCH 2/6] remove move exception from unrar PR --- couchpotato/core/plugins/renamer/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index 72850763..b73e7ddf 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -224,7 +224,7 @@ class Renamer(Plugin): if file_type is 'nfo' and not self.conf('rename_nfo'): log.debug('Skipping, renaming of %s disabled', file_type) for current_file in group['files'][file_type]: - if self.conf('cleanup') and (not (self.conf('file_action') != 'move' and self.downloadIsTorrent(download_info)) or self.fileIsAdded(current_file, group)): + if self.conf('cleanup') and (not self.downloadIsTorrent(download_info) or self.fileIsAdded(current_file, group)): remove_files.append(current_file) continue @@ -410,7 +410,7 @@ class Renamer(Plugin): log.debug('Removing leftover files') for current_file in group['files']['leftover']: if self.conf('cleanup') and not self.conf('move_leftover') and \ - (not (self.conf('file_action') != 'move' and self.downloadIsTorrent(download_info)) or self.fileIsAdded(current_file, group)): + (not self.downloadIsTorrent(download_info) or self.fileIsAdded(current_file, group)): remove_files.append(current_file) # Remove files From c13c0f24e5290ebe418f93262c8c75c87c6082cc Mon Sep 17 00:00:00 2001 From: mano3m <-> Date: Sat, 24 Aug 2013 15:44:34 +0200 Subject: [PATCH 3/6] Change type to protocol in release and renamer --- couchpotato/core/plugins/release/main.py | 2 +- couchpotato/core/plugins/renamer/main.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/release/main.py b/couchpotato/core/plugins/release/main.py index bd66b1aa..03b2bec4 100644 --- a/couchpotato/core/plugins/release/main.py +++ b/couchpotato/core/plugins/release/main.py @@ -174,7 +174,7 @@ class Release(Plugin): # Get matching provider provider = fireEvent('provider.belongs_to', item['url'], provider = item.get('provider'), single = True) - if item['type'] != 'torrent_magnet': + if item['protocol'] != 'torrent_magnet': item['download'] = provider.loginDownload if provider.urls.get('login') else provider.download success = fireEvent('searcher.download', data = item, movie = rel.movie.to_dict({ diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index b73e7ddf..39771c88 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -827,13 +827,13 @@ Remove it if you want it to be renamed (again, or at least let it try again) download_info.update({ 'imdb_id': rls.movie.library.identifier, 'quality': rls.quality.identifier, - 'type': rls_dict.get('info', {}).get('type') + 'protocol': rls_dict.get('info', {}).get('protocol') }) return download_info def downloadIsTorrent(self, download_info): - return download_info and download_info.get('type') in ['torrent', 'torrent_magnet'] + return download_info and download_info.get('protocol') in ['torrent', 'torrent_magnet'] def fileIsAdded(self, src, group): if not group or not group.get('before_rename'): From 32d5587669ca35e4bbe69ed2020c592966e714ce Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 24 Aug 2013 16:06:17 +0200 Subject: [PATCH 4/6] Don't load modules without __init__.py --- couchpotato/core/loader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/loader.py b/couchpotato/core/loader.py index 9d04632b..d9e7d787 100644 --- a/couchpotato/core/loader.py +++ b/couchpotato/core/loader.py @@ -28,14 +28,14 @@ class Loader(object): provider_dir = os.path.join(root, 'couchpotato', 'core', 'providers') for provider in os.listdir(provider_dir): path = os.path.join(provider_dir, provider) - if os.path.isdir(path) and provider[:2] != '__': + if os.path.isdir(path) and provider[:2] != '__' and '__init__.py' in os.listdir(path): self.paths[provider + '_provider'] = (25, 'couchpotato.core.providers.' + provider, path) # Add media to loader media_dir = os.path.join(root, 'couchpotato', 'core', 'media') for media in os.listdir(media_dir): path = os.path.join(media_dir, media) - if os.path.isdir(path) and media[:2] != '__': + if os.path.isdir(path) and media[:2] != '__' and '__init__.py' in os.listdir(path): self.paths[media + '_media'] = (25, 'couchpotato.core.media.' + media, path) From b1b5f97f03da32d045cc7ed89ff6025d69d082d7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 24 Aug 2013 16:14:18 +0200 Subject: [PATCH 5/6] Deluge fixes --- couchpotato/core/downloaders/deluge/__init__.py | 13 +++++++------ libs/synchronousdeluge/__init__.py | 4 ++-- libs/synchronousdeluge/client.py | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/couchpotato/core/downloaders/deluge/__init__.py b/couchpotato/core/downloaders/deluge/__init__.py index 4b122b38..c7aa26e6 100644 --- a/couchpotato/core/downloaders/deluge/__init__.py +++ b/couchpotato/core/downloaders/deluge/__init__.py @@ -32,12 +32,6 @@ config = [{ 'name': 'password', 'type': 'password', }, - { - 'name': 'paused', - 'type': 'bool', - 'default': False, - 'description': 'Add the torrent paused.', - }, { 'name': 'directory', 'type': 'directory', @@ -69,6 +63,13 @@ config = [{ 'advanced': True, 'description': 'Also remove the leftover files.', }, + { + 'name': 'paused', + 'type': 'bool', + 'advanced': True, + 'default': False, + 'description': 'Add the torrent paused.', + }, { 'name': 'manual', 'default': 0, diff --git a/libs/synchronousdeluge/__init__.py b/libs/synchronousdeluge/__init__.py index 208e45ca..bf5b20fe 100644 --- a/libs/synchronousdeluge/__init__.py +++ b/libs/synchronousdeluge/__init__.py @@ -19,6 +19,6 @@ __title__ = "synchronous-deluge" __version__ = "0.1" __author__ = "Christian Dale" -from .synchronousdeluge.client import DelugeClient -from .synchronousdeluge.exceptions import DelugeRPCError +from synchronousdeluge.client import DelugeClient +from synchronousdeluge.exceptions import DelugeRPCError diff --git a/libs/synchronousdeluge/client.py b/libs/synchronousdeluge/client.py index 1b63b0b1..98a80848 100644 --- a/libs/synchronousdeluge/client.py +++ b/libs/synchronousdeluge/client.py @@ -3,9 +3,9 @@ import os from collections import defaultdict from itertools import imap -from .synchronousdeluge.exceptions import DelugeRPCError -from .synchronousdeluge.protocol import DelugeRPCRequest, DelugeRPCResponse -from .synchronousdeluge.transfer import DelugeTransfer +from synchronousdeluge.exceptions import DelugeRPCError +from synchronousdeluge.protocol import DelugeRPCRequest, DelugeRPCResponse +from synchronousdeluge.transfer import DelugeTransfer __all__ = ["DelugeClient"] From 199e61ea14a1072c406a5728e0302a60fbbd785a Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 24 Aug 2013 16:37:16 +0200 Subject: [PATCH 6/6] Fallback on type for current downloads --- couchpotato/core/plugins/renamer/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index 39771c88..53d13fd0 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -827,7 +827,7 @@ Remove it if you want it to be renamed (again, or at least let it try again) download_info.update({ 'imdb_id': rls.movie.library.identifier, 'quality': rls.quality.identifier, - 'protocol': rls_dict.get('info', {}).get('protocol') + 'protocol': rls_dict.get('info', {}).get('protocol') or rls_dict.get('info', {}).get('type'), }) return download_info