Pass at seeing if this works on linux now (#692)

Devin Buhl 8 years ago committed by GitHub
parent 61df3ef40e
commit 75436bcce4

@ -0,0 +1,78 @@
using NzbDrone.Api.Movie;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Tv;
using NzbDrone.SignalR;
namespace NzbDrone.Api.Movies
{
public abstract class MovieModuleWithSignalR : NzbDroneRestModuleWithSignalR<MovieResource, Core.Tv.Movie>,
IHandle<MovieGrabbedEvent>,
IHandle<MovieDownloadedEvent>
{
protected readonly IMovieService _episodeService;
protected readonly IQualityUpgradableSpecification _qualityUpgradableSpecification;
protected MovieModuleWithSignalR(IMovieService episodeService,
IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster)
: base(signalRBroadcaster)
{
_episodeService = episodeService;
_qualityUpgradableSpecification = qualityUpgradableSpecification;
GetResourceById = GetMovie;
}
protected MovieModuleWithSignalR(IMovieService episodeService,
IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster,
string resource)
: base(signalRBroadcaster, resource)
{
_episodeService = episodeService;
_qualityUpgradableSpecification = qualityUpgradableSpecification;
GetResourceById = GetMovie;
}
protected MovieResource GetMovie(int id)
{
var episode = _episodeService.GetMovie(id);
var resource = MapToResource(episode, true);
return resource;
}
protected MovieResource MapToResource(Core.Tv.Movie episode, bool includeSeries)
{
var resource = episode.ToResource();
if (includeSeries)
{
var series = episode ?? _episodeService.GetMovie(episode.Id);
resource = series.ToResource();
}
return resource;
}
public void Handle(MovieGrabbedEvent message)
{
var resource = message.Movie.Movie.ToResource();
//add a grabbed field in MovieResource?
//resource.Grabbed = true;
BroadcastResourceChange(ModelAction.Updated, resource);
}
public void Handle(MovieDownloadedEvent message)
{
var resource = message.Movie.Movie.ToResource();
BroadcastResourceChange(ModelAction.Updated, resource);
}
}
}

@ -118,6 +118,7 @@
<Compile Include="Frontend\Mappers\RobotsTxtMapper.cs" />
<Compile Include="Indexers\ReleaseModuleBase.cs" />
<Compile Include="Indexers\ReleasePushModule.cs" />
<Compile Include="Movies\MovieModuleWithSignalR.cs" />
<Compile Include="Movies\MovieBulkImportModule.cs" />
<Compile Include="Movies\MovieFileModule.cs" />
<Compile Include="Series\MovieModule.cs" />

@ -7,7 +7,7 @@ using NzbDrone.SignalR;
namespace NzbDrone.Api.Wanted
{
public class MovieCutoffModule : NzbDroneRestModuleWithSignalR<MovieResource, Core.Tv.Movie>
public class MovieCutoffModule : MovieModuleWithSignalR
{
private readonly IMovieCutoffService _movieCutoffService;
@ -15,7 +15,7 @@ namespace NzbDrone.Api.Wanted
IMovieService movieService,
IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster)
: base(signalRBroadcaster, "wanted/cutoff")
: base(movieService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/cutoff")
{
_movieCutoffService = movieCutoffService;
GetResourcePaged = GetCutoffUnmetMovies;
@ -34,15 +34,9 @@ namespace NzbDrone.Api.Wanted
pagingSpec.FilterExpression = v => v.Monitored == true;
}
var resource = ApplyToPage(_movieCutoffService.MoviesWhereCutoffUnmet, pagingSpec, v => MapToResource(v));
var resource = ApplyToPage(_movieCutoffService.MoviesWhereCutoffUnmet, pagingSpec, v => MapToResource(v, true));
return resource;
}
private MovieResource MapToResource(Core.Tv.Movie movie)
{
var resource = movie.ToResource();
return resource;
}
}
}

@ -12,16 +12,14 @@ using NzbDrone.Core.Datastore.Events;
namespace NzbDrone.Api.Wanted
{
class MovieMissingModule : NzbDroneRestModuleWithSignalR<MovieResource, Core.Tv.Movie>,
IHandle<MovieGrabbedEvent>,
IHandle<MovieDownloadedEvent>
class MovieMissingModule : MovieModuleWithSignalR
{
protected readonly IMovieService _movieService;
public MovieMissingModule(IMovieService movieService,
IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster)
: base(signalRBroadcaster, "wanted/missing")
: base(movieService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/missing")
{
_movieService = movieService;
@ -41,31 +39,9 @@ namespace NzbDrone.Api.Wanted
pagingSpec.FilterExpression = v => v.Monitored == true;
}
var resource = ApplyToPage(_movieService.MoviesWithoutFiles, pagingSpec, v => MapToResource(v, false));
var resource = ApplyToPage(_movieService.MoviesWithoutFiles, pagingSpec, v => MapToResource(v, true));
return resource;
}
private MovieResource MapToResource(Core.Tv.Movie movie, bool includeMovieFile)
{
var resource = movie.ToResource();
return resource;
}
public void Handle(MovieGrabbedEvent message)
{
var resource = message.Movie.Movie.ToResource();
//add a grabbed field in MovieResource?
//resource.Grabbed = true;
BroadcastResourceChange(ModelAction.Updated, resource);
}
public void Handle(MovieDownloadedEvent message)
{
var resource = message.Movie.Movie.ToResource();
BroadcastResourceChange(ModelAction.Updated, resource);
}
}
}

Loading…
Cancel
Save