From 5f8aeeac17bcfd2ca7e3eb1816a51bf0216ba5fd Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Fri, 2 Feb 2018 14:51:18 +0100 Subject: [PATCH] Fixed: Manual Import not automatically choosing right movie. Fixes #2458, Fixes #2061 Generally improved Manual Import UI --- .../.idea.NzbDrone/.idea/contentModel.xml | 29 +++++++++---------- .../ManualImport/ManualImportResource.cs | 5 +++- .../runConfigurations/Debug___Chrome.xml | 6 ++-- src/UI/ManualImport/ManualImportCollection.js | 4 +-- src/UI/ManualImport/ManualImportRow.js | 10 +++---- .../ManualImport/Movie/SelectMovieLayout.js | 4 +-- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/.idea/.idea.NzbDrone/.idea/contentModel.xml b/src/.idea/.idea.NzbDrone/.idea/contentModel.xml index bced20297..cdf041d4b 100644 --- a/src/.idea/.idea.NzbDrone/.idea/contentModel.xml +++ b/src/.idea/.idea.NzbDrone/.idea/contentModel.xml @@ -1408,6 +1408,7 @@ + @@ -1554,6 +1555,7 @@ + @@ -1609,6 +1611,7 @@ + @@ -2004,6 +2007,7 @@ + @@ -2337,18 +2341,19 @@ - + + + + + - - - @@ -2357,11 +2362,11 @@ - - - + + + @@ -3053,15 +3058,9 @@ - - - - - - - - + + diff --git a/src/NzbDrone.Api/ManualImport/ManualImportResource.cs b/src/NzbDrone.Api/ManualImport/ManualImportResource.cs index bc7b87408..70b86dfdd 100644 --- a/src/NzbDrone.Api/ManualImport/ManualImportResource.cs +++ b/src/NzbDrone.Api/ManualImport/ManualImportResource.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using NzbDrone.Api.Episodes; +using NzbDrone.Api.Movie; using NzbDrone.Api.REST; using NzbDrone.Api.Series; using NzbDrone.Common.Crypto; @@ -16,8 +17,9 @@ namespace NzbDrone.Api.ManualImport public string Name { get; set; } public long Size { get; set; } public SeriesResource Series { get; set; } + public MovieResource Movie { get; set; } public int? SeasonNumber { get; set; } - public List Episodes { get; set; } + public List Episodes { get; set; } public QualityModel Quality { get; set; } public int QualityWeight { get; set; } public string DownloadId { get; set; } @@ -39,6 +41,7 @@ namespace NzbDrone.Api.ManualImport Name = model.Name, Size = model.Size, Series = model.Series.ToResource(), + Movie = model.Movie.ToResource(), SeasonNumber = model.SeasonNumber, Episodes = model.Episodes.ToResource(), Quality = model.Quality, diff --git a/src/UI/.idea/runConfigurations/Debug___Chrome.xml b/src/UI/.idea/runConfigurations/Debug___Chrome.xml index 61758c015..d26613fb6 100644 --- a/src/UI/.idea/runConfigurations/Debug___Chrome.xml +++ b/src/UI/.idea/runConfigurations/Debug___Chrome.xml @@ -1,17 +1,17 @@ - + + - + - diff --git a/src/UI/ManualImport/ManualImportCollection.js b/src/UI/ManualImport/ManualImportCollection.js index c7cff70f7..10778af38 100644 --- a/src/UI/ManualImport/ManualImportCollection.js +++ b/src/UI/ManualImport/ManualImportCollection.js @@ -36,7 +36,7 @@ var Collection = PageableCollection.extend({ }, sortMappings : { - series : { + movie : { sortValue : function(model, attr, order) { var series = model.get(attr); @@ -71,4 +71,4 @@ var Collection = PageableCollection.extend({ Collection = AsSortedCollection.call(Collection); -module.exports = Collection; \ No newline at end of file +module.exports = Collection; diff --git a/src/UI/ManualImport/ManualImportRow.js b/src/UI/ManualImport/ManualImportRow.js index 5699e83c3..de549beb4 100644 --- a/src/UI/ManualImport/ManualImportRow.js +++ b/src/UI/ManualImport/ManualImportRow.js @@ -22,9 +22,7 @@ module.exports = Backgrid.Row.extend({ }, _setError : function () { - if (this.model.has('series') && - this.model.has('seasonNumber') && - (this.model.has('episodes') && this.model.get('episodes').length > 0)&& + if (this.model.has('movie') && this.model.has('quality')) { this.$el.removeClass('manual-import-error'); } @@ -35,7 +33,7 @@ module.exports = Backgrid.Row.extend({ }, _setClasses : function () { - this.$el.toggleClass('has-series', this.model.has('series')); - this.$el.toggleClass('has-season', this.model.has('seasonNumber')); + this.$el.toggleClass('has-movie', this.model.has('movie')); + //this.$el.toggleClass('has-season', this.model.has('seasonNumber')); } -}); \ No newline at end of file +}); diff --git a/src/UI/ManualImport/Movie/SelectMovieLayout.js b/src/UI/ManualImport/Movie/SelectMovieLayout.js index a70f26a6e..b3031e4c8 100644 --- a/src/UI/ManualImport/Movie/SelectMovieLayout.js +++ b/src/UI/ManualImport/Movie/SelectMovieLayout.js @@ -87,8 +87,8 @@ module.exports = Marionette.Layout.extend({ _filter : function (term) { this.movieCollection.reset(this.fullMovieCollection.filter(function(model){ - return model.get("title").toLowerCase().indexOf(term.toLowerCase()) != -1; - }).slice(0, 20)); + return (model.get("title") + " ("+model.get("year")+")").toLowerCase().indexOf(term.toLowerCase()) != -1; + }).slice(0, 50)); this._setModelCollection(); //this.movieView.render();