Added categories to newznab section
This commit is contained in:
parent
f9fe119af2
commit
17842d3fa1
|
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
Enable = false,
|
Enable = false,
|
||||||
Name = "Nzbs.org",
|
Name = "Nzbs.org",
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = GetSettings("http://nzbs.org")
|
Settings = GetSettings("http://nzbs.org", new List<Int32>{ 5000 })
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
Enable = false,
|
Enable = false,
|
||||||
Name = "Nzb.su",
|
Name = "Nzb.su",
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = GetSettings("https://nzb.su")
|
Settings = GetSettings("https://nzb.su", new List<Int32>())
|
||||||
});
|
});
|
||||||
|
|
||||||
list.Add(new IndexerDefinition
|
list.Add(new IndexerDefinition
|
||||||
|
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
Enable = false,
|
Enable = false,
|
||||||
Name = "Dognzb.cr",
|
Name = "Dognzb.cr",
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = GetSettings("https://dognzb.cr")
|
Settings = GetSettings("https://dognzb.cr", new List<Int32>())
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -51,16 +51,29 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetSettings(string url)
|
private string GetSettings(string url, List<int> categories)
|
||||||
{
|
{
|
||||||
return new NewznabSettings { Url = url }.ToJson();
|
var settings = new NewznabSettings { Url = url };
|
||||||
|
|
||||||
|
if (categories.Any())
|
||||||
|
{
|
||||||
|
settings.Categories = categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
return settings.ToJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> RecentFeed
|
public override IEnumerable<string> RecentFeed
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var url = String.Format("{0}/api?t=tvsearch&cat=5000", Settings.Url);
|
//Todo: We should be able to update settings on start
|
||||||
|
if (Name.Equals("nzbs.org"))
|
||||||
|
{
|
||||||
|
Settings.Categories = new List<int>{ 5000 };
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = String.Format("{0}/api?t=tvsearch&cat={1}", Settings.Url, String.Join(",", Settings.Categories));
|
||||||
|
|
||||||
if (!String.IsNullOrWhiteSpace(Settings.ApiKey))
|
if (!String.IsNullOrWhiteSpace(Settings.ApiKey))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,16 +1,25 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Core.Annotations;
|
using NzbDrone.Core.Annotations;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Newznab
|
namespace NzbDrone.Core.Indexers.Newznab
|
||||||
{
|
{
|
||||||
public class NewznabSettings : IIndexerSetting
|
public class NewznabSettings : IIndexerSetting
|
||||||
{
|
{
|
||||||
|
public NewznabSettings()
|
||||||
|
{
|
||||||
|
Categories = new [] { 5030, 5040 };
|
||||||
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "URL")]
|
[FieldDefinition(0, Label = "URL")]
|
||||||
public String Url { get; set; }
|
public String Url { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(1, Label = "API Key")]
|
[FieldDefinition(1, Label = "API Key")]
|
||||||
public String ApiKey { get; set; }
|
public String ApiKey { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<Int32> Categories { get; set; }
|
||||||
|
|
||||||
public bool IsValid
|
public bool IsValid
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
Loading…
Reference in New Issue