Default profiles
Profile JS fixes
This commit is contained in:
@@ -10,6 +10,7 @@ Block.Search = new Class({
|
||||
self.el = new Element('div.search_form').adopt(
|
||||
new Element('div.input').adopt(
|
||||
self.input = new Element('input.inlay', {
|
||||
'placeholder': 'Search for new movies',
|
||||
'events': {
|
||||
'keyup': self.keyup.bind(self),
|
||||
'focus': self.hideResults.bind(self, false)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from couchpotato import get_session
|
||||
from couchpotato.api import addApiView
|
||||
from couchpotato.core.event import addEvent, fireEvent
|
||||
from couchpotato.core.helpers.encoding import toUnicode
|
||||
from couchpotato.core.helpers.request import jsonified, getParams, getParam
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
@@ -17,6 +18,8 @@ class ProfilePlugin(Plugin):
|
||||
addApiView('profile.save', self.save)
|
||||
addApiView('profile.delete', self.delete)
|
||||
|
||||
addEvent('app.initialize', self.fill)
|
||||
|
||||
def all(self):
|
||||
|
||||
db = get_session()
|
||||
@@ -90,3 +93,44 @@ class ProfilePlugin(Plugin):
|
||||
'success': success,
|
||||
'message': message
|
||||
})
|
||||
|
||||
def fill(self):
|
||||
|
||||
db = get_session();
|
||||
|
||||
profiles = [{
|
||||
'label': 'Best',
|
||||
'qualities': ['720p', '1080p', 'brrip', 'dvdrip']
|
||||
}, {
|
||||
'label': 'HD',
|
||||
'qualities': ['720p', '1080p']
|
||||
}]
|
||||
|
||||
# Create default quality profile
|
||||
order = 99
|
||||
for profile in profiles:
|
||||
log.info('Creating default profile: %s' % profile.get('label'))
|
||||
p = Profile(
|
||||
label = toUnicode(profile.get('label')),
|
||||
order = order
|
||||
)
|
||||
db.add(p)
|
||||
|
||||
quality_order = 0
|
||||
for quality in profile.get('qualities'):
|
||||
quality = fireEvent('quality.single', identifier = quality, single = True)
|
||||
profile_type = ProfileType(
|
||||
quality_id = quality.get('id'),
|
||||
profile = p,
|
||||
finish = True,
|
||||
wait_for = 0,
|
||||
order = quality_order
|
||||
)
|
||||
p.types.append(profile_type)
|
||||
|
||||
db.commit()
|
||||
quality_order += 1
|
||||
|
||||
order += 1
|
||||
|
||||
return True
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
padding: 14px;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
.profile .qualities {
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.profile .formHint {
|
||||
width: 250px !important;
|
||||
|
||||
@@ -49,7 +49,7 @@ var Profile = new Class({
|
||||
new Element('label', {'text': 'Search for'}),
|
||||
self.type_container = new Element('ol.types'),
|
||||
new Element('div.formHint', {
|
||||
'html': "Search these qualities, from top to bottom. <br />Use the checkbox, if I don't have to search any further."
|
||||
'html': "Search these qualities (2 minimum), from top to bottom. Use the checkbox, to stop searching after it found this quality."
|
||||
})
|
||||
)
|
||||
);
|
||||
@@ -68,6 +68,8 @@ var Profile = new Class({
|
||||
if(self.save_timer) clearTimeout(self.save_timer);
|
||||
self.save_timer = (function(){
|
||||
|
||||
self.addType();
|
||||
|
||||
var data = self.getData();
|
||||
if(data.types.length < 2) return;
|
||||
|
||||
@@ -84,8 +86,6 @@ var Profile = new Class({
|
||||
}
|
||||
});
|
||||
|
||||
self.addType();
|
||||
|
||||
}).delay(delay, self)
|
||||
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@ class QualityPlugin(Plugin):
|
||||
{'identifier': 'brrip', 'size': (700, 7000), 'label': 'BR-Rip', 'alternative': ['bdrip'], 'allow': ['720p'], 'ext':['avi']},
|
||||
{'identifier': 'dvdr', 'size': (3000, 10000), 'label': 'DVD-R', 'alternative': [], 'allow': [], 'ext':['iso', 'img'], 'tags': ['pal', 'ntsc']},
|
||||
{'identifier': 'dvdrip', 'size': (600, 2400), 'label': 'DVD-Rip', 'alternative': [], 'allow': [], 'ext':['avi', 'mpg', 'mpeg']},
|
||||
{'identifier': 'scr', 'size': (600, 1600), 'label': 'Screener', 'alternative': ['dvdscr'], 'allow': ['dvdr'], 'ext':['avi', 'mpg', 'mpeg']},
|
||||
{'identifier': 'scr', 'size': (600, 1600), 'label': 'Screener', 'alternative': ['dvdscr', 'ppvrip'], 'allow': ['dvdr'], 'ext':['avi', 'mpg', 'mpeg']},
|
||||
{'identifier': 'r5', 'size': (600, 1000), 'label': 'R5', 'alternative': [], 'allow': ['dvdr'], 'ext':['avi', 'mpg', 'mpeg']},
|
||||
{'identifier': 'tc', 'size': (600, 1000), 'label': 'TeleCine', 'alternative': ['telecine'], 'allow': [], 'ext':['avi', 'mpg', 'mpeg']},
|
||||
{'identifier': 'ts', 'size': (600, 1000), 'label': 'TeleSync', 'alternative': ['telesync'], 'allow': [], 'ext':['avi', 'mpg', 'mpeg']},
|
||||
@@ -31,7 +31,8 @@ class QualityPlugin(Plugin):
|
||||
addEvent('quality.all', self.all)
|
||||
addEvent('quality.single', self.single)
|
||||
addEvent('quality.guess', self.guess)
|
||||
addEvent('app.load', self.fill)
|
||||
|
||||
addEvent('app.initialize', self.fill)
|
||||
|
||||
def all(self):
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ var QualityBase = new Class({
|
||||
self.settings = App.getPage('Settings')
|
||||
self.settings.addEvent('create', function(){
|
||||
var tab = self.settings.createTab('profile', {
|
||||
'label': 'Profiles',
|
||||
'label': 'Quality',
|
||||
'name': 'profile'
|
||||
});
|
||||
|
||||
@@ -53,8 +53,7 @@ var QualityBase = new Class({
|
||||
|
||||
self.settings.createGroup({
|
||||
'label': 'Quality Profiles',
|
||||
'description': 'Create your own profiles with multiple qualities.',
|
||||
'class': 'test123'
|
||||
'description': 'Create your own profiles with multiple qualities.'
|
||||
}).inject(self.content).adopt(
|
||||
new Element('a.add_new_profile', {
|
||||
'text': 'Create a new quality profile',
|
||||
|
||||
@@ -115,8 +115,10 @@ def runCouchPotato(options, base_path, args):
|
||||
|
||||
latest_db_version = version(repo)
|
||||
|
||||
initialize = True
|
||||
try:
|
||||
current_db_version = db_version(db, repo)
|
||||
initialize = False
|
||||
except:
|
||||
version_control(db, repo, version = latest_db_version)
|
||||
current_db_version = db_version(db, repo)
|
||||
@@ -131,6 +133,9 @@ def runCouchPotato(options, base_path, args):
|
||||
|
||||
fireEventAsync('app.load')
|
||||
|
||||
if initialize:
|
||||
fireEventAsync('app.initialize')
|
||||
|
||||
# Create app
|
||||
from couchpotato import app
|
||||
api_key = Env.setting('api_key')
|
||||
|
||||
@@ -61,8 +61,8 @@ var Question = new Class( {
|
||||
e.stop();
|
||||
new Request(Object.merge(options, {
|
||||
'url': options.href,
|
||||
'onSuccess': function() {
|
||||
(options.onSuccess || function(){})()
|
||||
'onComplete': function() {
|
||||
(options.onComplete || function(){})()
|
||||
self.close();
|
||||
}
|
||||
})).send();
|
||||
|
||||
Reference in New Issue
Block a user