From 7c5f2ca54e29aaf03204d253dd3ff165eb7f5b97 Mon Sep 17 00:00:00 2001 From: Tim Turner Date: Sat, 14 Jan 2017 23:04:31 -0500 Subject: [PATCH 01/61] 95% done with hiding existing movies --- src/UI/AddMovies/AddMoviesLayout.js | 12 +++++++-- src/UI/AddMovies/AddMoviesLayoutTemplate.hbs | 25 +++++++++++++++++++ src/UI/AddMovies/AddMoviesView.js | 1 + .../AddExistingMovieCollectionView.js | 1 + .../AddMovies/RootFolders/RootFolderLayout.js | 2 +- .../RootFolders/RootFolderLayoutTemplate.hbs | 2 ++ .../AddMovies/SearchResultCollectionView.js | 22 ++++++++++++++-- src/UI/AddMovies/SearchResultView.js | 10 +++----- src/UI/vent.js | 3 ++- 9 files changed, 66 insertions(+), 12 deletions(-) diff --git a/src/UI/AddMovies/AddMoviesLayout.js b/src/UI/AddMovies/AddMoviesLayout.js index 3dd299959..30cbc74b3 100644 --- a/src/UI/AddMovies/AddMoviesLayout.js +++ b/src/UI/AddMovies/AddMoviesLayout.js @@ -17,7 +17,8 @@ module.exports = Marionette.Layout.extend({ events : { 'click .x-import' : '_importMovies', - 'click .x-add-new' : '_addMovies' + 'click .x-add-new' : '_addMovies', + 'click .x-show-existing' : '_toggleExisting' }, attributes : { @@ -31,13 +32,20 @@ module.exports = Marionette.Layout.extend({ }); }, + _toggleExisting : function(e) { + var showExisting = e.target.checked; + + vent.trigger(vent.Commands.ShowExistingCommand, { + showExisting: showExisting + }); + }, + onShow : function() { this.workspace.show(new AddMoviesView()); }, _folderSelected : function(options) { vent.trigger(vent.Commands.CloseModalCommand); - //TODO: Fix this shit. this.workspace.show(new ExistingMoviesCollectionView({ model : options.model })); }, diff --git a/src/UI/AddMovies/AddMoviesLayoutTemplate.hbs b/src/UI/AddMovies/AddMoviesLayoutTemplate.hbs index 9eccf4d91..2ad44bee5 100644 --- a/src/UI/AddMovies/AddMoviesLayoutTemplate.hbs +++ b/src/UI/AddMovies/AddMoviesLayoutTemplate.hbs @@ -9,6 +9,31 @@ +
+
+
+ + +
+
+
+
+
+
diff --git a/src/UI/AddMovies/AddMoviesView.js b/src/UI/AddMovies/AddMoviesView.js index ca47d5368..57b6de239 100644 --- a/src/UI/AddMovies/AddMoviesView.js +++ b/src/UI/AddMovies/AddMoviesView.js @@ -27,6 +27,7 @@ module.exports = Marionette.Layout.extend({ initialize : function(options) { console.log(options); + this.isExisting = options.isExisting; this.collection = new AddMoviesCollection(); diff --git a/src/UI/AddMovies/Existing/AddExistingMovieCollectionView.js b/src/UI/AddMovies/Existing/AddExistingMovieCollectionView.js index 1e3d38b6a..8b556c812 100644 --- a/src/UI/AddMovies/Existing/AddExistingMovieCollectionView.js +++ b/src/UI/AddMovies/Existing/AddExistingMovieCollectionView.js @@ -1,6 +1,7 @@ var Marionette = require('marionette'); var AddMoviesView = require('../AddMoviesView'); var UnmappedFolderCollection = require('./UnmappedFolderCollection'); +var vent = require('vent'); module.exports = Marionette.CompositeView.extend({ itemView : AddMoviesView, diff --git a/src/UI/AddMovies/RootFolders/RootFolderLayout.js b/src/UI/AddMovies/RootFolders/RootFolderLayout.js index f48890076..f0d9f3614 100644 --- a/src/UI/AddMovies/RootFolders/RootFolderLayout.js +++ b/src/UI/AddMovies/RootFolders/RootFolderLayout.js @@ -48,7 +48,7 @@ var Layout = Marionette.Layout.extend({ var self = this; var newDir = new RootFolderModel({ - Path : this.ui.pathInput.val() + Path : this.ui.pathInput.val(), }); this.bindToModelValidation(newDir); diff --git a/src/UI/AddMovies/RootFolders/RootFolderLayoutTemplate.hbs b/src/UI/AddMovies/RootFolders/RootFolderLayoutTemplate.hbs index 1d6eae265..54bfc192d 100644 --- a/src/UI/AddMovies/RootFolders/RootFolderLayoutTemplate.hbs +++ b/src/UI/AddMovies/RootFolders/RootFolderLayoutTemplate.hbs @@ -31,6 +31,8 @@
diff --git a/src/UI/AddMovies/SearchResultCollectionView.js b/src/UI/AddMovies/SearchResultCollectionView.js index 02fe1fa41..08649436c 100644 --- a/src/UI/AddMovies/SearchResultCollectionView.js +++ b/src/UI/AddMovies/SearchResultCollectionView.js @@ -1,12 +1,21 @@ var Marionette = require('marionette'); var SearchResultView = require('./SearchResultView'); +var vent = require('vent'); module.exports = Marionette.CollectionView.extend({ itemView : SearchResultView, initialize : function(options) { + this.showExisting = true; this.isExisting = options.isExisting; this.showing = 1; + vent.on(vent.Commands.ShowExistingCommand, this._onExistingToggle.bind(this)); + }, + + _onExistingToggle : function(data) { + this.showExisting = data.showExisting; + + this.render(); }, showAll : function() { @@ -34,8 +43,17 @@ module.exports = Marionette.CollectionView.extend({ }, appendHtml : function(collectionView, itemView, index) { - if (!this.isExisting || index < this.showing || index === 0) { - collectionView.$el.append(itemView.el); + if(this.isExisting) { + if(this.showExisting) { + if (index < this.showing || index === 0) { + collectionView.$el.append(itemView.el); + } + } + } else if(!this.isExisting) { + if (index < this.showing || index === 0) { + collectionView.$el.append(itemView.el); + } } + } }); diff --git a/src/UI/AddMovies/SearchResultView.js b/src/UI/AddMovies/SearchResultView.js index f563e6f66..f4d3a18f6 100644 --- a/src/UI/AddMovies/SearchResultView.js +++ b/src/UI/AddMovies/SearchResultView.js @@ -43,7 +43,7 @@ var view = Marionette.ItemView.extend({ throw 'model is required'; } - console.log(this.route); + //console.log(this.route); this.templateHelpers = {}; this._configureTemplateHelpers(); @@ -92,14 +92,12 @@ var view = Marionette.ItemView.extend({ _configureTemplateHelpers : function() { var existingMovies = MoviesCollection.where({ tmdbId : this.model.get('tmdbId') }); - console.log(existingMovies); if (existingMovies.length > 0) { this.templateHelpers.existing = existingMovies[0].toJSON(); } this.templateHelpers.profiles = Profiles.toJSON(); - console.log(this.model); - console.log(this.templateHelpers.existing); + //console.log(this.templateHelpers.isExisting); if (!this.model.get('isExisting')) { this.templateHelpers.rootFolders = RootFolders.toJSON(); } @@ -185,8 +183,8 @@ var view = Marionette.ItemView.extend({ var self = this; var promise = this.model.save(); - console.log(this.model.save); - console.log(promise); + //console.log(this.model.save); + //console.log(promise); if (searchForMovie) { this.ui.addSearchButton.spinForPromise(promise); diff --git a/src/UI/vent.js b/src/UI/vent.js index a623f2dbc..1962f9d22 100644 --- a/src/UI/vent.js +++ b/src/UI/vent.js @@ -29,7 +29,8 @@ vent.Commands = { ShowFileBrowser : 'showFileBrowser', CloseFileBrowser : 'closeFileBrowser', OpenControlPanelCommand : 'OpenControlPanelCommand', - CloseControlPanelCommand : 'CloseControlPanelCommand' + CloseControlPanelCommand : 'CloseControlPanelCommand', + ShowExistingCommand : 'ShowExistingCommand' }; vent.Hotkeys = { From c2d40051d4f9a188097936f91f8853b55854802b Mon Sep 17 00:00:00 2001 From: Tim Turner Date: Sun, 15 Jan 2017 11:34:43 -0500 Subject: [PATCH 02/61] First pass at hiding existing movies upon import Fixes #183 --- src/UI/AddMovies/AddMoviesLayoutTemplate.hbs | 32 ++++++++++--------- .../AddMovies/SearchResultCollectionView.js | 7 ++-- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/UI/AddMovies/AddMoviesLayoutTemplate.hbs b/src/UI/AddMovies/AddMoviesLayoutTemplate.hbs index 2ad44bee5..c2f9ce419 100644 --- a/src/UI/AddMovies/AddMoviesLayoutTemplate.hbs +++ b/src/UI/AddMovies/AddMoviesLayoutTemplate.hbs @@ -11,24 +11,26 @@
-
- +
+
+ -
-
-
diff --git a/src/UI/Movies/Index/Overview/SeriesOverviewItemViewTemplate.hbs b/src/UI/Movies/Index/Overview/SeriesOverviewItemViewTemplate.hbs index b1181c07d..64cfa2aba 100644 --- a/src/UI/Movies/Index/Overview/SeriesOverviewItemViewTemplate.hbs +++ b/src/UI/Movies/Index/Overview/SeriesOverviewItemViewTemplate.hbs @@ -54,6 +54,10 @@ {{#if imdbId}} IMDB {{/if}} + + {{#if youTubeTrailerId}} + Trailer + {{/if}}
diff --git a/src/UI/Movies/Index/Posters/SeriesPostersItemViewTemplate.hbs b/src/UI/Movies/Index/Posters/SeriesPostersItemViewTemplate.hbs index 92e6e3298..e00b317cd 100644 --- a/src/UI/Movies/Index/Posters/SeriesPostersItemViewTemplate.hbs +++ b/src/UI/Movies/Index/Posters/SeriesPostersItemViewTemplate.hbs @@ -26,7 +26,9 @@ {{#if imdbId}} IMDB {{/if}} - + {{#if youTubeTrailerId}} + Trailer + {{/if}}
diff --git a/src/UI/Movies/movies.less b/src/UI/Movies/movies.less index 6c19733dc..1c11da0a1 100644 --- a/src/UI/Movies/movies.less +++ b/src/UI/Movies/movies.less @@ -126,7 +126,7 @@ .card; .clickable; margin-bottom : 20px; - height : 324px; + height : 344px; .center { display : block; @@ -166,7 +166,7 @@ } @media (max-width: @screen-xs-max) { - height : 235px; + height : 268px; margin : 5px; padding : 6px 5px; From eb0f825cfca20b9bb8c6a20c027b735238014ca3 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Mon, 16 Jan 2017 00:10:30 +0100 Subject: [PATCH 05/61] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 402dfb1bf..b2eeb345d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ [![GitHub pull requests](https://img.shields.io/github/issues-pr/radarr/radarr.svg?maxAge=60&style=flat-square)](https://github.com/Radarr/Radarr/pulls) [![GNU GPL v3](https://img.shields.io/badge/license-GNU%20GPL%20v3-blue.svg?maxAge=60&style=flat-square)](http://www.gnu.org/licenses/gpl.html) [![Copyright 2010-2017](https://img.shields.io/badge/copyright-2017-blue.svg?maxAge=60&style=flat-square)](https://github.com/Radarr/Radarr) +[![Github Releases](https://img.shields.io/github/downloads/Radarr/Radarr/total.svg?maxAge=60&style=flat-square)](https://github.com/Radar/Radarr/releases/latest) +[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/radarr.svg?maxAge=60&style=flat-square)](https://hub.docker.com/r/linuxserver/radarr/) | Service | Master | Develop | |----------|:---------------------------:|:----------------------------:| From 42f84b830c2786298a82c4addc7501ce1ac140cb Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Mon, 16 Jan 2017 12:54:51 +0100 Subject: [PATCH 06/61] Update NewznabRequestGenerator.cs --- src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs index 71e0d806b..040276ed2 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs @@ -124,7 +124,7 @@ namespace NzbDrone.Core.Indexers.Newznab { var pageableRequests = new IndexerPageableRequestChain(); - if (false) + if (SupportsMovieSearch) { pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "movie", string.Format("&imdbid={0}", searchCriteria.Movie.ImdbId.Substring(2)))); //strip off the "tt" - VERY HACKY From 9b3b4eb55ba9b4713c8e0df5f8c0aee2b9a64f8e Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Mon, 16 Jan 2017 13:25:59 -0500 Subject: [PATCH 07/61] Removed duplicate PublishDate --- .../Indexers/TorrentPotato/TorrentPotatoParser.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs index fdaf7bb9d..2cb91c733 100644 --- a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs +++ b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs @@ -36,12 +36,11 @@ namespace NzbDrone.Core.Indexers.TorrentPotato torrentInfo.Size = (long)torrent.size*1000*1000; torrentInfo.DownloadUrl = torrent.download_url; torrentInfo.InfoUrl = torrent.details_url; - torrentInfo.PublishDate = new System.DateTime(); + torrentInfo.PublishDate = torrent.publishdate.ToUniversalTime(); torrentInfo.Seeders = torrent.seeders; torrentInfo.Peers = torrent.leechers + torrent.seeders; torrentInfo.Freeleech = torrent.freeleech; - torrentInfo.PublishDate = torrent.publishdate.ToUniversalTime(); - + results.Add(torrentInfo); } From 30d2b41fbb2f7c55db36eead05f5e8a9276ab030 Mon Sep 17 00:00:00 2001 From: Vlad Ilies Date: Mon, 16 Jan 2017 20:57:43 +0200 Subject: [PATCH 08/61] Added movie studio to movie details page (#262) * modified Movie model * db migration * ui template modification --- src/NzbDrone.Api/Series/MovieResource.cs | 7 +++++-- .../Migration/120_add_studio_to_table.cs | 20 +++++++++++++++++++ .../MetadataSource/SkyHook/SkyHookProxy.cs | 5 +++++ src/NzbDrone.Core/NzbDrone.Core.csproj | 1 + src/NzbDrone.Core/Tv/Movie.cs | 1 + src/NzbDrone.Core/Tv/RefreshMovieService.cs | 1 + src/UI/Movies/Details/InfoViewTemplate.hbs | 3 +++ 7 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/NzbDrone.Core/Datastore/Migration/120_add_studio_to_table.cs diff --git a/src/NzbDrone.Api/Series/MovieResource.cs b/src/NzbDrone.Api/Series/MovieResource.cs index d791ba130..66b47def1 100644 --- a/src/NzbDrone.Api/Series/MovieResource.cs +++ b/src/NzbDrone.Api/Series/MovieResource.cs @@ -35,6 +35,7 @@ namespace NzbDrone.Api.Movie public int Year { get; set; } public bool HasFile { get; set; } public string YouTubeTrailerId { get; set; } + public string Studio { get; set; } //View & Edit public string Path { get; set; } @@ -146,7 +147,8 @@ namespace NzbDrone.Api.Movie AlternativeTitles = model.AlternativeTitles, Ratings = model.Ratings, MovieFile = movieFile, - YouTubeTrailerId = model.YouTubeTrailerId + YouTubeTrailerId = model.YouTubeTrailerId, + Studio = model.Studio }; } @@ -194,7 +196,8 @@ namespace NzbDrone.Api.Movie AddOptions = resource.AddOptions, AlternativeTitles = resource.AlternativeTitles, Ratings = resource.Ratings, - YouTubeTrailerId = resource.YouTubeTrailerId + YouTubeTrailerId = resource.YouTubeTrailerId, + Studio = resource.Studio }; } diff --git a/src/NzbDrone.Core/Datastore/Migration/120_add_studio_to_table.cs b/src/NzbDrone.Core/Datastore/Migration/120_add_studio_to_table.cs new file mode 100644 index 000000000..823688c61 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/120_add_studio_to_table.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; +using System.Data; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(120)] + public class add_studio : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Table("Movies").AddColumn("Studio").AsString().Nullable(); + } + + } +} diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 55efffe74..4e8718944 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -162,6 +162,11 @@ namespace NzbDrone.Core.MetadataSource.SkyHook } } + if (resource.production_companies != null && resource.production_companies.Count() > 0) + { + movie.Studio = resource.production_companies[0].name; + } + return movie; } diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 87a4c28b2..e15d5d659 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -183,6 +183,7 @@ + diff --git a/src/NzbDrone.Core/Tv/Movie.cs b/src/NzbDrone.Core/Tv/Movie.cs index a96890e72..4c14a45d1 100644 --- a/src/NzbDrone.Core/Tv/Movie.cs +++ b/src/NzbDrone.Core/Tv/Movie.cs @@ -49,6 +49,7 @@ namespace NzbDrone.Core.Tv public int MovieFileId { get; set; } public List AlternativeTitles { get; set; } public string YouTubeTrailerId{ get; set; } + public string Studio { get; set; } public bool HasFile => MovieFileId > 0; diff --git a/src/NzbDrone.Core/Tv/RefreshMovieService.cs b/src/NzbDrone.Core/Tv/RefreshMovieService.cs index 3001bf953..a086cf3ec 100644 --- a/src/NzbDrone.Core/Tv/RefreshMovieService.cs +++ b/src/NzbDrone.Core/Tv/RefreshMovieService.cs @@ -85,6 +85,7 @@ namespace NzbDrone.Core.Tv movie.Year = movieInfo.Year; movie.PhysicalRelease = movieInfo.PhysicalRelease; movie.YouTubeTrailerId = movieInfo.YouTubeTrailerId; + movie.Studio = movieInfo.Studio; try { diff --git a/src/UI/Movies/Details/InfoViewTemplate.hbs b/src/UI/Movies/Details/InfoViewTemplate.hbs index 9c73ab5b1..70e190f28 100644 --- a/src/UI/Movies/Details/InfoViewTemplate.hbs +++ b/src/UI/Movies/Details/InfoViewTemplate.hbs @@ -6,6 +6,9 @@ {{network}} {{/if}} + {{#if studio}} + {{studio}} + {{/if}} {{runtime}} minutes {{path}} From 967d3fd5c08e02eabd83ec942a1afbee2a123033 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Mon, 16 Jan 2017 22:40:59 +0100 Subject: [PATCH 09/61] Add Calendar Tab back. Fixes #32 --- src/NzbDrone.Api/Calendar/CalendarModule.cs | 32 +- src/NzbDrone.Api/Series/MovieModule.cs | 24 +- src/NzbDrone.Core/Tv/MovieRepository.cs | 13 + src/NzbDrone.Core/Tv/MovieService.cs | 8 + src/UI/Activity/Queue/QueueCollection.js | 6 + src/UI/Calendar/CalendarCollection.js | 6 +- src/UI/Calendar/CalendarFeedViewTemplate.hbs | 128 +- src/UI/Calendar/CalendarLayoutTemplate.hbs | 14 +- src/UI/Calendar/CalendarView.js | 541 +- src/UI/Calendar/UpcomingCollection.js | 8 +- src/UI/Calendar/UpcomingItemView.js | 6 +- src/UI/Calendar/calendar.less | 453 +- src/UI/Content/fullcalendar.css | 505 +- src/UI/Handlebars/Helpers/Episode.js | 4 +- src/UI/JsLibraries/fullcalendar.js | 12941 +++++++++++------ src/UI/JsLibraries/moment.js | 6094 ++++---- src/UI/Movies/MoviesController.js | 48 +- 17 files changed, 12274 insertions(+), 8557 deletions(-) diff --git a/src/NzbDrone.Api/Calendar/CalendarModule.cs b/src/NzbDrone.Api/Calendar/CalendarModule.cs index f403b79c7..804546655 100644 --- a/src/NzbDrone.Api/Calendar/CalendarModule.cs +++ b/src/NzbDrone.Api/Calendar/CalendarModule.cs @@ -2,24 +2,38 @@ using System.Collections.Generic; using System.Linq; using NzbDrone.Api.Episodes; +using NzbDrone.Api.Movie; +using NzbDrone.Core.Datastore.Events; +using NzbDrone.Core.MediaCover; +using NzbDrone.Core.MediaFiles; +using NzbDrone.Core.MediaFiles.Events; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.MovieStats; +using NzbDrone.Core.Tv; +using NzbDrone.Core.Tv.Events; +using NzbDrone.Core.Validation.Paths; +using NzbDrone.Core.DataAugmentation.Scene; +using NzbDrone.Core.Validation; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Tv; using NzbDrone.SignalR; namespace NzbDrone.Api.Calendar { - public class CalendarModule : EpisodeModuleWithSignalR + public class CalendarModule : MovieModule { - public CalendarModule(IEpisodeService episodeService, - ISeriesService seriesService, - IQualityUpgradableSpecification qualityUpgradableSpecification, - IBroadcastSignalRMessage signalRBroadcaster) - : base(episodeService, seriesService, qualityUpgradableSpecification, signalRBroadcaster, "calendar") + public CalendarModule(IBroadcastSignalRMessage signalR, + IMovieService moviesService, + IMovieStatisticsService moviesStatisticsService, + ISceneMappingService sceneMappingService, + IMapCoversToLocal coverMapper) + : base(signalR, moviesService, moviesStatisticsService, sceneMappingService, coverMapper, "calendar") { + GetResourceAll = GetCalendar; } - private List GetCalendar() + private List GetCalendar() { var start = DateTime.Today; var end = DateTime.Today.AddDays(2); @@ -33,9 +47,9 @@ namespace NzbDrone.Api.Calendar if (queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value); if (queryIncludeUnmonitored.HasValue) includeUnmonitored = Convert.ToBoolean(queryIncludeUnmonitored.Value); - var resources = MapToResource(_episodeService.EpisodesBetweenDates(start, end, includeUnmonitored), true, true); + var resources = _moviesService.GetMoviesBetweenDates(start, end, includeUnmonitored).Select(MapToResource); - return resources.OrderBy(e => e.AirDateUtc).ToList(); + return resources.OrderBy(e => e.InCinemas).ToList(); } } } diff --git a/src/NzbDrone.Api/Series/MovieModule.cs b/src/NzbDrone.Api/Series/MovieModule.cs index a40695a1c..14fda80bc 100644 --- a/src/NzbDrone.Api/Series/MovieModule.cs +++ b/src/NzbDrone.Api/Series/MovieModule.cs @@ -28,7 +28,7 @@ namespace NzbDrone.Api.Movie IHandle { - private readonly IMovieService _moviesService; + protected readonly IMovieService _moviesService; private readonly IMovieStatisticsService _moviesStatisticsService; private readonly IMapCoversToLocal _coverMapper; @@ -78,13 +78,33 @@ namespace NzbDrone.Api.Movie PutValidator.RuleFor(s => s.Path).IsValidPath(); } + public MovieModule(IBroadcastSignalRMessage signalRBroadcaster, + IMovieService moviesService, + IMovieStatisticsService moviesStatisticsService, + ISceneMappingService sceneMappingService, + IMapCoversToLocal coverMapper, + string resource) + : base(signalRBroadcaster, resource) + { + _moviesService = moviesService; + _moviesStatisticsService = moviesStatisticsService; + + _coverMapper = coverMapper; + + GetResourceAll = AllMovie; + GetResourceById = GetMovie; + CreateResource = AddMovie; + UpdateResource = UpdateMovie; + DeleteResource = DeleteMovie; + } + private MovieResource GetMovie(int id) { var movies = _moviesService.GetMovie(id); return MapToResource(movies); } - private MovieResource MapToResource(Core.Tv.Movie movies) + protected MovieResource MapToResource(Core.Tv.Movie movies) { if (movies == null) return null; diff --git a/src/NzbDrone.Core/Tv/MovieRepository.cs b/src/NzbDrone.Core/Tv/MovieRepository.cs index 42bcddf48..f734c5174 100644 --- a/src/NzbDrone.Core/Tv/MovieRepository.cs +++ b/src/NzbDrone.Core/Tv/MovieRepository.cs @@ -14,6 +14,7 @@ namespace NzbDrone.Core.Tv Movie FindByTitle(string cleanTitle, int year); Movie FindByImdbId(string imdbid); Movie FindByTitleSlug(string slug); + List MoviesBetweenDates(DateTime start, DateTime end, bool includeUnmonitored); List GetMoviesByFileId(int fileId); void SetFileId(int fileId, int movieId); } @@ -119,5 +120,17 @@ namespace NzbDrone.Core.Tv { return Query.Where(m => m.TitleSlug == slug).FirstOrDefault(); } + + public List MoviesBetweenDates(DateTime start, DateTime end, bool includeUnmonitored) + { + var query = Query.Where(m => m.InCinemas >= start && m.InCinemas <= end).OrWhere(m => m.PhysicalRelease >= start && m.PhysicalRelease <= end); + + if (!includeUnmonitored) + { + query.AndWhere(e => e.Monitored); + } + + return query.ToList(); + } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Tv/MovieService.cs b/src/NzbDrone.Core/Tv/MovieService.cs index ac9c132db..0cbf226e4 100644 --- a/src/NzbDrone.Core/Tv/MovieService.cs +++ b/src/NzbDrone.Core/Tv/MovieService.cs @@ -26,6 +26,7 @@ namespace NzbDrone.Core.Tv Movie FindByTitleInexact(string title); Movie FindByTitleSlug(string slug); Movie GetMovieByFileId(int fileId); + List GetMoviesBetweenDates(DateTime start, DateTime end, bool includeUnmonitored); void DeleteMovie(int movieId, bool deleteFiles); List GetAllMovies(); Movie UpdateMovie(Movie movie); @@ -224,5 +225,12 @@ namespace NzbDrone.Core.Tv { return _movieRepository.FindByTitleSlug(slug); } + + public List GetMoviesBetweenDates(DateTime start, DateTime end, bool includeUnmonitored) + { + var episodes = _movieRepository.MoviesBetweenDates(start.ToUniversalTime(), end.ToUniversalTime(), includeUnmonitored); + + return episodes; + } } } diff --git a/src/UI/Activity/Queue/QueueCollection.js b/src/UI/Activity/Queue/QueueCollection.js index bd3aa065e..37a4983ae 100644 --- a/src/UI/Activity/Queue/QueueCollection.js +++ b/src/UI/Activity/Queue/QueueCollection.js @@ -26,6 +26,12 @@ var QueueCollection = PageableCollection.extend({ }); }, + findMovie : function(movieId) { + return _.find(this.fullCollection.models, function(queueModel) { + return queueModel.get('movie').id === movieId; + }); + }, + sortMappings : { series : { sortValue : function(model, attr) { diff --git a/src/UI/Calendar/CalendarCollection.js b/src/UI/Calendar/CalendarCollection.js index 12739955c..c60ed3722 100644 --- a/src/UI/Calendar/CalendarCollection.js +++ b/src/UI/Calendar/CalendarCollection.js @@ -1,5 +1,5 @@ var Backbone = require('backbone'); -var EpisodeModel = require('../Series/EpisodeModel'); +var EpisodeModel = require('../Movies/MovieModel'); module.exports = Backbone.Collection.extend({ url : window.NzbDrone.ApiRoot + '/calendar', @@ -7,8 +7,8 @@ module.exports = Backbone.Collection.extend({ tableName : 'calendar', comparator : function(model) { - var date = new Date(model.get('airDateUtc')); + var date = new Date(model.get('inCinemas')); var time = date.getTime(); return time; } -}); \ No newline at end of file +}); diff --git a/src/UI/Calendar/CalendarFeedViewTemplate.hbs b/src/UI/Calendar/CalendarFeedViewTemplate.hbs index 8d8e3c7be..0151d65b2 100644 --- a/src/UI/Calendar/CalendarFeedViewTemplate.hbs +++ b/src/UI/Calendar/CalendarFeedViewTemplate.hbs @@ -1,75 +1,57 @@