mirror of https://github.com/Radarr/Radarr
Maybe fix issue with imported files not being linked to the movie?
This commit is contained in:
parent
15acb9d204
commit
3a4b01cf6f
|
@ -39,12 +39,15 @@ namespace NzbDrone.Core.MediaFiles
|
|||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IMediaFileRepository _mediaFileRepository;
|
||||
private readonly IMovieFileRepository _movieFileRepository;
|
||||
private readonly IMovieService _movieService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public MediaFileService(IMediaFileRepository mediaFileRepository, IMovieFileRepository movieFileRepository, IEventAggregator eventAggregator, Logger logger)
|
||||
public MediaFileService(IMediaFileRepository mediaFileRepository, IMovieFileRepository movieFileRepository, IMovieService movieService,
|
||||
IEventAggregator eventAggregator, Logger logger)
|
||||
{
|
||||
_mediaFileRepository = mediaFileRepository;
|
||||
_eventAggregator = eventAggregator;
|
||||
_movieService = movieService;
|
||||
_movieFileRepository = movieFileRepository;
|
||||
_logger = logger;
|
||||
}
|
||||
|
@ -143,7 +146,9 @@ namespace NzbDrone.Core.MediaFiles
|
|||
public MovieFile Add(MovieFile episodeFile)
|
||||
{
|
||||
var addedFile = _movieFileRepository.Insert(episodeFile);
|
||||
_movieService.SetFileId(episodeFile.Movie.Value, episodeFile); //Should not be necessary, but sometimes below fails?
|
||||
_eventAggregator.PublishEvent(new MovieFileAddedEvent(addedFile));
|
||||
|
||||
return addedFile;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace NzbDrone.Core.Tv
|
|||
List<Movie> GetMoviesBetweenDates(DateTime start, DateTime end, bool includeUnmonitored);
|
||||
PagingSpec<Movie> MoviesWithoutFiles(PagingSpec<Movie> pagingSpec);
|
||||
void DeleteMovie(int movieId, bool deleteFiles);
|
||||
void SetFileId(Movie movie, MovieFile movieFile);
|
||||
List<Movie> GetAllMovies();
|
||||
Movie UpdateMovie(Movie movie);
|
||||
List<Movie> UpdateMovie(List<Movie> movie);
|
||||
|
@ -299,6 +300,12 @@ namespace NzbDrone.Core.Tv
|
|||
_logger.Debug("Linking [{0}] > [{1}]", message.MovieFile.RelativePath, message.MovieFile.Movie.Value);
|
||||
}
|
||||
|
||||
public void SetFileId(Movie movie, MovieFile movieFile)
|
||||
{
|
||||
_movieRepository.SetFileId(movieFile.Id, movie.Id);
|
||||
_logger.Debug("Linking [{0}] > [{1}]", movieFile.RelativePath, movie);
|
||||
}
|
||||
|
||||
public void Handle(MovieFileDeletedEvent message)
|
||||
{
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ var _ = require('underscore');
|
|||
var $ = require('jquery');
|
||||
var vent = require('vent');
|
||||
var Backbone = require('backbone');
|
||||
var SeriesCollection = require('../Movies/FullMovieCollection');
|
||||
var FullMovieCollection = require('../Movies/FullMovieCollection');
|
||||
require('typeahead');
|
||||
|
||||
vent.on(vent.Hotkeys.NavbarSearch, function() {
|
||||
|
@ -11,7 +11,7 @@ vent.on(vent.Hotkeys.NavbarSearch, function() {
|
|||
|
||||
var substringMatcher = function() {
|
||||
return function findMatches (q, cb) {
|
||||
var matches = _.select(SeriesCollection.toJSON(), function(series) {
|
||||
var matches = _.select(FullMovieCollection.toJSON(), function(series) {
|
||||
return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1;
|
||||
});
|
||||
cb(matches);
|
||||
|
|
Loading…
Reference in New Issue