last used quality profile is now used as default

pull/3113/head
kay.one 12 years ago
parent 465dc725c8
commit e4e6bcae1d

@ -30,7 +30,6 @@ namespace NzbDrone.Api.Series
Get["/{slug}"] = o => GetSeries((string)o.slug.ToString()); Get["/{slug}"] = o => GetSeries((string)o.slug.ToString());
SharedValidator.RuleFor(s => s.QualityProfileId).ValidId(); SharedValidator.RuleFor(s => s.QualityProfileId).ValidId();
SharedValidator.RuleFor(s => s.Path).NotEmpty().When(s => String.IsNullOrEmpty(s.RootFolderPath)); SharedValidator.RuleFor(s => s.Path).NotEmpty().When(s => String.IsNullOrEmpty(s.RootFolderPath));
SharedValidator.RuleFor(s => s.RootFolderPath).NotEmpty().When(s => String.IsNullOrEmpty(s.Path)); SharedValidator.RuleFor(s => s.RootFolderPath).NotEmpty().When(s => String.IsNullOrEmpty(s.Path));

@ -136,13 +136,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("Sorting_SeasonFolderFormat", value); } set { SetValue("Sorting_SeasonFolderFormat", value); }
} }
public int DefaultQualityProfile
{
get { return GetValueInt("DefaultQualityProfile", 1); }
set { SetValue("DefaultQualityProfile", value); }
}
public string UpdateUrl public string UpdateUrl
{ {
get { return GetValue("UpdateUrl", "http://update.nzbdrone.com/vnext/"); } get { return GetValue("UpdateUrl", "http://update.nzbdrone.com/vnext/"); }

@ -22,7 +22,6 @@ namespace NzbDrone.Core.Configuration
String DownloadedEpisodesFolder { get; set; } String DownloadedEpisodesFolder { get; set; }
bool UseSeasonFolder { get; set; } bool UseSeasonFolder { get; set; }
string SortingSeasonFolderFormat { get; set; } string SortingSeasonFolderFormat { get; set; }
int DefaultQualityProfile { get; set; }
bool EnableBacklogSearching { get; set; } bool EnableBacklogSearching { get; set; }
bool AutoIgnorePreviouslyDownloadedEpisodes { get; set; } bool AutoIgnorePreviouslyDownloadedEpisodes { get; set; }
int Retention { get; set; } int Retention { get; set; }

@ -114,11 +114,6 @@ namespace NzbDrone.Core.Tv
newSeries.Monitored = true; newSeries.Monitored = true;
newSeries.CleanTitle = Parser.Parser.NormalizeTitle(newSeries.Title); newSeries.CleanTitle = Parser.Parser.NormalizeTitle(newSeries.Title);
if (newSeries.QualityProfileId == 0)
{
newSeries.QualityProfileId = _configService.DefaultQualityProfile;
}
newSeries.SeasonFolder = _configService.UseSeasonFolder; newSeries.SeasonFolder = _configService.UseSeasonFolder;
newSeries.BacklogSetting = BacklogSettingType.Inherit; newSeries.BacklogSetting = BacklogSettingType.Inherit;

@ -1,13 +1,13 @@
"use strict"; "use strict";
define([ define([
'app', 'app',
'AddSeries/RootFolders/RootFolderCollection',
'Quality/QualityProfileCollection', 'Quality/QualityProfileCollection',
'AddSeries/RootFolders/RootFolderCollection',
'AddSeries/RootFolders/RootFolderView', 'AddSeries/RootFolders/RootFolderView',
'AddSeries/AddSeriesView', 'AddSeries/AddSeriesView',
'AddSeries/Existing/ImportSeriesView' 'AddSeries/Existing/ImportSeriesView'
], ],
function (app, rootFolderCollection, qualityProfileCollection) { function (app, qualityProfileCollection, rootFolderCollection) {
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
template: 'AddSeries/addSeriesLayoutTemplate', template: 'AddSeries/addSeriesLayoutTemplate',

@ -1,7 +1,6 @@
'use strict'; 'use strict';
define([ define([
'app', 'AddSeries/RootFolders/RootFolderCollection', 'app', 'AddSeries/RootFolders/RootFolderCollection',
'Quality/QualityProfileCollection',
'AddSeries/Existing/UnmappedFolderModel', 'AddSeries/Existing/UnmappedFolderModel',
'AddSeries/Collection', 'AddSeries/Collection',
'AddSeries/SearchResultView', 'AddSeries/SearchResultView',
@ -22,7 +21,6 @@ define([
ui: { ui: {
searchButton: '.x-btn-search', searchButton: '.x-btn-search',
searchText : '.x-txt-search', searchText : '.x-txt-search',
profileList : '.x-lst-quality-profile',
searchBar : '.x-search-bar', searchBar : '.x-search-bar',
loadMore : '.x-load-more' loadMore : '.x-load-more'
}, },
@ -99,7 +97,6 @@ define([
itemViewOptions: function () { itemViewOptions: function () {
return { return {
qualityProfile: this.ui.profileList,
rootFolder : this.model.get('rootFolder'), rootFolder : this.model.get('rootFolder'),
folder : this.model.get('folder').path, folder : this.model.get('folder').path,
isExisting : true isExisting : true

@ -1,13 +1,8 @@
'use strict'; 'use strict';
define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfiles) { define(['app'], function () {
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({ NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
defaults: {
quality: qualityProfiles
}
}); });
NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({ NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({

@ -1,5 +1,4 @@
<select class="span6 x-root-folder"> <select class="span6 x-root-folder">
{{debug}}
{{#each this}} {{#each this}}
<option value="{{id}}">{{path}}</option> <option value="{{id}}">{{path}}</option>
{{/each}} {{/each}}

@ -19,13 +19,11 @@
<icon class="icon-plus"></icon> <icon class="icon-plus"></icon>
</div> </div>
{{#unless isExisting}} {{#unless isExisting}}
{{rootFolderSelection}} {{rootFolderSelection}}
{{/unless}} {{/unless}}
<select class="span2 x-quality-profile pull-right"> <div class='pull-right'>
{{#each qualityProfiles.models}} {{qualityProfileSelection}}
<option value="{{id}}">{{attributes.name}}</option> </div>
{{/each}}
</select>
</div> </div>
</div> </div>
</div> </div>

@ -1,5 +1,10 @@
'use strict'; 'use strict';
define(['app', 'Series/SeriesCollection', 'AddSeries/RootFolders/RootFolderTemplateHelper'], function () { define(['app',
'Quality/QualityProfileCollection',
'Config',
'Series/SeriesCollection',
'AddSeries/RootFolders/RootFolderTemplateHelper',
'Quality/QualityProfileTemplateHelper'], function (app, qualityProfiles) {
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.ItemView.extend({ NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.ItemView.extend({
@ -13,7 +18,8 @@ define(['app', 'Series/SeriesCollection', 'AddSeries/RootFolders/RootFolderTempl
}, },
events: { events: {
'click .x-add': 'addSeries' 'click .x-add' : 'addSeries',
'change .x-quality-profile': '_qualityProfileChanged'
}, },
initialize: function () { initialize: function () {
@ -24,12 +30,33 @@ define(['app', 'Series/SeriesCollection', 'AddSeries/RootFolders/RootFolderTempl
this.model.set('isExisting', this.options.isExisting); this.model.set('isExisting', this.options.isExisting);
this.model.set('path', this.options.folder); this.model.set('path', this.options.folder);
NzbDrone.vent.on(NzbDrone.Config.Events.ConfigUpdatedEvent, this._onConfigUpdated, this);
},
_onConfigUpdated: function (options) {
if (options.key === NzbDrone.Config.Keys.DefaultQualityProfileId) {
this.$('.x-quality-profile').val(options.value);
}
},
_qualityProfileChanged: function () {
NzbDrone.Config.SetValue(NzbDrone.Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val());
}, },
onRender: function () { onRender: function () {
this.listenTo(this.model, 'change', this.render); this.listenTo(this.model, 'change', this.render);
var defaultQuality = NzbDrone.Config.GetValue(NzbDrone.Config.Keys.DefaultQualityProfileId);
if (qualityProfiles.get(defaultQuality)) {
this.ui.qualityProfile.val(defaultQuality);
}
}, },
addSeries: function () { addSeries: function () {
var icon = this.ui.addButton.find('icon'); var icon = this.ui.addButton.find('icon');
icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled'); icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled');

@ -1,6 +1,15 @@
"use strict"; "use strict";
define(['app'], function () { define(['app'], function () {
NzbDrone.Config = {
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
Keys : {
DefaultQualityProfileId: 'DefaultQualityProfileId'
}
};
NzbDrone.Config.GetValue = function (key, defaultValue) { NzbDrone.Config.GetValue = function (key, defaultValue) {
var storeValue = localStorage.getItem(key); var storeValue = localStorage.getItem(key);
@ -9,12 +18,20 @@ define(['app'], function () {
return defaultValue; return defaultValue;
} }
return storeValue; return storeValue.toString();
}; };
NzbDrone.Config.SetValue = function (key, value) { NzbDrone.Config.SetValue = function (key, value) {
console.log('Config: [{0}] => [{1}] '.format(key, value)); console.log('Config: [{0}] => [{1}] '.format(key, value));
if (NzbDrone.Config.GetValue(key) === value.toString()) {
return;
}
localStorage.setItem(key, value); localStorage.setItem(key, value);
NzbDrone.vent.trigger(NzbDrone.Config.Events.ConfigUpdatedEvent, {key: key, value: value});
}; };
}); });

@ -0,0 +1,5 @@
<select class="span2 x-quality-profile">
{{#each this}}
<option value="{{id}}">{{name}}</option>
{{/each}}
</select>

@ -0,0 +1,10 @@
'use strict';
define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfiles) {
Handlebars.registerHelper('qualityProfileSelection', function () {
var templateFunction = Marionette.TemplateCache.get('Quality/QualityProfileSelectionTemplate');
return new Handlebars.SafeString(templateFunction(qualityProfiles.toJSON()));
});
});

@ -3,7 +3,6 @@ define([
'app', 'app',
'Quality/QualityProfileCollection', 'Quality/QualityProfileCollection',
'Quality/QualitySizeCollection', 'Quality/QualitySizeCollection',
'Settings/Quality/QualityView',
'Settings/Quality/Profile/QualityProfileCollectionView', 'Settings/Quality/Profile/QualityProfileCollectionView',
'Settings/Quality/Size/QualitySizeCollectionView' 'Settings/Quality/Size/QualitySizeCollectionView'
], ],
@ -33,7 +32,6 @@ define([
}, },
onRender: function () { onRender: function () {
this.qualityStandard.show(new NzbDrone.Settings.Quality.QualityView({model: this.settings, qualityProfiles: qualityProfileCollection}));
this.qualityProfile.show(new NzbDrone.Settings.Quality.Profile.QualityProfileCollectionView({collection: qualityProfileCollection})); this.qualityProfile.show(new NzbDrone.Settings.Quality.Profile.QualityProfileCollectionView({collection: qualityProfileCollection}));
this.qualitySize.show(new NzbDrone.Settings.Quality.Size.QualitySizeCollectionView({collection: this.qualitySizeCollection})); this.qualitySize.show(new NzbDrone.Settings.Quality.Size.QualitySizeCollectionView({collection: this.qualitySizeCollection}));
} }

@ -1,14 +0,0 @@
<div class="control-group">
<label class="control-label">Default Quality Profile</label>
<div class="controls">
<select class="x-quality-profile" name="qualityProfileId">
{{#each qualityProfiles.models}}
<option value="{{id}}">{{attributes.name}}</option>
{{/each}}
</select>
<span class="help-inline">
<i class="icon-question-sign" title="The default quality to use when adding series to NzbDrone "></i>
</span>
</div>
</div>

@ -1,14 +0,0 @@
'use strict';
define([
'app', 'Settings/SettingsModel'
], function () {
NzbDrone.Settings.Quality.QualityView = Backbone.Marionette.ItemView.extend({
template : 'Settings/Quality/QualityTemplate',
className: 'form-horizontal',
initialize: function (options) {
this.qualityProfileCollection = options.qualityProfiles;
this.model.set({ qualityProfiles: this.qualityProfileCollection });
}
});
});
Loading…
Cancel
Save