can do series lookup using the api.
This commit is contained in:
parent
5fb1f4902f
commit
32e402b5a0
|
@ -83,8 +83,13 @@
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="TvdbLib, Version=0.8.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\Libraries\TvdbLib.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Series\SeriesModule.cs" />
|
||||||
<Compile Include="ErrorManagment\ApiException.cs" />
|
<Compile Include="ErrorManagment\ApiException.cs" />
|
||||||
<Compile Include="Bootstrapper.cs" />
|
<Compile Include="Bootstrapper.cs" />
|
||||||
<Compile Include="ErrorManagment\ErrorHandler.cs" />
|
<Compile Include="ErrorManagment\ErrorHandler.cs" />
|
||||||
|
@ -92,9 +97,9 @@
|
||||||
<Compile Include="ErrorManagment\ErrorPipeline.cs" />
|
<Compile Include="ErrorManagment\ErrorPipeline.cs" />
|
||||||
<Compile Include="Exceptions\InvalidApiKeyException.cs" />
|
<Compile Include="Exceptions\InvalidApiKeyException.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="QualityProfiles\NzbDroneApiModule.cs" />
|
<Compile Include="NzbDroneApiModule.cs" />
|
||||||
<Compile Include="QualityProfiles\QualityProfileModel.cs" />
|
<Compile Include="QualityProfiles\QualityProfileModel.cs" />
|
||||||
<Compile Include="QualityProfiles\QualityProfileModule.cs" />
|
<Compile Include="QualityProfiles\QualityProfilesModule.cs" />
|
||||||
<Compile Include="QualityType\QualityTypeModel.cs" />
|
<Compile Include="QualityType\QualityTypeModel.cs" />
|
||||||
<Compile Include="QualityType\QualityTypeModule.cs" />
|
<Compile Include="QualityType\QualityTypeModule.cs" />
|
||||||
<Compile Include="QualityType\RequestExtensions.cs" />
|
<Compile Include="QualityType\RequestExtensions.cs" />
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
|
using Nancy.Responses;
|
||||||
|
|
||||||
namespace NzbDrone.Api.QualityProfiles
|
namespace NzbDrone.Api
|
||||||
{
|
{
|
||||||
public abstract class NzbDroneApiModule : NancyModule
|
public abstract class NzbDroneApiModule : NancyModule
|
||||||
{
|
{
|
||||||
protected NzbDroneApiModule(string resource)
|
protected NzbDroneApiModule(string resource)
|
||||||
: base("/api/" + resource.Trim('/'))
|
: base("/api/" + resource.Trim('/'))
|
||||||
{
|
{
|
||||||
|
Options["/"] = x => new Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@ using NzbDrone.Api.QualityType;
|
||||||
|
|
||||||
namespace NzbDrone.Api.QualityProfiles
|
namespace NzbDrone.Api.QualityProfiles
|
||||||
{
|
{
|
||||||
public class QualityProfileModule : NzbDroneApiModule
|
public class QualityProfilesModule : NzbDroneApiModule
|
||||||
{
|
{
|
||||||
private readonly QualityProvider _qualityProvider;
|
private readonly QualityProvider _qualityProvider;
|
||||||
|
|
||||||
public QualityProfileModule(QualityProvider qualityProvider)
|
public QualityProfilesModule(QualityProvider qualityProvider)
|
||||||
: base("/QualityProfile")
|
: base("/QualityProfiles")
|
||||||
{
|
{
|
||||||
_qualityProvider = qualityProvider;
|
_qualityProvider = qualityProvider;
|
||||||
Get["/"] = x => OnGet();
|
Get["/"] = x => OnGet();
|
|
@ -0,0 +1,26 @@
|
||||||
|
using System.Linq;
|
||||||
|
using Nancy;
|
||||||
|
using NzbDrone.Api.QualityType;
|
||||||
|
using NzbDrone.Core.Providers;
|
||||||
|
|
||||||
|
namespace NzbDrone.Api.Series
|
||||||
|
{
|
||||||
|
public class SeriesModule : NzbDroneApiModule
|
||||||
|
{
|
||||||
|
private readonly TvDbProvider _tvDbProvider;
|
||||||
|
|
||||||
|
public SeriesModule(TvDbProvider tvDbProvider)
|
||||||
|
: base("/Series")
|
||||||
|
{
|
||||||
|
_tvDbProvider = tvDbProvider;
|
||||||
|
Get["/lookup"] = x => GetQualityType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Response GetQualityType()
|
||||||
|
{
|
||||||
|
var tvDbResults = _tvDbProvider.SearchSeries((string)Request.Query.term);
|
||||||
|
return tvDbResults.AsResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,7 +31,7 @@ NzbDrone.AddNewSeriesView = Backbone.Marionette.ItemView.extend({
|
||||||
|
|
||||||
this.ui.seriesSearch
|
this.ui.seriesSearch
|
||||||
.autocomplete({
|
.autocomplete({
|
||||||
source: "http://kayone.nzbdrone.com:8989/AddSeries/LookupSeries",
|
source: "http://localhost:1232/api/series/lookup",
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
delay: 500,
|
delay: 500,
|
||||||
select: function (event, ui) {
|
select: function (event, ui) {
|
||||||
|
@ -51,7 +51,7 @@ NzbDrone.AddNewSeriesView = Backbone.Marionette.ItemView.extend({
|
||||||
|
|
||||||
return $("<li></li>")
|
return $("<li></li>")
|
||||||
.data("item.autocomplete", item)
|
.data("item.autocomplete", item)
|
||||||
.append("<a>" + item.DisplayedTitle + "<img src='../../Content/Images/thetvdb.png' class='tvDbLink' title='Click to see series details from TheTVDB' rel='" + item.Url + "' /></a>")
|
.append("<a>" + item.SeriesName + "<img src='../../Content/Images/thetvdb.png' class='tvDbLink' title='Click to see series details from TheTVDB' rel='" + item.Url + "' /></a>")
|
||||||
.appendTo(ul);
|
.appendTo(ul);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<add name="CassetteHttpHandler" path="cassette.axd" preCondition="integratedMode" verb="*" allowPathInfo="true" type="Cassette.Aspnet.CassetteHttpHandler, Cassette.Aspnet" />
|
<add name="CassetteHttpHandler" path="cassette.axd" preCondition="integratedMode" verb="*" allowPathInfo="true" type="Cassette.Aspnet.CassetteHttpHandler, Cassette.Aspnet" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<directoryBrowse enabled="false" />
|
<directoryBrowse enabled="false" />
|
||||||
<staticContent>
|
<!--<staticContent>
|
||||||
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
|
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
|
||||||
<mimeMap fileExtension=".m4v" mimeType="video/m4v" />
|
<mimeMap fileExtension=".m4v" mimeType="video/m4v" />
|
||||||
<mimeMap fileExtension=".ogg" mimeType="video/ogg" />
|
<mimeMap fileExtension=".ogg" mimeType="video/ogg" />
|
||||||
|
@ -57,7 +57,12 @@
|
||||||
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
|
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
|
||||||
<mimeMap fileExtension=".otf" mimeType="font/otf" />
|
<mimeMap fileExtension=".otf" mimeType="font/otf" />
|
||||||
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
|
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
|
||||||
</staticContent>
|
</staticContent>-->
|
||||||
|
<httpProtocol>
|
||||||
|
<customHeaders>
|
||||||
|
<add name="Access-Control-Allow-Origin" value="*" />
|
||||||
|
</customHeaders>
|
||||||
|
</httpProtocol>
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
|
Loading…
Reference in New Issue