1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-12 11:15:43 +02:00

Removed extra injects that weren't needed.

Wrapped find series in try/catch to prevent a case where the series is in SceneMapping, but isn't in the users database. -Missed in last commit apparently.
This commit is contained in:
Mark McDowall 2011-06-21 18:10:31 -07:00
parent f2df76783a
commit ecd0fb50a8
3 changed files with 20 additions and 17 deletions

View File

@ -118,19 +118,29 @@ public virtual void AddSeries(string path, int tvDbSeriesId, int qualityProfileI
public virtual Series FindSeries(string title)
{
var normalizeTitle = Parser.NormalizeTitle(title);
var seriesId = _sceneNameMappingProvider.GetSeriesId(normalizeTitle);
if (seriesId != null)
try
{
return GetSeries(seriesId.Value);
}
var normalizeTitle = Parser.NormalizeTitle(title);
var series = _database.Fetch<Series, QualityProfile>(@"SELECT * FROM Series
var seriesId = _sceneNameMappingProvider.GetSeriesId(normalizeTitle);
if (seriesId != null)
{
return GetSeries(seriesId.Value);
}
var series = _database.Fetch<Series, QualityProfile>(@"SELECT * FROM Series
INNER JOIN QualityProfiles ON Series.QualityProfileId = QualityProfiles.QualityProfileId
WHERE CleanTitle = @0", normalizeTitle).FirstOrDefault();
return series;
return series;
}
//This will catch InvalidOperationExceptions that may be thrown for GetSeries due to the series being in SceneMapping, but not in the users Database
catch (InvalidOperationException ex)
{
Logger.DebugException(ex.Message, ex);
return null;
}
}
public virtual void UpdateSeries(Series series)

View File

@ -12,15 +12,10 @@ namespace NzbDrone.Web.Controllers
public class HistoryController : Controller
{
private readonly HistoryProvider _historyProvider;
private readonly EpisodeProvider _episodeProvider;
private readonly SeriesProvider _seriesProvider;
public HistoryController(HistoryProvider historyProvider, EpisodeProvider episodeProvider,
SeriesProvider seriesProvider)
public HistoryController(HistoryProvider historyProvider)
{
_historyProvider = historyProvider;
_episodeProvider = episodeProvider;
_seriesProvider = seriesProvider;
}
//

View File

@ -11,12 +11,10 @@ namespace NzbDrone.Web.Controllers
public class UpcomingController : Controller
{
private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider;
private readonly SeriesProvider _seriesProvider;
public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider, SeriesProvider seriesProvider)
public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider)
{
_upcomingEpisodesProvider = upcomingEpisodesProvider;
_seriesProvider = seriesProvider;
}
//