mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-29 23:12:39 +01:00
added 2nd tvdb .net client that allows us to preform concurrent searches.
This commit is contained in:
parent
022ed5ba5c
commit
91a416e0b1
@ -181,6 +181,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Prowlin.0.9.4456.26422\lib\net40\Prowlin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp">
|
||||
<HintPath>..\packages\RestSharp.104.1\lib\net4\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SignalR">
|
||||
<HintPath>..\packages\SignalR.Server.0.5.3\lib\net40\SignalR.dll</HintPath>
|
||||
</Reference>
|
||||
@ -587,6 +590,21 @@
|
||||
<Compile Include="Repository\Series.cs" />
|
||||
<Compile Include="CentralDispatch.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Tvdb\Tvdb.cs" />
|
||||
<Compile Include="Tvdb\Tvdb.Sync.cs" />
|
||||
<Compile Include="Tvdb\TvdbActor.cs" />
|
||||
<Compile Include="Tvdb\TvdbAsyncResult.cs" />
|
||||
<Compile Include="Tvdb\TvdbBanner.cs" />
|
||||
<Compile Include="Tvdb\TvdbEpisodes.cs" />
|
||||
<Compile Include="Tvdb\TvdbLanguages.cs" />
|
||||
<Compile Include="Tvdb\TvdbMirrors.cs" />
|
||||
<Compile Include="Tvdb\TvdbSeriesBase.cs" />
|
||||
<Compile Include="Tvdb\TvdbSeriesFull.cs" />
|
||||
<Compile Include="Tvdb\TvdbSeriesSearch.cs" />
|
||||
<Compile Include="Tvdb\TvdbSeriesSearchItem.cs" />
|
||||
<Compile Include="Tvdb\TvdbServerTime.cs" />
|
||||
<Compile Include="Tvdb\TvdbUpdate.cs" />
|
||||
<Compile Include="Tvdb\TvdbUpdateItems.cs" />
|
||||
<Compile Include="WebTimer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Tvdb;
|
||||
using TvdbLib;
|
||||
using TvdbLib.Cache;
|
||||
using TvdbLib.Data;
|
||||
using TvdbLanguage = TvdbLib.Data.TvdbLanguage;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
@ -14,14 +14,19 @@ namespace NzbDrone.Core.Providers
|
||||
{
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
public const string TVDB_APIKEY = "5D2D188E86E07F4F";
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
||||
|
||||
private readonly TvdbHandler _handler;
|
||||
private readonly Tvdb.Tvdb _handlerV2;
|
||||
|
||||
|
||||
public TvDbProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_environmentProvider = environmentProvider;
|
||||
_handler = new TvdbHandler(new XmlCacheProvider(_environmentProvider.GetCacheFolder()), TVDB_APIKEY);
|
||||
_handlerV2 = new Tvdb.Tvdb(TVDB_APIKEY);
|
||||
}
|
||||
|
||||
public TvDbProvider()
|
||||
@ -29,30 +34,26 @@ namespace NzbDrone.Core.Providers
|
||||
|
||||
}
|
||||
|
||||
public virtual IList<TvdbSearchResult> SearchSeries(string title)
|
||||
public virtual List<TvdbSeriesSearchItem> SearchSeries(string title)
|
||||
{
|
||||
lock (_handler)
|
||||
logger.Debug("Searching TVDB for '{0}'", title);
|
||||
|
||||
if (title.Contains(" & "))
|
||||
{
|
||||
Logger.Debug("Searching TVDB for '{0}'", title);
|
||||
|
||||
if(title.Contains(" & "))
|
||||
{
|
||||
Logger.Debug("Removing ampersand before searching");
|
||||
title = title.Replace(" & ", " ");
|
||||
}
|
||||
|
||||
var result = _handler.SearchSeries(title);
|
||||
|
||||
Logger.Debug("Search for '{0}' returned {1} possible results", title, result.Count);
|
||||
return result;
|
||||
title = title.Replace(" & ", " ");
|
||||
}
|
||||
|
||||
var result = _handlerV2.SearchSeries(title);
|
||||
|
||||
logger.Debug("Search for '{0}' returned {1} possible results", title, result.Count);
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual TvdbSeries GetSeries(int id, bool loadEpisodes, bool loadActors = false)
|
||||
{
|
||||
lock (_handler)
|
||||
{
|
||||
Logger.Debug("Fetching SeriesId'{0}' from tvdb", id);
|
||||
logger.Debug("Fetching SeriesId'{0}' from tvdb", id);
|
||||
var result = _handler.GetSeries(id, TvdbLanguage.DefaultLanguage, loadEpisodes, loadActors, true, true);
|
||||
|
||||
//Remove duplicated episodes
|
||||
|
223
NzbDrone.Core/Tvdb/Tvdb.Sync.cs
Normal file
223
NzbDrone.Core/Tvdb/Tvdb.Sync.cs
Normal file
@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RestSharp;
|
||||
using RestSharp.Deserializers;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
public partial class Tvdb
|
||||
{
|
||||
private T ProcessRequest <T>(RestRequest request)
|
||||
where T: new()
|
||||
{
|
||||
return ProcessRequest<T>(BASE_URL, request);
|
||||
}
|
||||
|
||||
private T ProcessRequest <T>(string url, RestRequest request)
|
||||
where T: new()
|
||||
{
|
||||
var client = new RestClient(url);
|
||||
client.AddHandler("text/xml", new DotNetXmlDeserializer());
|
||||
|
||||
if(Timeout.HasValue)
|
||||
client.Timeout = Timeout.Value;
|
||||
|
||||
#if !WINDOWS_PHONE
|
||||
if(Proxy != null)
|
||||
client.Proxy = Proxy;
|
||||
#endif
|
||||
|
||||
Error = null;
|
||||
|
||||
//var resp = client.Execute(request);
|
||||
IRestResponse<T> resp = client.Execute<T>(request);
|
||||
|
||||
ResponseContent = resp.Content;
|
||||
ResponseHeaders = resp.Headers.ToDictionary(k => k.Name, v => v.Value);
|
||||
|
||||
if(resp.ResponseStatus == ResponseStatus.Completed)
|
||||
{
|
||||
return resp.Data;
|
||||
|
||||
// Manual deserialization
|
||||
//TextReader r = new StringReader(resp.Content);
|
||||
//XmlSerializer s = new XmlSerializer(typeof(T));
|
||||
//return (T)s.Deserialize(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(resp.ErrorException != null)
|
||||
throw resp.ErrorException;
|
||||
else
|
||||
Error = resp.ErrorMessage;
|
||||
}
|
||||
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public TvdbMirrors GetMirrors()
|
||||
{
|
||||
return ProcessRequest<TvdbMirrors>(BuildGetMirrorsRequest());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http://www.thetvdb.com/api/Updates.php?type=none
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public TvdbServerTime GetServerTime()
|
||||
{
|
||||
return ProcessRequest<TvdbServerTime>(BuildGetServerTimeRequest());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http://www.thetvdb.com/api/{apikey}/languages.xml
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<TvdbLanguage> GetLanguages()
|
||||
{
|
||||
var root = ProcessRequest<TvdbLanguagesRoot>(BuildGetLanguagesRequest());
|
||||
if(root != null)
|
||||
return root.Languages;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// http://www.thetvdb.com/api/GetSeries.php?seriesname={series}
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns></returns>
|
||||
public List<TvdbSeriesSearchItem> SearchSeries(string search)
|
||||
{
|
||||
var root = ProcessRequest<TvdbSeriesSearchRoot>(BuildGetSearchSeriesRequest(search));
|
||||
if(root != null)
|
||||
return root.Series;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http://thetvdb.com/api/{apikey}/series/79349/en.xml
|
||||
/// </summary>
|
||||
/// <param name="XMLMirror"></param>
|
||||
/// <param name="SeriesId"></param>
|
||||
/// <param name="Language"></param>
|
||||
/// <returns></returns>
|
||||
public TvdbSeriesBase GetSeriesBaseRecord(string XMLMirror, int SeriesId, string Language)
|
||||
{
|
||||
if(string.IsNullOrEmpty(Language))
|
||||
Language = "en";
|
||||
|
||||
var root = ProcessRequest<TvdbSeriesRecordRoot>(XMLMirror,
|
||||
BuildGetSeriesBaseRecordRequest(SeriesId, Language));
|
||||
if(root != null)
|
||||
return root.Series;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public TvdbSeriesBase GetSeriesBaseRecord(string XMLMirror, int SeriesId)
|
||||
{
|
||||
return GetSeriesBaseRecord(XMLMirror, SeriesId, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http://thetvdb.com/api/{apikey}/series/79349/all/en.xml
|
||||
/// </summary>
|
||||
/// <param name="XMLMirror"></param>
|
||||
/// <param name="SeriesId"></param>
|
||||
/// <param name="Language"></param>
|
||||
/// <returns></returns>
|
||||
public TvdbSeriesFull GetSeriesFullRecord(string XMLMirror, int SeriesId, string Language)
|
||||
{
|
||||
if(string.IsNullOrEmpty(Language))
|
||||
Language = "en";
|
||||
|
||||
return ProcessRequest<TvdbSeriesFull>(XMLMirror, BuildGetSeriesFullRecordRequest(SeriesId, Language));
|
||||
}
|
||||
|
||||
public TvdbSeriesFull GetSeriesFullRecord(string MirrorPath, int SeriesId)
|
||||
{
|
||||
return GetSeriesFullRecord(MirrorPath, SeriesId, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http://thetvdb.com/api/{apikey}/series/79349/banners.xml
|
||||
/// </summary>
|
||||
/// <param name="XMLMirror"></param>
|
||||
/// <param name="SeriesId"></param>
|
||||
/// <returns></returns>
|
||||
public List<TvdbBanner> GetSeriesBanners(string XMLMirror, int SeriesId)
|
||||
{
|
||||
var root = ProcessRequest<TvdbBannerRoot>(XMLMirror, BuildGetSeriesBannersRequest(SeriesId));
|
||||
if(root != null)
|
||||
return root.Banners;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http://thetvdb.com/api/{apikey}/series/79349/actors.xml
|
||||
/// </summary>
|
||||
/// <param name="XMLMirror"></param>
|
||||
/// <param name="SeriesId"></param>
|
||||
/// <returns></returns>
|
||||
public List<TvdbActor> GetSeriesActors(string XMLMirror, int SeriesId)
|
||||
{
|
||||
var root = ProcessRequest<TvdbActorRoot>(XMLMirror, BuildGetSeriesActorsRequest(SeriesId));
|
||||
if(root != null)
|
||||
return root.Actors;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public TvdbEpisode GetEpisode(string XMLMirror, int EpisodeId, string Language)
|
||||
{
|
||||
if(string.IsNullOrEmpty(Language))
|
||||
Language = "en";
|
||||
|
||||
var root = ProcessRequest<TvdbEpisodeRoot>(XMLMirror, BuildGetEpisodeRequest(EpisodeId, Language));
|
||||
if(root != null)
|
||||
return root.Episode;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public TvdbEpisode GetEpisode(string XMLMirror, int EpisodeId)
|
||||
{
|
||||
return GetEpisode(XMLMirror, EpisodeId, null);
|
||||
}
|
||||
|
||||
public TvdbEpisode GetSeriesEpisode(string XMLMirror, int SeriesId, int SeasonNum, int EpisodeNum,
|
||||
string Language)
|
||||
{
|
||||
if(string.IsNullOrEmpty(Language))
|
||||
Language = "en";
|
||||
|
||||
var root = ProcessRequest<TvdbEpisodeRoot>(XMLMirror,
|
||||
BuildGetSeriesEpisodeRequest(SeriesId, SeasonNum, EpisodeNum,
|
||||
Language));
|
||||
if(root != null)
|
||||
return root.Episode;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public TvdbEpisode GetSeriesEpisode(string XMLMirror, int SeriesId, int SeasonNum, int EpisodeNum)
|
||||
{
|
||||
return GetSeriesEpisode(XMLMirror, SeriesId, SeasonNum, EpisodeNum, null);
|
||||
}
|
||||
|
||||
public TvdbUpdates GetUpdates(string XMLMirror, TvdbUpdatePeriod Period)
|
||||
{
|
||||
return ProcessRequest<TvdbUpdates>(XMLMirror, BuildGetUpdatesRequest(Period));
|
||||
}
|
||||
|
||||
public TvdbUpdateItems GetUpdatesSince(string XMLMirror, Int64 LastTime)
|
||||
{
|
||||
return ProcessRequest<TvdbUpdateItems>(XMLMirror, BuildGetUpdatesSinceRequest(LastTime));
|
||||
}
|
||||
}
|
||||
}
|
205
NzbDrone.Core/Tvdb/Tvdb.cs
Normal file
205
NzbDrone.Core/Tvdb/Tvdb.cs
Normal file
@ -0,0 +1,205 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
public partial class Tvdb
|
||||
{
|
||||
private const string BASE_URL = "http://www.thetvdb.com/api";
|
||||
|
||||
public string ApiKey { get; set; }
|
||||
public string Error { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// String representation of response content
|
||||
/// </summary>
|
||||
public string ResponseContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of Header values in response
|
||||
/// http://help.themoviedb.org/kb/api/content-versioning
|
||||
/// </summary>
|
||||
public Dictionary<string, object> ResponseHeaders { get; set; }
|
||||
|
||||
#if !WINDOWS_PHONE
|
||||
/// <summary>
|
||||
/// Proxy to use for requests made. Passed on to underying WebRequest if set.
|
||||
/// </summary>
|
||||
public IWebProxy Proxy { get; set; }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Timeout in milliseconds to use for requests made.
|
||||
/// </summary>
|
||||
public int? Timeout { get; set; }
|
||||
|
||||
public Tvdb(string apiKey)
|
||||
{
|
||||
ApiKey = apiKey;
|
||||
Error = null;
|
||||
Timeout = null;
|
||||
}
|
||||
|
||||
#region Helper methods
|
||||
|
||||
public static string GetImageUrl(string BannerMirror, string filename)
|
||||
{
|
||||
return string.Format("{0}/banners/{1}", BannerMirror, filename);
|
||||
}
|
||||
|
||||
#if !WINDOWS_PHONE
|
||||
public static byte[] GetImage(string BannerMirror, string filename)
|
||||
{
|
||||
return GetImage(GetImageUrl(BannerMirror, filename));
|
||||
}
|
||||
|
||||
public static byte[] GetImage(string url)
|
||||
{
|
||||
return new WebClient().DownloadData(url);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
#region Build Requests
|
||||
|
||||
private RestRequest BuildGetMirrorsRequest(object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("{apikey}/mirrors.xml", Method.GET);
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private static RestRequest BuildGetServerTimeRequest(object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("Updates.php", Method.GET);
|
||||
request.AddParameter("type", "none");
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private RestRequest BuildGetLanguagesRequest(object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("{apikey}/languages.xml", Method.GET);
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private static RestRequest BuildGetSearchSeriesRequest(string search, object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("GetSeries.php", Method.GET);
|
||||
request.AddParameter("seriesname", search);
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private RestRequest BuildGetSeriesBaseRecordRequest(int SeriesId, string Language, object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("api/{apikey}/series/{id}/{lang}.xml");
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
request.AddUrlSegment("id", SeriesId.ToString());
|
||||
request.AddUrlSegment("lang", Language);
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private RestRequest BuildGetSeriesFullRecordRequest(int SeriesId, string Language, object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("api/{apikey}/series/{id}/all/{lang}.xml");
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
request.AddUrlSegment("id", SeriesId.ToString());
|
||||
request.AddUrlSegment("lang", Language);
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private RestRequest BuildGetSeriesBannersRequest(int SeriesId, object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("api/{apikey}/series/{id}/banners.xml");
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
request.AddUrlSegment("id", SeriesId.ToString());
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private RestRequest BuildGetSeriesActorsRequest(int SeriesId, object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("api/{apikey}/series/{id}/actors.xml");
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
request.AddUrlSegment("id", SeriesId.ToString());
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private RestRequest BuildGetEpisodeRequest(int EpisodeId, string Language, object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("api/{apikey}/episodes/{id}/{lang}.xml");
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
request.AddUrlSegment("id", EpisodeId.ToString());
|
||||
request.AddUrlSegment("lang", Language);
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private RestRequest BuildGetSeriesEpisodeRequest(int SeriesId, int SeasonNum, int EpisodeNum, string Language,
|
||||
object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("api/{apikey}/series/{id}/default/{season}/{episode}/{lang}.xml");
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
request.AddUrlSegment("id", SeriesId.ToString());
|
||||
request.AddUrlSegment("season", SeasonNum.ToString());
|
||||
request.AddUrlSegment("episode", EpisodeNum.ToString());
|
||||
request.AddUrlSegment("lang", Language);
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private RestRequest BuildGetUpdatesRequest(TvdbUpdatePeriod Period, object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("api/{apikey}/updates/updates_{period}.xml");
|
||||
request.AddUrlSegment("apikey", ApiKey);
|
||||
request.AddUrlSegment("period", Period.ToString());
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private static RestRequest BuildGetUpdatesSinceRequest(Int64 LastTime, object UserState = null)
|
||||
{
|
||||
var request = new RestRequest("api/Updates.php?type=all&time={time}");
|
||||
request.AddUrlSegment("time", LastTime.ToString());
|
||||
if(UserState != null)
|
||||
request.UserState = UserState;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
36
NzbDrone.Core/Tvdb/TvdbActor.cs
Normal file
36
NzbDrone.Core/Tvdb/TvdbActor.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Actors")]
|
||||
public class TvdbActorRoot
|
||||
{
|
||||
public TvdbActorRoot()
|
||||
{
|
||||
Actors = new List<TvdbActor>();
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Actor")]
|
||||
public List<TvdbActor> Actors { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbActor
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Image { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Role { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int SortOrder { get; set; }
|
||||
}
|
||||
}
|
10
NzbDrone.Core/Tvdb/TvdbAsyncResult.cs
Normal file
10
NzbDrone.Core/Tvdb/TvdbAsyncResult.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
public class TvdbAsyncResult <T>
|
||||
{
|
||||
public T Data { get; set; }
|
||||
public object UserState { get; set; }
|
||||
}
|
||||
}
|
86
NzbDrone.Core/Tvdb/TvdbBanner.cs
Normal file
86
NzbDrone.Core/Tvdb/TvdbBanner.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Banners")]
|
||||
public class TvdbBannerRoot
|
||||
{
|
||||
public TvdbBannerRoot()
|
||||
{
|
||||
Banners = new List<TvdbBanner>();
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Banner")]
|
||||
public List<TvdbBanner> Banners { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbBanner
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string BannerPath { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string BannerType { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string BannerType2 { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Colors { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Language { get; set; }
|
||||
|
||||
[XmlElement("Rating")]
|
||||
public string RatingString
|
||||
{
|
||||
get { return Rating.HasValue ? Rating.Value.ToString() : null; }
|
||||
set
|
||||
{
|
||||
double d;
|
||||
if(double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out d))
|
||||
Rating = d;
|
||||
else
|
||||
Rating = null;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public double? Rating { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int? RatingCount { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "SeriesName")]
|
||||
public string SeriesNameString
|
||||
{
|
||||
get { return SeriesName.HasValue ? SeriesName.Value.ToString() : null; }
|
||||
set
|
||||
{
|
||||
bool b;
|
||||
if(bool.TryParse(value, out b))
|
||||
SeriesName = b;
|
||||
else
|
||||
SeriesName = null;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public bool? SeriesName { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string ThumbnailPath { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string VignettePath { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Season { get; set; }
|
||||
}
|
||||
}
|
132
NzbDrone.Core/Tvdb/TvdbEpisodes.cs
Normal file
132
NzbDrone.Core/Tvdb/TvdbEpisodes.cs
Normal file
@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Data")]
|
||||
public class TvdbEpisodeRoot
|
||||
{
|
||||
[XmlElement]
|
||||
public TvdbEpisode Episode { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbEpisode
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Combined_episodenumber { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Combined_season { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string DVD_chapter { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string DVD_discid { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string DVD_episodenumber { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string DVD_season { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Director { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "EpImgFlag")]
|
||||
public string EpImgFlagString
|
||||
{
|
||||
get { return EpImgFlag.HasValue ? EpImgFlag.Value.ToString() : null; }
|
||||
set
|
||||
{
|
||||
int i;
|
||||
if(int.TryParse(value, out i))
|
||||
EpImgFlag = i;
|
||||
else
|
||||
EpImgFlag = null;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public int? EpImgFlag { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string EpisodeName { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int EpisodeNumber { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime FirstAired { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string GuestStars { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string IMDB_ID { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Language { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Overview { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string ProductionCode { get; set; }
|
||||
|
||||
[XmlElement("Rating")]
|
||||
public string RatingString
|
||||
{
|
||||
get { return Rating.HasValue ? Rating.Value.ToString() : null; }
|
||||
set
|
||||
{
|
||||
double d;
|
||||
if(double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out d))
|
||||
Rating = d;
|
||||
else
|
||||
Rating = null;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public double? Rating { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int? RatingCount { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int SeasonNumber { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Writer { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string absolute_number { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string airsafter_season { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string airsbefore_episode { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string airsbefore_season { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string filename { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public Int64 lastupdated { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int? seasonid { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int? seriesid { get; set; }
|
||||
}
|
||||
}
|
30
NzbDrone.Core/Tvdb/TvdbLanguages.cs
Normal file
30
NzbDrone.Core/Tvdb/TvdbLanguages.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Languages")]
|
||||
public class TvdbLanguagesRoot
|
||||
{
|
||||
public TvdbLanguagesRoot()
|
||||
{
|
||||
Languages = new List<TvdbLanguage>();
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Language")]
|
||||
public List<TvdbLanguage> Languages { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbLanguage
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string name { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string abbreviation { get; set; }
|
||||
}
|
||||
}
|
40
NzbDrone.Core/Tvdb/TvdbMirrors.cs
Normal file
40
NzbDrone.Core/Tvdb/TvdbMirrors.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Mirrors")]
|
||||
public class TvdbMirrors
|
||||
{
|
||||
[XmlElement(ElementName = "Mirror")]
|
||||
public List<TvdbMirror> Mirrors { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbMirror
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string mirrorpath { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int typemask { get; set; }
|
||||
|
||||
public bool IsXMLMirror
|
||||
{
|
||||
get { return (typemask & 1) != 0; }
|
||||
}
|
||||
|
||||
public bool IsBannerMirror
|
||||
{
|
||||
get { return (typemask & 2) != 0; }
|
||||
}
|
||||
|
||||
public bool IsZipMirror
|
||||
{
|
||||
get { return (typemask & 4) != 0; }
|
||||
}
|
||||
}
|
||||
}
|
131
NzbDrone.Core/Tvdb/TvdbSeriesBase.cs
Normal file
131
NzbDrone.Core/Tvdb/TvdbSeriesBase.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Data")]
|
||||
public class TvdbSeriesRecordRoot
|
||||
{
|
||||
[XmlElement]
|
||||
public TvdbSeriesBase Series { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbSeriesBase
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Actors { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Airs_DayOfWeek { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Airs_Time { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string ContentRating { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "FirstAired")]
|
||||
public string FirstAiredString
|
||||
{
|
||||
get { return FirstAired.HasValue ? FirstAired.Value.ToString("yyyy-MM-dd") : null; }
|
||||
set
|
||||
{
|
||||
DateTime d;
|
||||
if(DateTime.TryParse(value, out d))
|
||||
FirstAired = d;
|
||||
else
|
||||
FirstAired = null;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? FirstAired { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Genre { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string IMDB_ID { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Language { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Network { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Overview { get; set; }
|
||||
|
||||
[XmlElement("Rating")]
|
||||
public string RatingString
|
||||
{
|
||||
get { return Rating.HasValue ? Rating.Value.ToString() : null; }
|
||||
set
|
||||
{
|
||||
double d;
|
||||
if(double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out d))
|
||||
Rating = d;
|
||||
else
|
||||
Rating = null;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public double? Rating { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int? RatingCount { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int? Runtime { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string SeriesIDString
|
||||
{
|
||||
get { return SeriesID.HasValue ? SeriesID.Value.ToString() : null; }
|
||||
set
|
||||
{
|
||||
int i;
|
||||
if(int.TryParse(value, out i))
|
||||
SeriesID = i;
|
||||
else
|
||||
SeriesID = null;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public int? SeriesID { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string SeriesName { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Status { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string added { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string addedBy { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string banner { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string fanart { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public Int64 lastupdated { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string poster { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string zap2it_id { get; set; }
|
||||
}
|
||||
}
|
21
NzbDrone.Core/Tvdb/TvdbSeriesFull.cs
Normal file
21
NzbDrone.Core/Tvdb/TvdbSeriesFull.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Data")]
|
||||
public class TvdbSeriesFull
|
||||
{
|
||||
public TvdbSeriesFull()
|
||||
{
|
||||
Episodes = new List<TvdbEpisode>();
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public TvdbSeriesBase Series { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "Episode")]
|
||||
public List<TvdbEpisode> Episodes { get; set; }
|
||||
}
|
||||
}
|
18
NzbDrone.Core/Tvdb/TvdbSeriesSearch.cs
Normal file
18
NzbDrone.Core/Tvdb/TvdbSeriesSearch.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Data")]
|
||||
public class TvdbSeriesSearchRoot
|
||||
{
|
||||
public TvdbSeriesSearchRoot()
|
||||
{
|
||||
Series = new List<TvdbSeriesSearchItem>();
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Series")]
|
||||
public List<TvdbSeriesSearchItem> Series { get; set; }
|
||||
}
|
||||
}
|
50
NzbDrone.Core/Tvdb/TvdbSeriesSearchItem.cs
Normal file
50
NzbDrone.Core/Tvdb/TvdbSeriesSearchItem.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
public class TvdbSeriesSearchItem
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int seriesid { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string language { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string SeriesName { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string banner { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Overview { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "FirstAired")]
|
||||
public string FirstAiredString
|
||||
{
|
||||
get { return FirstAired.HasValue ? FirstAired.Value.ToString("yyyy-MM-dd") : null; }
|
||||
set
|
||||
{
|
||||
DateTime d;
|
||||
if(DateTime.TryParse(value, out d))
|
||||
FirstAired = d;
|
||||
else
|
||||
FirstAired = null;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? FirstAired { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string IMDB_ID { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string zap2it_id { get; set; }
|
||||
}
|
||||
}
|
13
NzbDrone.Core/Tvdb/TvdbServerTime.cs
Normal file
13
NzbDrone.Core/Tvdb/TvdbServerTime.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Items")]
|
||||
public class TvdbServerTime
|
||||
{
|
||||
[XmlElement]
|
||||
public Int64 Time { get; set; }
|
||||
}
|
||||
}
|
86
NzbDrone.Core/Tvdb/TvdbUpdate.cs
Normal file
86
NzbDrone.Core/Tvdb/TvdbUpdate.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
public enum TvdbUpdatePeriod
|
||||
{
|
||||
day,
|
||||
week,
|
||||
month
|
||||
};
|
||||
|
||||
[XmlRoot(ElementName = "Data")]
|
||||
public class TvdbUpdates
|
||||
{
|
||||
public TvdbUpdates()
|
||||
{
|
||||
Series = new List<TvdbUpdateSeries>();
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public Int64 time { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "Series")]
|
||||
public List<TvdbUpdateSeries> Series { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "Episode")]
|
||||
public List<TvdbUpdateEpisode> Episodes { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "Banner")]
|
||||
public List<TvdbUpdateBanner> Banners { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbUpdateSeries
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public Int64 time { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbUpdateEpisode
|
||||
{
|
||||
[XmlElement]
|
||||
public int id { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int Series { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public Int64 time { get; set; }
|
||||
}
|
||||
|
||||
public class TvdbUpdateBanner
|
||||
{
|
||||
/// <summary>
|
||||
/// fanart, poster, season, series, episode, actors
|
||||
/// </summary>
|
||||
[XmlElement]
|
||||
public string type { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string format { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int Series { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Only appears for season banners
|
||||
/// </summary>
|
||||
[XmlElement]
|
||||
public int? SeasonNum { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string language { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string path { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public Int64 time { get; set; }
|
||||
}
|
||||
}
|
26
NzbDrone.Core/Tvdb/TvdbUpdateItems.cs
Normal file
26
NzbDrone.Core/Tvdb/TvdbUpdateItems.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace NzbDrone.Core.Tvdb
|
||||
{
|
||||
[XmlRoot(ElementName = "Items")]
|
||||
public class TvdbUpdateItems
|
||||
{
|
||||
public TvdbUpdateItems()
|
||||
{
|
||||
Series = new List<int>();
|
||||
Episodes = new List<int>();
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public Int64 Time { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "Series")]
|
||||
public List<int> Series { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "Episode")]
|
||||
public List<int> Episodes { get; set; }
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
|
||||
<package id="NLog" version="2.0.0.2000" />
|
||||
<package id="Prowlin" version="0.9.4456.26422" targetFramework="net40" />
|
||||
<package id="RestSharp" version="104.1" targetFramework="net40" />
|
||||
<package id="SignalR.Hosting.AspNet" version="0.5.3" targetFramework="net40" />
|
||||
<package id="SignalR.Hosting.Common" version="0.5.3" targetFramework="net40" />
|
||||
<package id="SignalR.Server" version="0.5.3" targetFramework="net40" />
|
||||
|
@ -91,7 +91,7 @@ namespace NzbDrone.Web.Controllers
|
||||
if (tvdbResult != null)
|
||||
{
|
||||
title = tvdbResult.SeriesName;
|
||||
seriesId = tvdbResult.Id;
|
||||
seriesId = tvdbResult.id;
|
||||
}
|
||||
|
||||
result.ExistingSeries.Add(new Tuple<string, string, int>(folder, title, seriesId));
|
||||
@ -147,33 +147,8 @@ namespace NzbDrone.Web.Controllers
|
||||
[JsonErrorFilter]
|
||||
public JsonResult LookupSeries(string term)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tvDbResults = _tvDbProvider.SearchSeries(term).Select(r => new TvDbSearchResultModel
|
||||
{
|
||||
Id = r.Id,
|
||||
Title = r.SeriesName,
|
||||
DisplayedTitle = r.FirstAired.Year > 1900 && !r.SeriesName.EndsWith("(" + r.FirstAired.Year + ")")
|
||||
? string.Format("{0} ({1})", r.SeriesName, r.FirstAired.Year)
|
||||
: r.SeriesName,
|
||||
Banner = r.Banner.BannerPath,
|
||||
Url = String.Format("http://www.thetvdb.com/?tab=series&id={0}", r.Id)
|
||||
}).ToList();
|
||||
|
||||
return Json(tvDbResults, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
catch (TvdbNotAvailableException ex)
|
||||
{
|
||||
logger.WarnException("Unable to lookup series on TheTVDB", ex);
|
||||
return JsonNotificationResult.Info("Lookup Failed", "TheTVDB is not available at this time.");
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.WarnException("Unknown Error when looking up series on TheTVDB", ex);
|
||||
return JsonNotificationResult.Info("Lookup Failed", "Unknown error while connecting to TheTVDB");
|
||||
}
|
||||
return JsonNotificationResult.Info("Lookup Failed", "Unknown error while connecting to TheTVDB");
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user