2013-05-25 04:08:26 +02:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using Nancy;
|
2013-02-23 21:35:26 +01:00
|
|
|
|
using NzbDrone.Api.Extensions;
|
2013-03-04 06:53:02 +01:00
|
|
|
|
using NzbDrone.Core.MetadataSource;
|
2013-05-25 04:08:26 +02:00
|
|
|
|
using System.Linq;
|
2013-01-28 19:06:54 +01:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Series
|
|
|
|
|
{
|
|
|
|
|
public class SeriesLookupModule : NzbDroneApiModule
|
|
|
|
|
{
|
2013-03-31 22:25:39 +02:00
|
|
|
|
private readonly ISearchForNewSeries _searchProxy;
|
2013-01-28 19:06:54 +01:00
|
|
|
|
|
2013-03-31 22:25:39 +02:00
|
|
|
|
public SeriesLookupModule(ISearchForNewSeries searchProxy)
|
2013-01-28 19:06:54 +01:00
|
|
|
|
: base("/Series/lookup")
|
|
|
|
|
{
|
2013-03-31 22:25:39 +02:00
|
|
|
|
_searchProxy = searchProxy;
|
2013-01-28 19:06:54 +01:00
|
|
|
|
Get["/"] = x => GetQualityType();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Response GetQualityType()
|
|
|
|
|
{
|
2013-03-31 22:25:39 +02:00
|
|
|
|
var tvDbResults = _searchProxy.SearchForNewSeries((string)Request.Query.term);
|
2013-05-25 04:08:26 +02:00
|
|
|
|
return tvDbResults.FirstOrDefault().AsResponse();
|
2013-01-28 19:06:54 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|