mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Loads only request movie first into full collection. Should fix things. (#1046)
Fixes #982
This commit is contained in:
parent
af2b5c2f1c
commit
24a394bf46
@ -3,6 +3,7 @@
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
@ -33,6 +34,8 @@ public class MovieModule : NzbDroneRestModuleWithSignalR<MovieResource, Core.Tv.
|
||||
private readonly IMovieStatisticsService _moviesStatisticsService;
|
||||
private readonly IMapCoversToLocal _coverMapper;
|
||||
|
||||
private const string TITLE_SLUG_ROUTE = "/titleslug/(?<slug>[^/]+)";
|
||||
|
||||
public MovieModule(IBroadcastSignalRMessage signalRBroadcaster,
|
||||
IMovieService moviesService,
|
||||
IMovieStatisticsService moviesStatisticsService,
|
||||
@ -55,6 +58,9 @@ ProfileExistsValidator profileExistsValidator
|
||||
GetResourceAll = AllMovie;
|
||||
GetResourcePaged = GetMoviePaged;
|
||||
GetResourceById = GetMovie;
|
||||
Get[TITLE_SLUG_ROUTE] = (options) => {
|
||||
return ReqResExtensions.AsResponse(GetByTitleSlug(options.slug));
|
||||
};
|
||||
CreateResource = AddMovie;
|
||||
UpdateResource = UpdateMovie;
|
||||
DeleteResource = DeleteMovie;
|
||||
@ -186,6 +192,11 @@ private List<MovieResource> AllMovie()
|
||||
return moviesResources;
|
||||
}
|
||||
|
||||
private MovieResource GetByTitleSlug(string slug)
|
||||
{
|
||||
return MapToResource(_moviesService.FindByTitleSlug(slug));
|
||||
}
|
||||
|
||||
private int AddMovie(MovieResource moviesResource)
|
||||
{
|
||||
var model = moviesResource.ToModel();
|
||||
|
@ -1,6 +1,7 @@
|
||||
var movieCollection = require('./MoviesCollection');
|
||||
|
||||
var fullCollection = movieCollection.clone();
|
||||
fullCollection.reset();
|
||||
fullCollection.bindSignalR();
|
||||
fullCollection.state.pageSize = 100000;
|
||||
fullCollection.fetch({reset : true});
|
||||
|
@ -4,6 +4,7 @@ var MoviesCollection = require('./MoviesCollection');
|
||||
var FullMovieCollection = require("./FullMovieCollection");
|
||||
var MoviesIndexLayout = require('./Index/MoviesIndexLayout');
|
||||
var MoviesDetailsLayout = require('./Details/MoviesDetailsLayout');
|
||||
var $ = require('jquery');
|
||||
|
||||
module.exports = NzbDroneController.extend({
|
||||
_originalInit : NzbDroneController.prototype.initialize,
|
||||
@ -25,8 +26,15 @@ module.exports = NzbDroneController.extend({
|
||||
|
||||
if(FullMovieCollection.length > 0) {
|
||||
this._renderMovieDetails(query);
|
||||
//debugger;
|
||||
} else {
|
||||
self = this;
|
||||
$.getJSON(window.NzbDrone.ApiRoot + '/movie/titleslug/'+query, { }, function(data) {
|
||||
FullMovieCollection.add(data)
|
||||
self._renderMovieDetails(query);
|
||||
});
|
||||
this.listenTo(FullMovieCollection, 'sync', function(model, options) {
|
||||
//debugger;
|
||||
this._renderMovieDetails(query);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user