|
|
@ -1,6 +1,7 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Net;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Web;
|
|
|
|
using System.Web;
|
|
|
|
using NLog;
|
|
|
|
using NLog;
|
|
|
@ -37,13 +38,27 @@ namespace NzbDrone.Core.MetadataSource
|
|
|
|
|
|
|
|
|
|
|
|
int tvdbId;
|
|
|
|
int tvdbId;
|
|
|
|
|
|
|
|
|
|
|
|
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !Int32.TryParse(slug, out tvdbId))
|
|
|
|
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !Int32.TryParse(slug, out tvdbId) || tvdbId <= 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Enumerable.Empty<TVDBSharp.Models.Show>();
|
|
|
|
return Enumerable.Empty<TVDBSharp.Models.Show>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
return new[] { _tvdb.GetShow(tvdbId) };
|
|
|
|
return new[] { _tvdb.GetShow(tvdbId) };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (WebException ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var resp = ex.Response as HttpWebResponse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (resp != null && resp.StatusCode == HttpStatusCode.NotFound)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Enumerable.Empty<TVDBSharp.Models.Show>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _tvdb.Search(GetSearchTerm(lowerTitle), 10);
|
|
|
|
return _tvdb.Search(GetSearchTerm(lowerTitle), 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|