Searcher, settings styling
This commit is contained in:
1 parent
44395ff195
commit
322762d702
26 files changed
+8058
-663
No files matched your search
@@ -4,59 +4,81 @@ def start():
|
||||
pass
|
||||
|
||||
config = [{
|
||||
'name': 'global',
|
||||
'tab': 'general',
|
||||
'options': {
|
||||
'debug': {
|
||||
'name': 'core',
|
||||
'groups': [
|
||||
{
|
||||
'tab': 'general',
|
||||
'name': 'basics',
|
||||
'label': 'Basics',
|
||||
'description': 'Needs restart before changes take effect.',
|
||||
'options': [
|
||||
{
|
||||
'name': 'username',
|
||||
'default': '',
|
||||
'type': 'string',
|
||||
'label': 'Username',
|
||||
},
|
||||
{
|
||||
'name': 'password',
|
||||
'default': '',
|
||||
'password': True,
|
||||
'type': 'string',
|
||||
'label': 'Password',
|
||||
},
|
||||
{
|
||||
'name': 'host',
|
||||
'advanced': True,
|
||||
'default': '0.0.0.0',
|
||||
'type': 'string',
|
||||
'label': 'Host',
|
||||
'description': 'Host that I should listen to. "0.0.0.0" listens to all ips.',
|
||||
},
|
||||
{
|
||||
'name': 'port',
|
||||
'default': 5000,
|
||||
'type': 'int',
|
||||
'label': 'Port',
|
||||
'description': 'The port I should listen to.',
|
||||
},
|
||||
{
|
||||
'name': 'launch_browser',
|
||||
'default': True,
|
||||
'type': 'bool',
|
||||
'label': 'Launch Browser',
|
||||
'description': 'Launch the browser when I start.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'tab': 'general',
|
||||
'name': 'advanced',
|
||||
'label': 'Advanced',
|
||||
'description': "For those who know what the're doing",
|
||||
'advanced': True,
|
||||
'default': False,
|
||||
'type': 'bool',
|
||||
'label': 'Debug',
|
||||
'description': 'Enable debugging.',
|
||||
'options': [
|
||||
{
|
||||
'name': 'api_key',
|
||||
'default': uuid4().hex,
|
||||
'type': 'string',
|
||||
'readonly': True,
|
||||
'label': 'Api Key',
|
||||
'description': "This is top-secret! Don't share this!",
|
||||
},
|
||||
{
|
||||
'name': 'debug',
|
||||
'default': False,
|
||||
'type': 'bool',
|
||||
'label': 'Debug',
|
||||
'description': 'Enable debugging.',
|
||||
},
|
||||
{
|
||||
'name': 'url_base',
|
||||
'default': '',
|
||||
'type': 'string',
|
||||
'label': 'Url Base',
|
||||
'description': 'When using mod_proxy use this to prepend the url with this.',
|
||||
},
|
||||
],
|
||||
},
|
||||
'host': {
|
||||
'advanced': True,
|
||||
'default': '0.0.0.0',
|
||||
'type': 'string',
|
||||
'label': 'Host',
|
||||
'description': 'Host that I should listen to 0.0.0.0 listens to everything.',
|
||||
},
|
||||
'port': {
|
||||
'default': 5000,
|
||||
'type': 'int',
|
||||
'label': 'Port',
|
||||
'description': 'The port I should listen to.',
|
||||
},
|
||||
'username': {
|
||||
'default': '',
|
||||
'type': 'string',
|
||||
'label': 'Username',
|
||||
},
|
||||
'password': {
|
||||
'default': '',
|
||||
'password': True,
|
||||
'type': 'string',
|
||||
'label': 'Password',
|
||||
},
|
||||
'launch_browser': {
|
||||
'default': True,
|
||||
'type': 'bool',
|
||||
'label': 'Launch Browser',
|
||||
'description': 'Launch the browser when I start.',
|
||||
},
|
||||
'url_base': {
|
||||
'advanced': True,
|
||||
'default': '',
|
||||
'type': 'string',
|
||||
'label': 'Url Base',
|
||||
'description': 'When using mod_proxy use this to prepend the url with this.',
|
||||
},
|
||||
'api_key': {
|
||||
'default': uuid4().hex,
|
||||
'type': 'string',
|
||||
'readonly': True,
|
||||
'label': 'Api Key',
|
||||
'description': 'This is top-secret! Don\'t share this!',
|
||||
}
|
||||
}
|
||||
],
|
||||
}]
|
||||
@@ -53,8 +53,9 @@ class Loader:
|
||||
for section in module.config:
|
||||
fireEventAsync('settings.options', section['name'], section)
|
||||
options = {}
|
||||
for key, option in section['options'].iteritems():
|
||||
options[key] = option['default']
|
||||
for group in section['groups']:
|
||||
for option in group['options']:
|
||||
options[option['name']] = option['default']
|
||||
fireEventAsync('settings.register', section_name = section['name'], options = options, save = save)
|
||||
return True
|
||||
except Exception, e:
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
def start():
|
||||
pass
|
||||
|
||||
config = [{
|
||||
'name': 'Renamer',
|
||||
'tab': 'renaming',
|
||||
'options': {
|
||||
'enabled': {
|
||||
'default': False,
|
||||
'type': 'bool',
|
||||
'description': 'Enable renaming',
|
||||
},
|
||||
'from': {
|
||||
'default': '',
|
||||
'type': 'directory',
|
||||
'label': 'From',
|
||||
'description': 'Folder where the movies are downloaded to.',
|
||||
},
|
||||
'to': {
|
||||
'default': '',
|
||||
'type': 'directory',
|
||||
'label': 'To',
|
||||
'description': 'Folder where the movies will be moved to.',
|
||||
},
|
||||
'run_every': {
|
||||
'default': 1,
|
||||
'type': 'int',
|
||||
'unit': 'min(s)',
|
||||
'description': 'Search for new movies inside the folder every X minutes.',
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
#config = [{
|
||||
# 'name': 'Renamer',
|
||||
# 'tab': 'renaming',
|
||||
# 'options': {
|
||||
# 'enabled': {
|
||||
# 'default': False,
|
||||
# 'type': 'bool',
|
||||
# 'description': 'Enable renaming',
|
||||
# },
|
||||
# 'from': {
|
||||
# 'default': '',
|
||||
# 'type': 'directory',
|
||||
# 'label': 'From',
|
||||
# 'description': 'Folder where the movies are downloaded to.',
|
||||
# },
|
||||
# 'to': {
|
||||
# 'default': '',
|
||||
# 'type': 'directory',
|
||||
# 'label': 'To',
|
||||
# 'description': 'Folder where the movies will be moved to.',
|
||||
# },
|
||||
# 'run_every': {
|
||||
# 'default': 1,
|
||||
# 'type': 'int',
|
||||
# 'unit': 'min(s)',
|
||||
# 'description': 'Search for new movies inside the folder every X minutes.',
|
||||
# }
|
||||
# }
|
||||
#}]
|
||||
config = []
|
||||
@@ -4,14 +4,22 @@ def start():
|
||||
return TMDB()
|
||||
|
||||
config = [{
|
||||
'name': 'TheMovieDB',
|
||||
'tab': 'providers',
|
||||
'options': {
|
||||
'api_key': {
|
||||
'name': 'themoviedb',
|
||||
'groups': [
|
||||
{
|
||||
'tab': 'providers',
|
||||
'name': 'tmdb',
|
||||
'label': 'TheMovieDB',
|
||||
'advanced': True,
|
||||
'default': '9b939aee0aaafc12a65bf448e4af9543',
|
||||
'type': 'string',
|
||||
'description': 'Api key to use for calls to TheMovieDB.',
|
||||
}
|
||||
}
|
||||
'options': [
|
||||
{
|
||||
'name': 'api_key',
|
||||
'default': '9b939aee0aaafc12a65bf448e4af9543',
|
||||
'type': 'string',
|
||||
'label': 'Api Key',
|
||||
'description': 'Used for all calls to TheMovieDB.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}]
|
||||
@@ -5,8 +5,9 @@ from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.providers.base import Provider
|
||||
from couchpotato.environment import Env
|
||||
from urllib import quote_plus
|
||||
import urllib2
|
||||
import copy
|
||||
import simplejson as json
|
||||
import urllib2
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
@@ -21,7 +22,7 @@ class TMDB(Provider):
|
||||
addEvent('provider.movie.search', self.search)
|
||||
|
||||
def conf(self, attr):
|
||||
return Env.setting(attr, 'TheMovieDB')
|
||||
return Env.setting(attr, 'themoviedb')
|
||||
|
||||
def search(self, q, limit = 12, alternative = True):
|
||||
''' Find movie by name '''
|
||||
@@ -48,7 +49,7 @@ class TMDB(Provider):
|
||||
nr = 0
|
||||
for movie in data:
|
||||
|
||||
year = movie['released'][:4]
|
||||
year = str(movie['released'])[:4]
|
||||
|
||||
# Poster url
|
||||
poster = ''
|
||||
@@ -59,7 +60,7 @@ class TMDB(Provider):
|
||||
break
|
||||
|
||||
# 1900 is the same as None
|
||||
if year == '1900':
|
||||
if year == '1900' or year.lower() == 'none':
|
||||
year = None
|
||||
|
||||
movie_data = {
|
||||
@@ -70,14 +71,13 @@ class TMDB(Provider):
|
||||
'year': year,
|
||||
'tagline': 'This is the tagline of the movie',
|
||||
}
|
||||
results.append(movie_data)
|
||||
results.append(copy.deepcopy(movie_data))
|
||||
|
||||
alternativeName = movie['alternative_name']
|
||||
if alternativeName and alternative:
|
||||
if alternativeName.lower() != movie['name'].lower() and alternativeName.lower() != 'none' and alternativeName != None:
|
||||
movie_data['name'] = toUnicode(alternativeName)
|
||||
results.append(movie_data)
|
||||
|
||||
results.append(copy.deepcopy(movie_data))
|
||||
nr += 1
|
||||
if nr == limit:
|
||||
break
|
||||
|
||||
@@ -52,7 +52,7 @@ class Settings():
|
||||
def set(self, section, option, value):
|
||||
return self.p.set(section, option, self.cleanValue(value))
|
||||
|
||||
def get(self, option = '', section = 'global', default = ''):
|
||||
def get(self, option = '', section = 'core', default = ''):
|
||||
try:
|
||||
value = self.p.get(section, option)
|
||||
return self.cleanValue(value)
|
||||
|
||||
@@ -121,3 +121,12 @@ class RenameHistory(Entity):
|
||||
new = Field(String(255))
|
||||
|
||||
file = ManyToOne('File')
|
||||
|
||||
|
||||
def setup():
|
||||
""" Setup the database and create the tables that don't exists yet """
|
||||
from elixir import setup_all, create_all
|
||||
from couchpotato import get_engine
|
||||
|
||||
setup_all()
|
||||
create_all(get_engine())
|
||||
Reference in new issue
Block a user