Enabler option
This commit is contained in:
@@ -35,7 +35,7 @@ config = [{
|
||||
},
|
||||
{
|
||||
'name': 'launch_browser',
|
||||
'default': True,
|
||||
'default': 1,
|
||||
'type': 'bool',
|
||||
'label': 'Launch Browser',
|
||||
'description': 'Launch the browser when I start.',
|
||||
@@ -51,13 +51,13 @@ config = [{
|
||||
{
|
||||
'name': 'api_key',
|
||||
'default': uuid4().hex,
|
||||
'readonly': True,
|
||||
'readonly': 1,
|
||||
'label': 'Api Key',
|
||||
'description': "This is top-secret! Don't share this!",
|
||||
},
|
||||
{
|
||||
'name': 'debug',
|
||||
'default': False,
|
||||
'default': 0,
|
||||
'type': 'bool',
|
||||
'label': 'Debug',
|
||||
'description': 'Enable debugging.',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from couchpotato.core.event import addEvent
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
from couchpotato.environment import Env
|
||||
|
||||
|
||||
class Downloader(Plugin):
|
||||
|
||||
@@ -10,9 +10,6 @@ class Downloader(Plugin):
|
||||
def download(self, data = {}):
|
||||
pass
|
||||
|
||||
def conf(self, attr):
|
||||
return Env.setting(attr, self.__class__.__name__.lower())
|
||||
|
||||
def isDisabled(self):
|
||||
return not self.isEnabled()
|
||||
|
||||
|
||||
@@ -10,20 +10,16 @@ config = [{
|
||||
'tab': 'downloaders',
|
||||
'name': 'blackhole',
|
||||
'label': 'Black hole',
|
||||
'description': 'Fill in your Sabnzbd settings.',
|
||||
'description': 'Download NZBs to a specific folder.',
|
||||
'options': [
|
||||
{
|
||||
'name': 'enabled',
|
||||
'default': False,
|
||||
'type': 'bool',
|
||||
'label': 'Enabled',
|
||||
'description': 'Send snatched NZBs to Sabnzbd',
|
||||
'default': 0,
|
||||
'type': 'enabler',
|
||||
},
|
||||
{
|
||||
'name': 'directory',
|
||||
'default': '',
|
||||
'type': 'directory',
|
||||
'label': 'Directory',
|
||||
'description': 'Directory where the .nzb (or .torrent) file is saved to.',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -10,26 +10,19 @@ config = [{
|
||||
'tab': 'downloaders',
|
||||
'name': 'sabnzbd',
|
||||
'label': 'Sabnzbd',
|
||||
'description': 'Fill in your Sabnzbd settings.',
|
||||
'description': 'Send NZBs to your Sabnzbd installation.',
|
||||
'options': [
|
||||
{
|
||||
'name': 'enabled',
|
||||
'default': False,
|
||||
'type': 'bool',
|
||||
'label': 'Enabled',
|
||||
'description': 'Send snatched NZBs to Sabnzbd',
|
||||
'default': 0,
|
||||
'type': 'enabler',
|
||||
},
|
||||
{
|
||||
'name': 'host',
|
||||
'default': 'localhost:8080',
|
||||
'type': 'string',
|
||||
'label': 'Host',
|
||||
'description': 'Test',
|
||||
},
|
||||
{
|
||||
'name': 'api_key',
|
||||
'default': '',
|
||||
'type': 'string',
|
||||
'label': 'Api Key',
|
||||
'description': 'Used for all calls to Sabnzbd.',
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.event import addEvent
|
||||
from couchpotato.core.helpers.request import jsonified
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
from couchpotato.environment import Env
|
||||
|
||||
|
||||
class Notification(Plugin):
|
||||
|
||||
@@ -14,9 +14,6 @@ class Notification(Plugin):
|
||||
def notify(self, message = '', data = {}):
|
||||
pass
|
||||
|
||||
def conf(self, attr):
|
||||
return Env.setting(attr, self.__class__.__name__.lower())
|
||||
|
||||
def isDisabled(self):
|
||||
return not self.isEnabled()
|
||||
|
||||
|
||||
@@ -12,20 +12,16 @@ config = [{
|
||||
'options': [
|
||||
{
|
||||
'name': 'enabled',
|
||||
'default': False,
|
||||
'default': 0,
|
||||
'type': 'enabler',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'host',
|
||||
'default': 'localhost',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'password',
|
||||
'default': '',
|
||||
'type': 'password',
|
||||
'description': '',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -13,23 +13,18 @@ config = [{
|
||||
'options': [
|
||||
{
|
||||
'name': 'enabled',
|
||||
'default': False,
|
||||
'default': 0,
|
||||
'type': 'enabler',
|
||||
},
|
||||
{
|
||||
'name': 'host',
|
||||
'default': 'localhost',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'database',
|
||||
'default': '',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'mount',
|
||||
'default': '',
|
||||
'description': '',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -13,17 +13,14 @@ config = [{
|
||||
'options': [
|
||||
{
|
||||
'name': 'enabled',
|
||||
'default': False,
|
||||
'default': 0,
|
||||
'type': 'enabler',
|
||||
},
|
||||
{
|
||||
'name': 'username',
|
||||
'default': '',
|
||||
'type': 'string',
|
||||
},
|
||||
{
|
||||
'name': 'password',
|
||||
'default': '',
|
||||
'type': 'password',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -12,20 +12,16 @@ config = [{
|
||||
'options': [
|
||||
{
|
||||
'name': 'enabled',
|
||||
'default': False,
|
||||
'default': 0,
|
||||
'type': 'enabler',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'host',
|
||||
'default': 'localhost',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'password',
|
||||
'default': '',
|
||||
'type': 'password',
|
||||
'description': '',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -12,21 +12,17 @@ config = [{
|
||||
'options': [
|
||||
{
|
||||
'name': 'enabled',
|
||||
'default': False,
|
||||
'default': 0,
|
||||
'type': 'enabler',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'api_key',
|
||||
'default': '',
|
||||
'label': 'Api key',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'priority',
|
||||
'default': '0',
|
||||
'type': 'dropdown',
|
||||
'description': '',
|
||||
'values': [('Very Low', -2), ('Moderate', -1), ('Normal', 0), ('High', 1), ('Emergency', 2)]
|
||||
},
|
||||
],
|
||||
|
||||
@@ -12,25 +12,21 @@ config = [{
|
||||
'options': [
|
||||
{
|
||||
'name': 'enabled',
|
||||
'default': False,
|
||||
'default': 0,
|
||||
'type': 'enabler',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'host',
|
||||
'default': 'localhost:8080',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'username',
|
||||
'default': 'xbmc',
|
||||
'description': '',
|
||||
},
|
||||
{
|
||||
'name': 'password',
|
||||
'default': 'xbmc',
|
||||
'type': 'password',
|
||||
'description': '',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
from couchpotato.environment import Env
|
||||
|
||||
|
||||
class Plugin():
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
def conf(self, attr):
|
||||
return Env.setting(attr, self.__class__.__name__.lower())
|
||||
|
||||
@@ -8,24 +8,22 @@ if os.name == 'nt':
|
||||
|
||||
class FileBrowser():
|
||||
|
||||
def __init__(self, path = '/'):
|
||||
self.path = path
|
||||
|
||||
def __init__(self):
|
||||
addApiView('directory.list', self.view)
|
||||
|
||||
def getDirectories(self):
|
||||
def getDirectories(self, path = '/', show_hidden = True):
|
||||
|
||||
# Return driveletters or root if path is empty
|
||||
if self.path == '/' or not self.path:
|
||||
if path == '/' or not path:
|
||||
if os.name == 'nt':
|
||||
return self.getDriveLetters()
|
||||
self.path = '/'
|
||||
path = '/'
|
||||
|
||||
dirs = []
|
||||
for f in os.listdir(self.path):
|
||||
path = os.path.join(self.path, f)
|
||||
if(os.path.isdir(path)):
|
||||
dirs.append(path)
|
||||
for f in os.listdir(path):
|
||||
p = os.path.join(path, f)
|
||||
if(os.path.isdir(p)):
|
||||
dirs.append(p + '/')
|
||||
|
||||
return dirs
|
||||
|
||||
@@ -44,8 +42,7 @@ class FileBrowser():
|
||||
def view(self):
|
||||
|
||||
try:
|
||||
fb = FileBrowser(getParam('path', '/'))
|
||||
dirs = fb.getDirectories()
|
||||
dirs = self.getDirectories(path = getParam('path', '/'), show_hidden = getParam('show_hidden', True))
|
||||
except:
|
||||
dirs = []
|
||||
|
||||
|
||||
@@ -3,11 +3,8 @@ from couchpotato.core.plugins.base import Plugin
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
|
||||
class Provider(Plugin):
|
||||
|
||||
type = None # movie, nzb, torrent, subtitle, trailer
|
||||
timeout = 10 # Default timeout for url requests
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from imdb import IMDb
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
|
||||
class IMDB(Provider):
|
||||
|
||||
type = 'movie'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.providers.tmdb.main import TMDBWrapper
|
||||
from .main import TheMovieDb
|
||||
|
||||
def start():
|
||||
return TMDBWrapper()
|
||||
return TheMovieDb()
|
||||
|
||||
config = [{
|
||||
'name': 'themoviedb',
|
||||
@@ -11,13 +11,12 @@ config = [{
|
||||
'name': 'tmdb',
|
||||
'label': 'TheMovieDB',
|
||||
'advanced': True,
|
||||
'description': 'Used for all calls to TheMovieDB.',
|
||||
'options': [
|
||||
{
|
||||
'name': 'api_key',
|
||||
'default': '9b939aee0aaafc12a65bf448e4af9543',
|
||||
'type': 'string',
|
||||
'label': 'Api Key',
|
||||
'description': 'Used for all calls to TheMovieDB.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -3,13 +3,12 @@ from couchpotato.core.event import addEvent
|
||||
from couchpotato.core.helpers.encoding import simplifyString, toUnicode
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.providers.base import Provider
|
||||
from couchpotato.environment import Env
|
||||
from libs.themoviedb import tmdb
|
||||
import copy
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
class TMDBWrapper(Provider):
|
||||
|
||||
class TheMovieDb(Provider):
|
||||
"""Api for theMovieDb"""
|
||||
|
||||
type = 'movie'
|
||||
@@ -23,9 +22,6 @@ class TMDBWrapper(Provider):
|
||||
# Use base wrapper
|
||||
tmdb.Config.api_key = self.conf('api_key')
|
||||
|
||||
def conf(self, attr):
|
||||
return Env.setting(attr, 'themoviedb')
|
||||
|
||||
def search(self, q, limit = 12):
|
||||
''' Find movie by name '''
|
||||
|
||||
|
||||
@@ -108,13 +108,13 @@ class Settings():
|
||||
|
||||
def saveView(self):
|
||||
|
||||
a = getParams()
|
||||
params = getParams()
|
||||
|
||||
section = a.get('section')
|
||||
option = a.get('name')
|
||||
value = a.get('value')
|
||||
section = params.get('section')
|
||||
option = params.get('name')
|
||||
value = params.get('value')
|
||||
|
||||
self.set(option, section, value)
|
||||
self.set(section, option, value)
|
||||
self.save()
|
||||
|
||||
return jsonified({
|
||||
|
||||
Reference in New Issue
Block a user