Browse Source

Save 3d in quality profile

pull/3009/head
Ruud 11 years ago
parent
commit
f976e04597
  1. 17
      couchpotato/core/plugins/profile/main.py
  2. 52
      couchpotato/core/plugins/profile/static/profile.css
  3. 59
      couchpotato/core/plugins/profile/static/profile.js

17
couchpotato/core/plugins/profile/main.py

@ -79,7 +79,8 @@ class ProfilePlugin(Plugin):
'core': kwargs.get('core', False),
'qualities': [],
'wait_for': [],
'finish': []
'finish': [],
'3d': []
}
# Update types
@ -88,6 +89,7 @@ class ProfilePlugin(Plugin):
profile['qualities'].append(type.get('quality'))
profile['wait_for'].append(tryInt(type.get('wait_for')))
profile['finish'].append((tryInt(type.get('finish')) == 1) if order > 0 else True)
profile['3d'].append((tryInt(type.get('3d')) == 1) if order > 0 else True)
order += 1
id = kwargs.get('id')
@ -184,6 +186,14 @@ class ProfilePlugin(Plugin):
}, {
'label': 'SD',
'qualities': ['dvdrip', 'dvdr']
}, {
'label': 'Prefer 3D HD',
'qualities': ['720p', '1080p', '720p', '1080p'],
'3d': [True, True]
}, {
'label': '3D HD',
'qualities': ['720p', '1080p'],
'3d': [True, True]
}]
# Create default quality profile
@ -197,12 +207,15 @@ class ProfilePlugin(Plugin):
'order': order,
'qualities': profile.get('qualities'),
'finish': [],
'wait_for': []
'wait_for': [],
'3d': []
}
threed = profile.get('3d', [])
for q in profile.get('qualities'):
pro['finish'].append(True)
pro['wait_for'].append(0)
pro['3d'].append(threed.pop() if threed else False)
db.insert(pro)
order += 1

52
couchpotato/core/plugins/profile/static/profile.css

@ -29,11 +29,10 @@
.profile .qualities {
min-height: 80px;
padding-top: 0;
}
.profile .formHint {
width: 250px !important;
width: 210px !important;
vertical-align: top !important;
margin: 0 !important;
padding-left: 3px !important;
@ -78,21 +77,55 @@
}
.profile .quality_type select {
width: 186px;
width: 120px;
margin-left: -1px;
}
.profile .types li.is_empty .check, .profile .types li.is_empty .delete, .profile .types li.is_empty .handle {
.profile .types li.is_empty .check,
.profile .types li.is_empty .delete,
.profile .types li.is_empty .handle,
.profile .types li.is_empty .check_label {
visibility: hidden;
}
.profile .types .type label {
display: inline-block;
width: auto;
float: none;
text-transform: uppercase;
font-size: 11px;
font-weight: normal;
margin-right: 20px;
text-shadow: none;
vertical-align: bottom;
padding: 0;
height: 17px;
}
.profile .types .type label .check {
margin-right: 5px;
}
.profile .types .type label .check_label {
display: inline-block;
vertical-align: top;
height: 16px;
line-height: 13px;
}
.profile .types .type .threed {
display: none;
}
.profile .types .type.allow_3d .threed {
display: inline-block;
}
.profile .types .type .handle {
background: url('../../static/profile_plugin/handle.png') center;
background: url('../../plugin/profile_plugin/handle.png') center;
display: inline-block;
height: 20px;
width: 20px;
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: -webkit-grab;
cursor: grab;
margin: 0;
}
@ -106,6 +139,9 @@
font-size: 13px;
color: #fd5353;
}
.profile .types .type:not(.allow_3d) .delete {
margin-left: 55px;
}
.profile .types .type:hover:not(.is_empty) .delete {
visibility: visible;
@ -144,7 +180,7 @@
}
#profile_ordering li .handle {
background: url('../../static/profile_plugin/handle.png') center;
background: url('../../plugin/profile_plugin/handle.png') center;
width: 20px;
float: right;
}
@ -154,4 +190,4 @@
float: right;
width: 250px;
margin: 0;
}
}

59
couchpotato/core/plugins/profile/static/profile.js

@ -63,6 +63,7 @@ var Profile = new Class({
data.types.include({
'quality': quality,
'finish': data.finish[nr] || false,
'3d': data['3d'] ? data['3d'][nr] || false : false,
'wait_for': data.wait_for[nr] || 0
})
});
@ -124,7 +125,8 @@ var Profile = new Class({
if(!type.hasClass('deleted') && type.getElement('select').get('value') != -1)
data.types.include({
'quality': type.getElement('select').get('value'),
'finish': +type.getElement('input[type=checkbox]').checked,
'finish': +type.getElement('input.finish[type=checkbox]').checked,
'3d': +type.getElement('input.3d[type=checkbox]').checked,
'wait_for': 0
});
})
@ -240,6 +242,7 @@ Profile.Type = new Class({
self.addEvent('change', function(){
self.el[self.qualities.get('value') == '-1' ? 'addClass' : 'removeClass']('is_empty');
self.el[Quality.getQuality(self.qualities.get('value')).allow_3d ? 'addClass': 'removeClass']('allow_3d');
self.deleted = self.qualities.get('value') == '-1';
});
@ -250,24 +253,40 @@ Profile.Type = new Class({
var data = self.data;
self.el = new Element('li.type').adopt(
new Element('span.quality_type').adopt(
new Element('span.quality_type').grab(
self.fillQualities()
),
new Element('span.finish').adopt(
self.finish = new Element('input.inlay.finish[type=checkbox]', {
'checked': data.finish !== undefined ? data.finish : 1,
'events': {
'change': function(e){
if(self.el == self.el.getParent().getElement(':first-child')){
self.finish_class.check();
alert('Top quality always finishes the search')
return;
self.finish_container = new Element('label.finish').adopt(
new Element('span.finish').grab(
self.finish = new Element('input.inlay.finish[type=checkbox]', {
'checked': data.finish !== undefined ? data.finish : 1,
'events': {
'change': function(e){
if(self.el == self.el.getParent().getElement(':first-child')){
self.finish_class.check();
alert('Top quality always finishes the search')
return;
}
self.fireEvent('change');
}
self.fireEvent('change');
}
}
})
})
),
new Element('span.check_label[text=finish]')
),
self['3d_container'] = new Element('label.threed').adopt(
new Element('span.3d').grab(
self['3d'] = new Element('input.inlay.3d[type=checkbox]', {
'checked': data['3d'] !== undefined ? data['3d'] : 1,
'events': {
'change': function(e){
self.fireEvent('change');
}
}
})
),
new Element('span.check_label[text=3D]')
),
new Element('span.delete.icon2', {
'events': {
@ -279,7 +298,11 @@ Profile.Type = new Class({
self.el[self.data.quality ? 'removeClass' : 'addClass']('is_empty');
if(self.data.quality && Quality.getQuality(self.data.quality).allow_3d)
self.el.addClass('allow_3d');
self.finish_class = new Form.Check(self.finish);
self['3d_class'] = new Form.Check(self['3d']);
},
@ -290,7 +313,7 @@ Profile.Type = new Class({
'events': {
'change': self.fireEvent.bind(self, 'change')
}
}).adopt(
}).grab(
new Element('option', {
'text': '+ Add another quality',
'value': -1
@ -300,7 +323,8 @@ Profile.Type = new Class({
Object.each(Quality.qualities, function(q){
new Element('option', {
'text': q.label,
'value': q.identifier
'value': q.identifier,
'data-allow_3d': q.allow_3d
}).inject(self.qualities)
});
@ -316,6 +340,7 @@ Profile.Type = new Class({
return {
'quality': self.qualities.get('value'),
'finish': +self.finish.checked,
'3d': +self['3d'].checked,
'wait_for': 0
}
},

Loading…
Cancel
Save