mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
New: Fanzub url can now be modified (to be used only with alternative sites implementing the same api)
This commit is contained in:
parent
8b1e0f68dd
commit
4036654f3f
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(82)]
|
||||
public class add_fanzub_settings : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Execute.Sql("UPDATE Indexers SET ConfigContract = 'FanzubSettings' WHERE Implementation = 'Fanzub' AND ConfigContract = 'NullConfig'");
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Fanzub
|
||||
{
|
||||
public class Fanzub : HttpIndexerBase<NullConfig>
|
||||
public class Fanzub : HttpIndexerBase<FanzubSettings>
|
||||
{
|
||||
public override DownloadProtocol Protocol { get { return DownloadProtocol.Usenet; } }
|
||||
|
||||
@ -18,7 +18,7 @@ public Fanzub(IHttpClient httpClient, IConfigService configService, IParsingServ
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new FanzubRequestGenerator();
|
||||
return new FanzubRequestGenerator() { Settings = Settings };
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
|
@ -13,12 +13,11 @@ public class FanzubRequestGenerator : IIndexerRequestGenerator
|
||||
{
|
||||
private static readonly Regex RemoveCharactersRegex = new Regex(@"[!?`]", RegexOptions.Compiled);
|
||||
|
||||
public String BaseUrl { get; set; }
|
||||
public FanzubSettings Settings { get; set; }
|
||||
public Int32 PageSize { get; set; }
|
||||
|
||||
public FanzubRequestGenerator()
|
||||
{
|
||||
BaseUrl = "http://fanzub.com/rss/?cat=anime";
|
||||
PageSize = 100;
|
||||
}
|
||||
|
||||
@ -65,7 +64,7 @@ public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpiso
|
||||
private IEnumerable<IndexerRequest> GetPagedRequests(String query)
|
||||
{
|
||||
var url = new StringBuilder();
|
||||
url.AppendFormat("{0}&max={1}", BaseUrl, PageSize);
|
||||
url.AppendFormat("{0}?cat=anime&max={1}", Settings.BaseUrl, PageSize);
|
||||
|
||||
if (query.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
|
35
src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs
Normal file
35
src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Fanzub
|
||||
{
|
||||
public class FanzubSettingsValidator : AbstractValidator<FanzubSettings>
|
||||
{
|
||||
public FanzubSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
}
|
||||
}
|
||||
|
||||
public class FanzubSettings : IProviderConfig
|
||||
{
|
||||
private static readonly FanzubSettingsValidator validator = new FanzubSettingsValidator();
|
||||
|
||||
public FanzubSettings()
|
||||
{
|
||||
BaseUrl = "http://fanzub.com/rss/";
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "Rss URL", HelpText = "Enter to URL to an Fanzub compatible RSS feed")]
|
||||
public String BaseUrl { get; set; }
|
||||
|
||||
public ValidationResult Validate()
|
||||
{
|
||||
return validator.Validate(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -248,6 +248,7 @@
|
||||
<Compile Include="Datastore\Migration\077_add_add_options_to_series.cs" />
|
||||
<Compile Include="Datastore\Migration\079_dedupe_tags.cs" />
|
||||
<Compile Include="Datastore\Migration\070_delay_profile.cs" />
|
||||
<Compile Include="Datastore\Migration\082_add_fanzub_settings.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationDbFactory.cs" />
|
||||
@ -455,6 +456,7 @@
|
||||
<Compile Include="Indexers\Eztv\EztvRequestGenerator.cs" />
|
||||
<Compile Include="Indexers\Fanzub\Fanzub.cs" />
|
||||
<Compile Include="Indexers\Fanzub\FanzubRequestGenerator.cs" />
|
||||
<Compile Include="Indexers\Fanzub\FanzubSettings.cs" />
|
||||
<Compile Include="Indexers\FetchAndParseRssService.cs" />
|
||||
<Compile Include="Indexers\IIndexer.cs" />
|
||||
<Compile Include="Indexers\IIndexerRequestGenerator.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user