mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Searching for movies directly when adding them is now working.
This commit is contained in:
parent
329786365d
commit
d835c168d3
7 changed files with 80 additions and 6 deletions
|
@ -48,6 +48,7 @@ namespace NzbDrone.Api.Movie
|
||||||
public List<string> Genres { get; set; }
|
public List<string> Genres { get; set; }
|
||||||
public HashSet<int> Tags { get; set; }
|
public HashSet<int> Tags { get; set; }
|
||||||
public DateTime Added { get; set; }
|
public DateTime Added { get; set; }
|
||||||
|
public AddMovieOptions AddOptions { get; set; }
|
||||||
public Ratings Ratings { get; set; }
|
public Ratings Ratings { get; set; }
|
||||||
|
|
||||||
//TODO: Add series statistics as a property of the series (instead of individual properties)
|
//TODO: Add series statistics as a property of the series (instead of individual properties)
|
||||||
|
@ -110,6 +111,7 @@ namespace NzbDrone.Api.Movie
|
||||||
Genres = model.Genres,
|
Genres = model.Genres,
|
||||||
Tags = model.Tags,
|
Tags = model.Tags,
|
||||||
Added = model.Added,
|
Added = model.Added,
|
||||||
|
AddOptions = model.AddOptions,
|
||||||
Ratings = model.Ratings
|
Ratings = model.Ratings
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -152,6 +154,7 @@ namespace NzbDrone.Api.Movie
|
||||||
Genres = resource.Genres,
|
Genres = resource.Genres,
|
||||||
Tags = resource.Tags,
|
Tags = resource.Tags,
|
||||||
Added = resource.Added,
|
Added = resource.Added,
|
||||||
|
AddOptions = resource.AddOptions,
|
||||||
Ratings = resource.Ratings
|
Ratings = resource.Ratings
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -167,6 +170,7 @@ namespace NzbDrone.Api.Movie
|
||||||
|
|
||||||
movie.RootFolderPath = resource.RootFolderPath;
|
movie.RootFolderPath = resource.RootFolderPath;
|
||||||
movie.Tags = resource.Tags;
|
movie.Tags = resource.Tags;
|
||||||
|
movie.AddOptions = resource.AddOptions;
|
||||||
|
|
||||||
return movie;
|
return movie;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,8 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
.WithColumn("Ratings").AsString().Nullable()
|
.WithColumn("Ratings").AsString().Nullable()
|
||||||
.WithColumn("Genres").AsString().Nullable()
|
.WithColumn("Genres").AsString().Nullable()
|
||||||
.WithColumn("Tags").AsString().Nullable()
|
.WithColumn("Tags").AsString().Nullable()
|
||||||
.WithColumn("Certification").AsString().Nullable();
|
.WithColumn("Certification").AsString().Nullable()
|
||||||
|
.WithColumn("AddOptions").AsString().Nullable();
|
||||||
|
|
||||||
|
|
||||||
Create.TableForModel("Seasons")
|
Create.TableForModel("Seasons")
|
||||||
|
|
|
@ -1096,6 +1096,7 @@
|
||||||
<Compile Include="Tv\SeriesAddedHandler.cs" />
|
<Compile Include="Tv\SeriesAddedHandler.cs" />
|
||||||
<Compile Include="Tv\MovieRepository.cs" />
|
<Compile Include="Tv\MovieRepository.cs" />
|
||||||
<Compile Include="Tv\MovieEditedService.cs" />
|
<Compile Include="Tv\MovieEditedService.cs" />
|
||||||
|
<Compile Include="Tv\MovieScannedHandler.cs" />
|
||||||
<Compile Include="Tv\SeriesScannedHandler.cs" />
|
<Compile Include="Tv\SeriesScannedHandler.cs" />
|
||||||
<Compile Include="Tv\SeriesEditedService.cs" />
|
<Compile Include="Tv\SeriesEditedService.cs" />
|
||||||
<Compile Include="Tv\SeriesRepository.cs" />
|
<Compile Include="Tv\SeriesRepository.cs" />
|
||||||
|
|
|
@ -40,11 +40,16 @@ namespace NzbDrone.Core.Tv
|
||||||
public DateTime? InCinemas { get; set; }
|
public DateTime? InCinemas { get; set; }
|
||||||
public LazyLoaded<Profile> Profile { get; set; }
|
public LazyLoaded<Profile> Profile { get; set; }
|
||||||
public HashSet<int> Tags { get; set; }
|
public HashSet<int> Tags { get; set; }
|
||||||
// public AddMovieOptions AddOptions { get; set; }
|
public AddMovieOptions AddOptions { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format("[{0}][{1}]", ImdbId, Title.NullSafe());
|
return string.Format("[{0}][{1}]", ImdbId, Title.NullSafe());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AddMovieOptions : MonitoringOptions
|
||||||
|
{
|
||||||
|
public bool SearchForMovie { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
57
src/NzbDrone.Core/Tv/MovieScannedHandler.cs
Normal file
57
src/NzbDrone.Core/Tv/MovieScannedHandler.cs
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
using NLog;
|
||||||
|
using NzbDrone.Core.IndexerSearch;
|
||||||
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Tv
|
||||||
|
{
|
||||||
|
public class MovieScannedHandler : IHandle<MovieScannedEvent>,
|
||||||
|
IHandle<MovieScanSkippedEvent>
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IMovieService _movieService;
|
||||||
|
private readonly IManageCommandQueue _commandQueueManager;
|
||||||
|
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
|
public MovieScannedHandler( IMovieService movieService,
|
||||||
|
IManageCommandQueue commandQueueManager,
|
||||||
|
Logger logger)
|
||||||
|
{
|
||||||
|
_movieService = movieService;
|
||||||
|
_commandQueueManager = commandQueueManager;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleScanEvents(Movie movie)
|
||||||
|
{
|
||||||
|
if (movie.AddOptions == null)
|
||||||
|
{
|
||||||
|
//_episodeAddedService.SearchForRecentlyAdded(movie.Id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.Info("[{0}] was recently added, performing post-add actions", movie.Title);
|
||||||
|
//_episodeMonitoredService.SetEpisodeMonitoredStatus(movie, movie.AddOptions);
|
||||||
|
|
||||||
|
if (movie.AddOptions.SearchForMovie)
|
||||||
|
{
|
||||||
|
_commandQueueManager.Push(new MoviesSearchCommand { MovieId = movie.Id});
|
||||||
|
}
|
||||||
|
|
||||||
|
movie.AddOptions = null;
|
||||||
|
_movieService.RemoveAddOptions(movie);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(MovieScannedEvent message)
|
||||||
|
{
|
||||||
|
HandleScanEvents(message.Movie);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(MovieScanSkippedEvent message)
|
||||||
|
{
|
||||||
|
HandleScanEvents(message.Movie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ namespace NzbDrone.Core.Tv
|
||||||
Movie UpdateMovie(Movie movie);
|
Movie UpdateMovie(Movie movie);
|
||||||
List<Movie> UpdateMovie(List<Movie> movie);
|
List<Movie> UpdateMovie(List<Movie> movie);
|
||||||
bool MoviePathExists(string folder);
|
bool MoviePathExists(string folder);
|
||||||
|
void RemoveAddOptions(Movie movie);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MovieService : IMovieService
|
public class MovieService : IMovieService
|
||||||
|
@ -190,5 +191,9 @@ namespace NzbDrone.Core.Tv
|
||||||
return _movieRepository.MoviePathExists(folder);
|
return _movieRepository.MoviePathExists(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveAddOptions(Movie movie)
|
||||||
|
{
|
||||||
|
_movieRepository.SetFields(movie, s => s.AddOptions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,14 +153,14 @@ var view = Marionette.ItemView.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_addWithoutSearch : function() {
|
_addWithoutSearch : function() {
|
||||||
this._addMovies(true);
|
this._addMovies(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addAndSearch : function() {
|
_addAndSearch : function() {
|
||||||
this._addMovies(true);
|
this._addMovies(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addMovies : function(searchForMissingEpisodes) {
|
_addMovies : function(searchForMovie) {
|
||||||
var addButton = this.ui.addButton;
|
var addButton = this.ui.addButton;
|
||||||
var addSearchButton = this.ui.addSearchButton;
|
var addSearchButton = this.ui.addSearchButton;
|
||||||
|
|
||||||
|
@ -171,7 +171,8 @@ var view = Marionette.ItemView.extend({
|
||||||
var rootFolderPath = this.ui.rootFolder.children(':selected').text();
|
var rootFolderPath = this.ui.rootFolder.children(':selected').text();
|
||||||
|
|
||||||
var options = this._getAddMoviesOptions();
|
var options = this._getAddMoviesOptions();
|
||||||
options.searchForMissingEpisodes = searchForMissingEpisodes;
|
options.searchForMovie = searchForMovie;
|
||||||
|
console.warn(searchForMovie);
|
||||||
|
|
||||||
this.model.set({
|
this.model.set({
|
||||||
profileId : profile,
|
profileId : profile,
|
||||||
|
@ -186,7 +187,7 @@ var view = Marionette.ItemView.extend({
|
||||||
console.log(this.model.save);
|
console.log(this.model.save);
|
||||||
console.log(promise);
|
console.log(promise);
|
||||||
|
|
||||||
if (searchForMissingEpisodes) {
|
if (searchForMovie) {
|
||||||
this.ui.addSearchButton.spinForPromise(promise);
|
this.ui.addSearchButton.spinForPromise(promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue