Fixed: Errors after episode is imported

pull/4/head
Mark McDowall 10 years ago
parent ebf0dbc1d0
commit 57a95d4cc5

@ -2,9 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Api.Episodes; using NzbDrone.Api.Episodes;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.SignalR; using NzbDrone.SignalR;
@ -13,9 +11,10 @@ namespace NzbDrone.Api.Calendar
public class CalendarModule : EpisodeModuleWithSignalR public class CalendarModule : EpisodeModuleWithSignalR
{ {
public CalendarModule(IEpisodeService episodeService, public CalendarModule(IEpisodeService episodeService,
ISeriesService seriesService,
IQualityUpgradableSpecification qualityUpgradableSpecification, IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster) IBroadcastSignalRMessage signalRBroadcaster)
: base(episodeService, qualityUpgradableSpecification, signalRBroadcaster, "calendar") : base(episodeService, seriesService, qualityUpgradableSpecification, signalRBroadcaster, "calendar")
{ {
GetResourceAll = GetCalendar; GetResourceAll = GetCalendar;
} }

@ -1,7 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Api.REST; using NzbDrone.Api.REST;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Api.Mapping;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.SignalR; using NzbDrone.SignalR;
@ -9,16 +8,12 @@ namespace NzbDrone.Api.Episodes
{ {
public class EpisodeModule : EpisodeModuleWithSignalR public class EpisodeModule : EpisodeModuleWithSignalR
{ {
protected readonly ISeriesService _seriesService;
public EpisodeModule(ISeriesService seriesService, public EpisodeModule(ISeriesService seriesService,
IEpisodeService episodeService, IEpisodeService episodeService,
IQualityUpgradableSpecification qualityUpgradableSpecification, IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster) IBroadcastSignalRMessage signalRBroadcaster)
: base(episodeService, qualityUpgradableSpecification, signalRBroadcaster) : base(episodeService, seriesService, qualityUpgradableSpecification, signalRBroadcaster)
{ {
_seriesService = seriesService;
GetResourceAll = GetEpisodes; GetResourceAll = GetEpisodes;
UpdateResource = SetMonitored; UpdateResource = SetMonitored;
} }
@ -32,8 +27,6 @@ namespace NzbDrone.Api.Episodes
throw new BadRequestException("seriesId is missing"); throw new BadRequestException("seriesId is missing");
} }
var series = _seriesService.GetSeries(seriesId.Value);
var resources = ToListResource(_episodeService.GetEpisodeBySeries(seriesId.Value)); var resources = ToListResource(_episodeService.GetEpisodeBySeries(seriesId.Value));
return resources; return resources;

@ -17,26 +17,31 @@ namespace NzbDrone.Api.Episodes
IHandle<EpisodeDownloadedEvent> IHandle<EpisodeDownloadedEvent>
{ {
protected readonly IEpisodeService _episodeService; protected readonly IEpisodeService _episodeService;
protected readonly ISeriesService _seriesService;
protected readonly IQualityUpgradableSpecification _qualityUpgradableSpecification; protected readonly IQualityUpgradableSpecification _qualityUpgradableSpecification;
protected EpisodeModuleWithSignalR(IEpisodeService episodeService, protected EpisodeModuleWithSignalR(IEpisodeService episodeService,
ISeriesService seriesService,
IQualityUpgradableSpecification qualityUpgradableSpecification, IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster) IBroadcastSignalRMessage signalRBroadcaster)
: base(signalRBroadcaster) : base(signalRBroadcaster)
{ {
_episodeService = episodeService; _episodeService = episodeService;
_seriesService = seriesService;
_qualityUpgradableSpecification = qualityUpgradableSpecification; _qualityUpgradableSpecification = qualityUpgradableSpecification;
GetResourceById = GetEpisode; GetResourceById = GetEpisode;
} }
protected EpisodeModuleWithSignalR(IEpisodeService episodeService, protected EpisodeModuleWithSignalR(IEpisodeService episodeService,
ISeriesService seriesService,
IQualityUpgradableSpecification qualityUpgradableSpecification, IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster, IBroadcastSignalRMessage signalRBroadcaster,
String resource) String resource)
: base(signalRBroadcaster, resource) : base(signalRBroadcaster, resource)
{ {
_episodeService = episodeService; _episodeService = episodeService;
_seriesService = seriesService;
_qualityUpgradableSpecification = qualityUpgradableSpecification; _qualityUpgradableSpecification = qualityUpgradableSpecification;
GetResourceById = GetEpisode; GetResourceById = GetEpisode;
@ -46,6 +51,7 @@ namespace NzbDrone.Api.Episodes
{ {
var episode = _episodeService.GetEpisode(id); var episode = _episodeService.GetEpisode(id);
episode.EpisodeFile.LazyLoad(); episode.EpisodeFile.LazyLoad();
episode.Series = _seriesService.GetSeries(episode.SeriesId);
return ToResource(episode); return ToResource(episode);
} }

@ -1,6 +1,4 @@
using System.Linq; using NzbDrone.Api.Episodes;
using NzbDrone.Api.Episodes;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
@ -14,9 +12,10 @@ namespace NzbDrone.Api.Wanted
public CutoffModule(IEpisodeCutoffService episodeCutoffService, public CutoffModule(IEpisodeCutoffService episodeCutoffService,
IEpisodeService episodeService, IEpisodeService episodeService,
ISeriesService seriesService,
IQualityUpgradableSpecification qualityUpgradableSpecification, IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster) IBroadcastSignalRMessage signalRBroadcaster)
: base(episodeService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/cutoff") : base(episodeService, seriesService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/cutoff")
{ {
_episodeCutoffService = episodeCutoffService; _episodeCutoffService = episodeCutoffService;
GetResourcePaged = GetCutoffUnmetEpisodes; GetResourcePaged = GetCutoffUnmetEpisodes;

@ -1,10 +1,6 @@
using System; using NzbDrone.Api.Episodes;
using System.Linq;
using NzbDrone.Api.Episodes;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.SignalR; using NzbDrone.SignalR;
@ -13,9 +9,10 @@ namespace NzbDrone.Api.Wanted
public class MissingModule : EpisodeModuleWithSignalR public class MissingModule : EpisodeModuleWithSignalR
{ {
public MissingModule(IEpisodeService episodeService, public MissingModule(IEpisodeService episodeService,
ISeriesService seriesService,
IQualityUpgradableSpecification qualityUpgradableSpecification, IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster) IBroadcastSignalRMessage signalRBroadcaster)
: base(episodeService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/missing") : base(episodeService, seriesService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/missing")
{ {
GetResourcePaged = GetMissingEpisodes; GetResourcePaged = GetMissingEpisodes;
} }

Loading…
Cancel
Save