|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Web.Mvc;
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Core.Jobs;
|
|
|
|
using NzbDrone.Core.Jobs;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
@ -23,6 +24,8 @@ namespace NzbDrone.Web.Controllers
|
|
|
|
private readonly TvDbProvider _tvDbProvider;
|
|
|
|
private readonly TvDbProvider _tvDbProvider;
|
|
|
|
private readonly DiskProvider _diskProvider;
|
|
|
|
private readonly DiskProvider _diskProvider;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
|
|
|
|
public AddSeriesController(RootDirProvider rootFolderProvider,
|
|
|
|
public AddSeriesController(RootDirProvider rootFolderProvider,
|
|
|
|
ConfigProvider configProvider,
|
|
|
|
ConfigProvider configProvider,
|
|
|
|
QualityProvider qualityProvider, TvDbProvider tvDbProvider,
|
|
|
|
QualityProvider qualityProvider, TvDbProvider tvDbProvider,
|
|
|
@ -83,17 +86,26 @@ namespace NzbDrone.Web.Controllers
|
|
|
|
foreach (var folder in unmappedList)
|
|
|
|
foreach (var folder in unmappedList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var foldername = new DirectoryInfo(folder).Name;
|
|
|
|
var foldername = new DirectoryInfo(folder).Name;
|
|
|
|
var tvdbResult = _tvDbProvider.SearchSeries(foldername).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var title = String.Empty;
|
|
|
|
try
|
|
|
|
var seriesId = 0;
|
|
|
|
|
|
|
|
if (tvdbResult != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title = tvdbResult.SeriesName;
|
|
|
|
var tvdbResult = _tvDbProvider.SearchSeries(foldername).FirstOrDefault();
|
|
|
|
seriesId = tvdbResult.Id;
|
|
|
|
|
|
|
|
}
|
|
|
|
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));
|
|
|
|
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);
|
|
|
|
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
|
|
|