mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 01:38:24 +00:00
Existing series won't blow up when tvdb dies
Fixed: Issues with TheTVDB won't cause the Add Series page to error out
This commit is contained in:
parent
8b45714e59
commit
8854269a43
2 changed files with 28 additions and 9 deletions
|
@ -3,6 +3,7 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
@ -23,6 +24,8 @@ public class AddSeriesController : Controller
|
|||
private readonly TvDbProvider _tvDbProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public AddSeriesController(RootDirProvider rootFolderProvider,
|
||||
ConfigProvider configProvider,
|
||||
QualityProvider qualityProvider, TvDbProvider tvDbProvider,
|
||||
|
@ -83,17 +86,26 @@ public ActionResult ExistingSeries()
|
|||
foreach (var folder in unmappedList)
|
||||
{
|
||||
var foldername = new DirectoryInfo(folder).Name;
|
||||
var tvdbResult = _tvDbProvider.SearchSeries(foldername).FirstOrDefault();
|
||||
|
||||
var title = String.Empty;
|
||||
var seriesId = 0;
|
||||
if (tvdbResult != null)
|
||||
try
|
||||
{
|
||||
title = tvdbResult.SeriesName;
|
||||
seriesId = tvdbResult.Id;
|
||||
}
|
||||
var tvdbResult = _tvDbProvider.SearchSeries(foldername).FirstOrDefault();
|
||||
|
||||
result.ExistingSeries.Add(new Tuple<string, string, int>(folder, title, seriesId));
|
||||
var title = String.Empty;
|
||||
var seriesId = 0;
|
||||
if (tvdbResult != null)
|
||||
{
|
||||
title = tvdbResult.SeriesName;
|
||||
seriesId = tvdbResult.Id;
|
||||
}
|
||||
|
||||
result.ExistingSeries.Add(new Tuple<string, string, int>(folder, title, seriesId));
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.WarnException("Failed to connect to TheTVDB to search for: " + foldername, ex);
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
||||
|
|
|
@ -6,7 +6,14 @@
|
|||
Layout = null;
|
||||
}
|
||||
|
||||
@if (Model.ExistingSeries.Count == 0)
|
||||
@if (Model == null)
|
||||
{
|
||||
<h2 style="color: tomato">
|
||||
Error searching TheTVDB, please try again later.
|
||||
</h2>
|
||||
}
|
||||
|
||||
else if (!Model.ExistingSeries.Any())
|
||||
{
|
||||
<h2 style="color: tomato">
|
||||
No series available. Try adding a new Root Folder.
|
||||
|
|
Loading…
Reference in a new issue