mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07: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:
parent
f2df76783a
commit
ecd0fb50a8
3 changed files with 20 additions and 17 deletions
|
@ -118,19 +118,29 @@ namespace NzbDrone.Core.Providers
|
|||
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue