From 0b61ec1e13c163978df54dbafee78a63380ec9c7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 11 Mar 2014 22:47:42 +0100 Subject: [PATCH] Move plugins to single file --- .../{automation/__init__.py => automation.py} | 53 +++++- couchpotato/core/plugins/automation/main.py | 49 ----- .../plugins/{browser/main.py => browser.py} | 3 + couchpotato/core/plugins/browser/__init__.py | 7 - couchpotato/core/plugins/category/__init__.py | 4 +- .../plugins/{custom/main.py => custom.py} | 2 + couchpotato/core/plugins/custom/__init__.py | 7 - .../{dashboard/main.py => dashboard.py} | 2 + .../core/plugins/dashboard/__init__.py | 7 - .../core/plugins/{file/main.py => file.py} | 2 + couchpotato/core/plugins/file/__init__.py | 7 - couchpotato/core/plugins/log/__init__.py | 4 +- .../plugins/{manage/main.py => manage.py} | 41 +++- couchpotato/core/plugins/manage/__init__.py | 43 ----- couchpotato/core/plugins/profile/__init__.py | 4 +- couchpotato/core/plugins/quality/__init__.py | 2 +- couchpotato/core/plugins/release/__init__.py | 4 +- .../plugins/{renamer/main.py => renamer.py} | 176 ++++++++++++++++- couchpotato/core/plugins/renamer/__init__.py | 178 ------------------ .../plugins/{scanner/main.py => scanner.py} | 0 couchpotato/core/plugins/scanner/__init__.py | 7 - couchpotato/core/plugins/score/__init__.py | 4 +- .../plugins/{subtitle/main.py => subtitle.py} | 27 +++ couchpotato/core/plugins/subtitle/__init__.py | 35 ---- .../plugins/{trailer/main.py => trailer.py} | 36 ++++ couchpotato/core/plugins/trailer/__init__.py | 38 ---- .../core/plugins/userscript/__init__.py | 4 +- couchpotato/core/plugins/wizard/__init__.py | 2 +- 28 files changed, 345 insertions(+), 403 deletions(-) rename couchpotato/core/plugins/{automation/__init__.py => automation.py} (54%) delete mode 100644 couchpotato/core/plugins/automation/main.py rename couchpotato/core/plugins/{browser/main.py => browser.py} (99%) delete mode 100644 couchpotato/core/plugins/browser/__init__.py rename couchpotato/core/plugins/{custom/main.py => custom.py} (96%) delete mode 100644 couchpotato/core/plugins/custom/__init__.py rename couchpotato/core/plugins/{dashboard/main.py => dashboard.py} (99%) delete mode 100644 couchpotato/core/plugins/dashboard/__init__.py rename couchpotato/core/plugins/{file/main.py => file.py} (99%) delete mode 100644 couchpotato/core/plugins/file/__init__.py rename couchpotato/core/plugins/{manage/main.py => manage.py} (89%) delete mode 100644 couchpotato/core/plugins/manage/__init__.py rename couchpotato/core/plugins/{renamer/main.py => renamer.py} (89%) mode change 100755 => 100644 delete mode 100755 couchpotato/core/plugins/renamer/__init__.py rename couchpotato/core/plugins/{scanner/main.py => scanner.py} (100%) delete mode 100644 couchpotato/core/plugins/scanner/__init__.py rename couchpotato/core/plugins/{subtitle/main.py => subtitle.py} (69%) delete mode 100644 couchpotato/core/plugins/subtitle/__init__.py rename couchpotato/core/plugins/{trailer/main.py => trailer.py} (61%) delete mode 100644 couchpotato/core/plugins/trailer/__init__.py diff --git a/couchpotato/core/plugins/automation/__init__.py b/couchpotato/core/plugins/automation.py similarity index 54% rename from couchpotato/core/plugins/automation/__init__.py rename to couchpotato/core/plugins/automation.py index 482a0090..e17dc36a 100644 --- a/couchpotato/core/plugins/automation/__init__.py +++ b/couchpotato/core/plugins/automation.py @@ -1,8 +1,55 @@ -from .main import Automation +from couchpotato.core.event import addEvent, fireEvent +from couchpotato.core.logger import CPLog +from couchpotato.core.plugins.base import Plugin +from couchpotato.environment import Env + +log = CPLog(__name__) + +autoload = 'Automation' -def start(): - return Automation() +class Automation(Plugin): + + def __init__(self): + + addEvent('app.load', self.setCrons) + + if not Env.get('dev'): + addEvent('app.load', self.addMovies) + + addEvent('setting.save.automation.hour.after', self.setCrons) + + def setCrons(self): + fireEvent('schedule.interval', 'automation.add_movies', self.addMovies, hours = self.conf('hour', default = 12)) + + def addMovies(self): + + movies = fireEvent('automation.get_movies', merge = True) + movie_ids = [] + + for imdb_id in movies: + + if self.shuttingDown(): + break + + prop_name = 'automation.added.%s' % imdb_id + added = Env.prop(prop_name, default = False) + if not added: + added_movie = fireEvent('movie.add', params = {'identifier': imdb_id}, force_readd = False, search_after = False, update_library = True, single = True) + if added_movie: + movie_ids.append(added_movie['id']) + Env.prop(prop_name, True) + + for movie_id in movie_ids: + + if self.shuttingDown(): + break + + movie_dict = fireEvent('media.get', movie_id, single = True) + fireEvent('movie.searcher.single', movie_dict) + + return True + config = [{ 'name': 'automation', diff --git a/couchpotato/core/plugins/automation/main.py b/couchpotato/core/plugins/automation/main.py deleted file mode 100644 index 2edcd3be..00000000 --- a/couchpotato/core/plugins/automation/main.py +++ /dev/null @@ -1,49 +0,0 @@ -from couchpotato.core.event import addEvent, fireEvent -from couchpotato.core.logger import CPLog -from couchpotato.core.plugins.base import Plugin -from couchpotato.environment import Env - -log = CPLog(__name__) - - -class Automation(Plugin): - - def __init__(self): - - addEvent('app.load', self.setCrons) - - if not Env.get('dev'): - addEvent('app.load', self.addMovies) - - addEvent('setting.save.automation.hour.after', self.setCrons) - - def setCrons(self): - fireEvent('schedule.interval', 'automation.add_movies', self.addMovies, hours = self.conf('hour', default = 12)) - - def addMovies(self): - - movies = fireEvent('automation.get_movies', merge = True) - movie_ids = [] - - for imdb_id in movies: - - if self.shuttingDown(): - break - - prop_name = 'automation.added.%s' % imdb_id - added = Env.prop(prop_name, default = False) - if not added: - added_movie = fireEvent('movie.add', params = {'identifier': imdb_id}, force_readd = False, search_after = False, update_library = True, single = True) - if added_movie: - movie_ids.append(added_movie['id']) - Env.prop(prop_name, True) - - for movie_id in movie_ids: - - if self.shuttingDown(): - break - - movie_dict = fireEvent('media.get', movie_id, single = True) - fireEvent('movie.searcher.single', movie_dict) - - return True diff --git a/couchpotato/core/plugins/browser/main.py b/couchpotato/core/plugins/browser.py similarity index 99% rename from couchpotato/core/plugins/browser/main.py rename to couchpotato/core/plugins/browser.py index 956a7680..8bfe53cc 100644 --- a/couchpotato/core/plugins/browser/main.py +++ b/couchpotato/core/plugins/browser.py @@ -17,6 +17,9 @@ if os.name == 'nt': else: import win32file #@UnresolvedImport +autoload = 'FileBrowser' + + class FileBrowser(Plugin): def __init__(self): diff --git a/couchpotato/core/plugins/browser/__init__.py b/couchpotato/core/plugins/browser/__init__.py deleted file mode 100644 index fae50657..00000000 --- a/couchpotato/core/plugins/browser/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from .main import FileBrowser - - -def start(): - return FileBrowser() - -config = [] diff --git a/couchpotato/core/plugins/category/__init__.py b/couchpotato/core/plugins/category/__init__.py index dcdae90b..d147092f 100644 --- a/couchpotato/core/plugins/category/__init__.py +++ b/couchpotato/core/plugins/category/__init__.py @@ -1,7 +1,5 @@ from .main import CategoryPlugin -def start(): +def autoload(): return CategoryPlugin() - -config = [] diff --git a/couchpotato/core/plugins/custom/main.py b/couchpotato/core/plugins/custom.py similarity index 96% rename from couchpotato/core/plugins/custom/main.py rename to couchpotato/core/plugins/custom.py index a15c915c..c9cff3ea 100644 --- a/couchpotato/core/plugins/custom/main.py +++ b/couchpotato/core/plugins/custom.py @@ -6,6 +6,8 @@ import os log = CPLog(__name__) +autoload = 'Custom' + class Custom(Plugin): diff --git a/couchpotato/core/plugins/custom/__init__.py b/couchpotato/core/plugins/custom/__init__.py deleted file mode 100644 index 20a39351..00000000 --- a/couchpotato/core/plugins/custom/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from .main import Custom - - -def start(): - return Custom() - -config = [] diff --git a/couchpotato/core/plugins/dashboard/main.py b/couchpotato/core/plugins/dashboard.py similarity index 99% rename from couchpotato/core/plugins/dashboard/main.py rename to couchpotato/core/plugins/dashboard.py index d0d3bfef..4a9aaf95 100644 --- a/couchpotato/core/plugins/dashboard/main.py +++ b/couchpotato/core/plugins/dashboard.py @@ -10,6 +10,8 @@ import time log = CPLog(__name__) +autoload = 'Dashboard' + class Dashboard(Plugin): diff --git a/couchpotato/core/plugins/dashboard/__init__.py b/couchpotato/core/plugins/dashboard/__init__.py deleted file mode 100644 index c43a44eb..00000000 --- a/couchpotato/core/plugins/dashboard/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from .main import Dashboard - - -def start(): - return Dashboard() - -config = [] diff --git a/couchpotato/core/plugins/file/main.py b/couchpotato/core/plugins/file.py similarity index 99% rename from couchpotato/core/plugins/file/main.py rename to couchpotato/core/plugins/file.py index 1d4313be..41104378 100644 --- a/couchpotato/core/plugins/file/main.py +++ b/couchpotato/core/plugins/file.py @@ -14,6 +14,8 @@ import traceback log = CPLog(__name__) +autoload = 'FileManager' + class FileManager(Plugin): diff --git a/couchpotato/core/plugins/file/__init__.py b/couchpotato/core/plugins/file/__init__.py deleted file mode 100644 index 3dced3d0..00000000 --- a/couchpotato/core/plugins/file/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from .main import FileManager - - -def start(): - return FileManager() - -config = [] diff --git a/couchpotato/core/plugins/log/__init__.py b/couchpotato/core/plugins/log/__init__.py index f5d9d105..3760b567 100644 --- a/couchpotato/core/plugins/log/__init__.py +++ b/couchpotato/core/plugins/log/__init__.py @@ -1,7 +1,5 @@ from .main import Logging -def start(): +def autoload(): return Logging() - -config = [] diff --git a/couchpotato/core/plugins/manage/main.py b/couchpotato/core/plugins/manage.py similarity index 89% rename from couchpotato/core/plugins/manage/main.py rename to couchpotato/core/plugins/manage.py index 965bd9f3..205de136 100644 --- a/couchpotato/core/plugins/manage/main.py +++ b/couchpotato/core/plugins/manage.py @@ -12,9 +12,10 @@ import sys import time import traceback - log = CPLog(__name__) +autoload = 'Manage' + class Manage(Plugin): @@ -268,3 +269,41 @@ class Manage(Plugin): return free_space + +config = [{ + 'name': 'manage', + 'groups': [ + { + 'tab': 'manage', + 'label': 'Movie Library Manager', + 'description': 'Add your existing movie folders.', + 'options': [ + { + 'name': 'enabled', + 'default': False, + 'type': 'enabler', + }, + { + 'name': 'library', + 'type': 'directories', + 'description': 'Folder where the movies should be moved to.', + }, + { + 'label': 'Cleanup After', + 'name': 'cleanup', + 'type': 'bool', + 'description': 'Remove movie from db if it can\'t be found after re-scan.', + 'default': True, + }, + { + 'label': 'Scan at startup', + 'name': 'startup_scan', + 'type': 'bool', + 'default': True, + 'advanced': True, + 'description': 'Do a quick scan on startup. On slow systems better disable this.', + }, + ], + }, + ], +}] diff --git a/couchpotato/core/plugins/manage/__init__.py b/couchpotato/core/plugins/manage/__init__.py deleted file mode 100644 index c992dee6..00000000 --- a/couchpotato/core/plugins/manage/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -from .main import Manage - - -def start(): - return Manage() - -config = [{ - 'name': 'manage', - 'groups': [ - { - 'tab': 'manage', - 'label': 'Movie Library Manager', - 'description': 'Add your existing movie folders.', - 'options': [ - { - 'name': 'enabled', - 'default': False, - 'type': 'enabler', - }, - { - 'name': 'library', - 'type': 'directories', - 'description': 'Folder where the movies should be moved to.', - }, - { - 'label': 'Cleanup After', - 'name': 'cleanup', - 'type': 'bool', - 'description': 'Remove movie from db if it can\'t be found after re-scan.', - 'default': True, - }, - { - 'label': 'Scan at startup', - 'name': 'startup_scan', - 'type': 'bool', - 'default': True, - 'advanced': True, - 'description': 'Do a quick scan on startup. On slow systems better disable this.', - }, - ], - }, - ], -}] diff --git a/couchpotato/core/plugins/profile/__init__.py b/couchpotato/core/plugins/profile/__init__.py index c07bc7c5..15a74eee 100644 --- a/couchpotato/core/plugins/profile/__init__.py +++ b/couchpotato/core/plugins/profile/__init__.py @@ -1,7 +1,5 @@ from .main import ProfilePlugin -def start(): +def autoload(): return ProfilePlugin() - -config = [] diff --git a/couchpotato/core/plugins/quality/__init__.py b/couchpotato/core/plugins/quality/__init__.py index 2630f1a3..fc9cda64 100644 --- a/couchpotato/core/plugins/quality/__init__.py +++ b/couchpotato/core/plugins/quality/__init__.py @@ -1,7 +1,7 @@ from .main import QualityPlugin -def start(): +def autoload(): return QualityPlugin() config = [] diff --git a/couchpotato/core/plugins/release/__init__.py b/couchpotato/core/plugins/release/__init__.py index 08c6a57c..e6e60c4b 100644 --- a/couchpotato/core/plugins/release/__init__.py +++ b/couchpotato/core/plugins/release/__init__.py @@ -1,7 +1,5 @@ from .main import Release -def start(): +def autoload(): return Release() - -config = [] diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer.py old mode 100755 new mode 100644 similarity index 89% rename from couchpotato/core/plugins/renamer/main.py rename to couchpotato/core/plugins/renamer.py index 8d145500..7e4fc99c --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer.py @@ -9,7 +9,6 @@ from couchpotato.core.plugins.base import Plugin from couchpotato.environment import Env from scandir import scandir from unrar2 import RarFile -import errno import fnmatch import os import re @@ -21,6 +20,8 @@ from six.moves import filter log = CPLog(__name__) +autoload = 'Renamer' + class Renamer(Plugin): @@ -1187,3 +1188,176 @@ Remove it if you want it to be renamed (again, or at least let it try again) folder = None return folder, media_folder, files, extr_files + + +rename_options = { + 'pre': '<', + 'post': '>', + 'choices': { + 'ext': 'Extention (mkv)', + 'namethe': 'Moviename, The', + 'thename': 'The Moviename', + 'year': 'Year (2011)', + 'first': 'First letter (M)', + 'quality': 'Quality (720p)', + 'quality_type': '(HD) or (SD)', + 'video': 'Video (x264)', + 'audio': 'Audio (DTS)', + 'group': 'Releasegroup name', + 'source': 'Source media (Bluray)', + 'resolution_width': 'resolution width (1280)', + 'resolution_height': 'resolution height (720)', + 'audio_channels': 'audio channels (7.1)', + 'original': 'Original filename', + 'original_folder': 'Original foldername', + 'imdb_id': 'IMDB id (tt0123456)', + 'cd': 'CD number (cd1)', + 'cd_nr': 'Just the cd nr. (1)', + 'mpaa': 'MPAA Rating', + 'category': 'Category label', + }, +} + +config = [{ + 'name': 'renamer', + 'order': 40, + 'description': 'Move and rename your downloaded movies to your movie directory.', + 'groups': [ + { + 'tab': 'renamer', + 'name': 'renamer', + 'label': 'Rename downloaded movies', + 'wizard': True, + 'options': [ + { + 'name': 'enabled', + 'default': False, + 'type': 'enabler', + }, + { + 'name': 'from', + 'type': 'directory', + 'description': 'Folder where CP searches for movies.', + }, + { + 'name': 'to', + 'type': 'directory', + 'description': 'Default folder where the movies are moved to.', + }, + { + 'name': 'folder_name', + 'label': 'Folder naming', + 'description': 'Name of the folder. Keep empty for no folder.', + 'default': ' ()', + 'type': 'choice', + 'options': rename_options + }, + { + 'name': 'file_name', + 'label': 'File naming', + 'description': 'Name of the file', + 'default': '.', + 'type': 'choice', + 'options': rename_options + }, + { + 'name': 'unrar', + 'type': 'bool', + 'description': 'Extract rar files if found.', + 'default': False, + }, + { + 'name': 'cleanup', + 'type': 'bool', + 'description': 'Cleanup leftover files after successful rename.', + 'default': False, + }, + { + 'advanced': True, + 'name': 'run_every', + 'label': 'Run every', + 'default': 1, + 'type': 'int', + 'unit': 'min(s)', + 'description': ('Detect movie status every X minutes.', 'Will start the renamer if movie is completed or handle failed download if these options are enabled'), + }, + { + 'advanced': True, + 'name': 'force_every', + 'label': 'Force every', + 'default': 2, + 'type': 'int', + 'unit': 'hour(s)', + 'description': 'Forces the renamer to scan every X hours', + }, + { + 'advanced': True, + 'name': 'next_on_failed', + 'default': True, + 'type': 'bool', + 'description': 'Try the next best release for a movie after a download failed.', + }, + { + 'name': 'move_leftover', + 'type': 'bool', + 'description': 'Move all leftover file after renaming, to the movie folder.', + 'default': False, + 'advanced': True, + }, + { + 'advanced': True, + 'name': 'separator', + 'label': 'File-Separator', + 'description': ('Replace all the spaces with a character.', 'Example: ".", "-" (without quotes). Leave empty to use spaces.'), + }, + { + 'advanced': True, + 'name': 'foldersep', + 'label': 'Folder-Separator', + 'description': ('Replace all the spaces with a character.', 'Example: ".", "-" (without quotes). Leave empty to use spaces.'), + }, + { + 'name': 'file_action', + 'label': 'Torrent File Action', + 'default': 'link', + 'type': 'dropdown', + 'values': [('Link', 'link'), ('Copy', 'copy'), ('Move', 'move')], + 'description': ('Link, Copy or Move after download completed.', + 'Link first tries hard link, then sym link and falls back to Copy. It is perfered to use link when downloading torrents as it will save you space, while still beeing able to seed.'), + 'advanced': True, + }, + { + 'advanced': True, + 'name': 'ntfs_permission', + 'label': 'NTFS Permission', + 'type': 'bool', + 'hidden': os.name != 'nt', + 'description': 'Set permission of moved files to that of destination folder (Windows NTFS only).', + 'default': False, + }, + ], + }, { + 'tab': 'renamer', + 'name': 'meta_renamer', + 'label': 'Advanced renaming', + 'description': 'Meta data file renaming. Use <filename> to use the above "File naming" settings, without the file extention.', + 'advanced': True, + 'options': [ + { + 'name': 'rename_nfo', + 'label': 'Rename .NFO', + 'description': 'Rename original .nfo file', + 'type': 'bool', + 'default': True, + }, + { + 'name': 'nfo_name', + 'label': 'NFO naming', + 'default': '.orig.', + 'type': 'choice', + 'options': rename_options + }, + ], + }, + ], +}] diff --git a/couchpotato/core/plugins/renamer/__init__.py b/couchpotato/core/plugins/renamer/__init__.py deleted file mode 100755 index e238f5eb..00000000 --- a/couchpotato/core/plugins/renamer/__init__.py +++ /dev/null @@ -1,178 +0,0 @@ -from couchpotato.core.plugins.renamer.main import Renamer -import os - - -def start(): - return Renamer() - -rename_options = { - 'pre': '<', - 'post': '>', - 'choices': { - 'ext': 'Extention (mkv)', - 'namethe': 'Moviename, The', - 'thename': 'The Moviename', - 'year': 'Year (2011)', - 'first': 'First letter (M)', - 'quality': 'Quality (720p)', - 'quality_type': '(HD) or (SD)', - 'video': 'Video (x264)', - 'audio': 'Audio (DTS)', - 'group': 'Releasegroup name', - 'source': 'Source media (Bluray)', - 'resolution_width': 'resolution width (1280)', - 'resolution_height': 'resolution height (720)', - 'audio_channels': 'audio channels (7.1)', - 'original': 'Original filename', - 'original_folder': 'Original foldername', - 'imdb_id': 'IMDB id (tt0123456)', - 'cd': 'CD number (cd1)', - 'cd_nr': 'Just the cd nr. (1)', - 'mpaa': 'MPAA Rating', - 'category': 'Category label', - }, -} - -config = [{ - 'name': 'renamer', - 'order': 40, - 'description': 'Move and rename your downloaded movies to your movie directory.', - 'groups': [ - { - 'tab': 'renamer', - 'name': 'renamer', - 'label': 'Rename downloaded movies', - 'wizard': True, - 'options': [ - { - 'name': 'enabled', - 'default': False, - 'type': 'enabler', - }, - { - 'name': 'from', - 'type': 'directory', - 'description': 'Folder where CP searches for movies.', - }, - { - 'name': 'to', - 'type': 'directory', - 'description': 'Default folder where the movies are moved to.', - }, - { - 'name': 'folder_name', - 'label': 'Folder naming', - 'description': 'Name of the folder. Keep empty for no folder.', - 'default': ' ()', - 'type': 'choice', - 'options': rename_options - }, - { - 'name': 'file_name', - 'label': 'File naming', - 'description': 'Name of the file', - 'default': '.', - 'type': 'choice', - 'options': rename_options - }, - { - 'name': 'unrar', - 'type': 'bool', - 'description': 'Extract rar files if found.', - 'default': False, - }, - { - 'name': 'cleanup', - 'type': 'bool', - 'description': 'Cleanup leftover files after successful rename.', - 'default': False, - }, - { - 'advanced': True, - 'name': 'run_every', - 'label': 'Run every', - 'default': 1, - 'type': 'int', - 'unit': 'min(s)', - 'description': ('Detect movie status every X minutes.', 'Will start the renamer if movie is completed or handle failed download if these options are enabled'), - }, - { - 'advanced': True, - 'name': 'force_every', - 'label': 'Force every', - 'default': 2, - 'type': 'int', - 'unit': 'hour(s)', - 'description': 'Forces the renamer to scan every X hours', - }, - { - 'advanced': True, - 'name': 'next_on_failed', - 'default': True, - 'type': 'bool', - 'description': 'Try the next best release for a movie after a download failed.', - }, - { - 'name': 'move_leftover', - 'type': 'bool', - 'description': 'Move all leftover file after renaming, to the movie folder.', - 'default': False, - 'advanced': True, - }, - { - 'advanced': True, - 'name': 'separator', - 'label': 'File-Separator', - 'description': ('Replace all the spaces with a character.', 'Example: ".", "-" (without quotes). Leave empty to use spaces.'), - }, - { - 'advanced': True, - 'name': 'foldersep', - 'label': 'Folder-Separator', - 'description': ('Replace all the spaces with a character.', 'Example: ".", "-" (without quotes). Leave empty to use spaces.'), - }, - { - 'name': 'file_action', - 'label': 'Torrent File Action', - 'default': 'link', - 'type': 'dropdown', - 'values': [('Link', 'link'), ('Copy', 'copy'), ('Move', 'move')], - 'description': ('Link, Copy or Move after download completed.', - 'Link first tries hard link, then sym link and falls back to Copy. It is perfered to use link when downloading torrents as it will save you space, while still beeing able to seed.'), - 'advanced': True, - }, - { - 'advanced': True, - 'name': 'ntfs_permission', - 'label': 'NTFS Permission', - 'type': 'bool', - 'hidden': os.name != 'nt', - 'description': 'Set permission of moved files to that of destination folder (Windows NTFS only).', - 'default': False, - }, - ], - }, { - 'tab': 'renamer', - 'name': 'meta_renamer', - 'label': 'Advanced renaming', - 'description': 'Meta data file renaming. Use <filename> to use the above "File naming" settings, without the file extention.', - 'advanced': True, - 'options': [ - { - 'name': 'rename_nfo', - 'label': 'Rename .NFO', - 'description': 'Rename original .nfo file', - 'type': 'bool', - 'default': True, - }, - { - 'name': 'nfo_name', - 'label': 'NFO naming', - 'default': '.orig.', - 'type': 'choice', - 'options': rename_options - }, - ], - }, - ], -}] diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner.py similarity index 100% rename from couchpotato/core/plugins/scanner/main.py rename to couchpotato/core/plugins/scanner.py diff --git a/couchpotato/core/plugins/scanner/__init__.py b/couchpotato/core/plugins/scanner/__init__.py deleted file mode 100644 index 66c6b39c..00000000 --- a/couchpotato/core/plugins/scanner/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from .main import Scanner - - -def start(): - return Scanner() - -config = [] diff --git a/couchpotato/core/plugins/score/__init__.py b/couchpotato/core/plugins/score/__init__.py index a960081c..65cadd99 100644 --- a/couchpotato/core/plugins/score/__init__.py +++ b/couchpotato/core/plugins/score/__init__.py @@ -1,7 +1,5 @@ from .main import Score -def start(): +def autoload(): return Score() - -config = [] diff --git a/couchpotato/core/plugins/subtitle/main.py b/couchpotato/core/plugins/subtitle.py similarity index 69% rename from couchpotato/core/plugins/subtitle/main.py rename to couchpotato/core/plugins/subtitle.py index c00c757e..06a77f9a 100644 --- a/couchpotato/core/plugins/subtitle/main.py +++ b/couchpotato/core/plugins/subtitle.py @@ -9,6 +9,8 @@ import traceback log = CPLog(__name__) +autoload = 'Subtitle' + class Subtitle(Plugin): @@ -47,3 +49,28 @@ class Subtitle(Plugin): def getLanguages(self): return splitString(self.conf('languages')) + + +config = [{ + 'name': 'subtitle', + 'groups': [ + { + 'tab': 'renamer', + 'name': 'subtitle', + 'label': 'Download subtitles', + 'description': 'after rename', + 'options': [ + { + 'name': 'enabled', + 'label': 'Search and download subtitles', + 'default': False, + 'type': 'enabler', + }, + { + 'name': 'languages', + 'description': ('Comma separated, 2 letter country code.', 'Example: en, nl. See the codes at on Wikipedia'), + }, + ], + }, + ], +}] diff --git a/couchpotato/core/plugins/subtitle/__init__.py b/couchpotato/core/plugins/subtitle/__init__.py deleted file mode 100644 index 59847aee..00000000 --- a/couchpotato/core/plugins/subtitle/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -from .main import Subtitle - - -def start(): - return Subtitle() - -config = [{ - 'name': 'subtitle', - 'groups': [ - { - 'tab': 'renamer', - 'name': 'subtitle', - 'label': 'Download subtitles', - 'description': 'after rename', - 'options': [ - { - 'name': 'enabled', - 'label': 'Search and download subtitles', - 'default': False, - 'type': 'enabler', - }, - { - 'name': 'languages', - 'description': ('Comma separated, 2 letter country code.', 'Example: en, nl. See the codes at on Wikipedia'), - }, -# { -# 'name': 'automatic', -# 'default': True, -# 'type': 'bool', -# 'description': 'Automaticly search & download for movies in library', -# }, - ], - }, - ], -}] diff --git a/couchpotato/core/plugins/trailer/main.py b/couchpotato/core/plugins/trailer.py similarity index 61% rename from couchpotato/core/plugins/trailer/main.py rename to couchpotato/core/plugins/trailer.py index 36084066..b202e939 100644 --- a/couchpotato/core/plugins/trailer/main.py +++ b/couchpotato/core/plugins/trailer.py @@ -6,6 +6,8 @@ import os log = CPLog(__name__) +autoload = 'Trailer' + class Trailer(Plugin): @@ -40,3 +42,37 @@ class Trailer(Plugin): break return True + + +config = [{ + 'name': 'trailer', + 'groups': [ + { + 'tab': 'renamer', + 'name': 'trailer', + 'label': 'Download trailer', + 'description': 'after rename', + 'options': [ + { + 'name': 'enabled', + 'label': 'Search and download trailers', + 'default': False, + 'type': 'enabler', + }, + { + 'name': 'quality', + 'default': '720p', + 'type': 'dropdown', + 'values': [('1080p', '1080p'), ('720p', '720p'), ('480P', '480p')], + }, + { + 'name': 'name', + 'label': 'Naming', + 'default': '-trailer', + 'advanced': True, + 'description': 'Use <filename> to use above settings.' + }, + ], + }, + ], +}] diff --git a/couchpotato/core/plugins/trailer/__init__.py b/couchpotato/core/plugins/trailer/__init__.py deleted file mode 100644 index e7a6d26e..00000000 --- a/couchpotato/core/plugins/trailer/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -from .main import Trailer - - -def start(): - return Trailer() - -config = [{ - 'name': 'trailer', - 'groups': [ - { - 'tab': 'renamer', - 'name': 'trailer', - 'label': 'Download trailer', - 'description': 'after rename', - 'options': [ - { - 'name': 'enabled', - 'label': 'Search and download trailers', - 'default': False, - 'type': 'enabler', - }, - { - 'name': 'quality', - 'default': '720p', - 'type': 'dropdown', - 'values': [('1080p', '1080p'), ('720p', '720p'), ('480P', '480p')], - }, - { - 'name': 'name', - 'label': 'Naming', - 'default': '-trailer', - 'advanced': True, - 'description': 'Use <filename> to use above settings.' - }, - ], - }, - ], -}] diff --git a/couchpotato/core/plugins/userscript/__init__.py b/couchpotato/core/plugins/userscript/__init__.py index 184f5d79..9d708593 100644 --- a/couchpotato/core/plugins/userscript/__init__.py +++ b/couchpotato/core/plugins/userscript/__init__.py @@ -1,7 +1,5 @@ from .main import Userscript -def start(): +def autoload(): return Userscript() - -config = [] diff --git a/couchpotato/core/plugins/wizard/__init__.py b/couchpotato/core/plugins/wizard/__init__.py index eda6f25a..7a272b44 100644 --- a/couchpotato/core/plugins/wizard/__init__.py +++ b/couchpotato/core/plugins/wizard/__init__.py @@ -1,7 +1,7 @@ from .main import Wizard -def start(): +def autoload(): return Wizard() config = [{