mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-21 22:25:03 -04:00
[WIP] Additions to custom formats, such as rescanning old files. (#2949)
This commit is contained in:
@@ -1,22 +1,40 @@
|
||||
var _ = require('underscore');
|
||||
var Marionette = require('marionette');
|
||||
var Backbone = require('backbone');
|
||||
require('../../Mixins/TagInput');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'ManualImport/Quality/SelectQualityViewTemplate',
|
||||
|
||||
ui : {
|
||||
select : '.x-select-quality',
|
||||
proper : 'x-proper'
|
||||
proper : 'x-proper',
|
||||
formats: '.x-tags',
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
this.qualities = options.qualities;
|
||||
this.formats = options.formats;
|
||||
this.current = options.current || {};
|
||||
|
||||
this.templateHelpers = {
|
||||
qualities: this.qualities
|
||||
qualities: this.qualities,
|
||||
formats: JSON.stringify(_.map(this.formats, function(f) {
|
||||
return { value : f.id, name : f.name };
|
||||
})),
|
||||
};
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
if (this.current.formats != undefined) {
|
||||
this.ui.formats.val(this.current.formats.map(function(m) {return m.id;}).join(","));
|
||||
}
|
||||
if (this.current.quality != undefined) {
|
||||
this.ui.select.val(this.current.quality.id);
|
||||
}
|
||||
this.ui.formats.tagInput();
|
||||
},
|
||||
|
||||
selectedQuality : function () {
|
||||
var selected = parseInt(this.ui.select.val(), 10);
|
||||
var proper = this.ui.proper.prop('checked');
|
||||
@@ -25,13 +43,21 @@ module.exports = Marionette.ItemView.extend({
|
||||
return q.id === selected;
|
||||
});
|
||||
|
||||
var formatIds = this.ui.formats.val().split(',');
|
||||
|
||||
var formats = _.map(_.filter(this.formats, function(f) {
|
||||
return formatIds.includes(f.id + "");
|
||||
}), function(f) {
|
||||
return { name : f.name, id : f.id};
|
||||
});
|
||||
|
||||
return {
|
||||
quality : quality,
|
||||
revision : {
|
||||
version : proper ? 2 : 1,
|
||||
real : 0
|
||||
}
|
||||
},
|
||||
customFormats : formats
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user