mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
cleaned up ThingiProvider
This commit is contained in:
parent
7b14d09976
commit
c9f5cb0257
@ -128,7 +128,7 @@ private List<ReleaseInfo> Fetch(IIndexer indexer, IEnumerable<string> urls)
|
|||||||
}
|
}
|
||||||
catch (ApiKeyException)
|
catch (ApiKeyException)
|
||||||
{
|
{
|
||||||
_logger.Warn("Invalid API Key for {0} {1}", indexer.Name, url);
|
_logger.Warn("Invalid API Key for {0} {1}", indexer, url);
|
||||||
}
|
}
|
||||||
catch (Exception feedEx)
|
catch (Exception feedEx)
|
||||||
{
|
{
|
||||||
|
@ -422,7 +422,13 @@
|
|||||||
<Compile Include="Rest\RestSharpExtensions.cs" />
|
<Compile Include="Rest\RestSharpExtensions.cs" />
|
||||||
<Compile Include="Rest\RestException.cs" />
|
<Compile Include="Rest\RestException.cs" />
|
||||||
<Compile Include="SeriesStats\SeriesStatisticsService.cs" />
|
<Compile Include="SeriesStats\SeriesStatisticsService.cs" />
|
||||||
<Compile Include="ThingiProvider\ProviderService.cs" />
|
<Compile Include="ThingiProvider\IProviderConfig.cs" />
|
||||||
|
<Compile Include="ThingiProvider\IProviderFactory.cs" />
|
||||||
|
<Compile Include="ThingiProvider\IProviderRepository.cs" />
|
||||||
|
<Compile Include="ThingiProvider\NullConfig.cs" />
|
||||||
|
<Compile Include="ThingiProvider\ProviderDefinition.cs" />
|
||||||
|
<Compile Include="ThingiProvider\ProviderRepository.cs" />
|
||||||
|
<Compile Include="ThingiProvider\ProviderFactory.cs" />
|
||||||
<Compile Include="Tv\EpisodeService.cs" />
|
<Compile Include="Tv\EpisodeService.cs" />
|
||||||
<Compile Include="Tv\Events\EpisodeInfoDeletedEvent.cs" />
|
<Compile Include="Tv\Events\EpisodeInfoDeletedEvent.cs" />
|
||||||
<Compile Include="Tv\Events\EpisodeInfoUpdatedEvent.cs" />
|
<Compile Include="Tv\Events\EpisodeInfoUpdatedEvent.cs" />
|
||||||
@ -621,4 +627,4 @@
|
|||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
@ -13,7 +13,7 @@
|
|||||||
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
<DefaultTestTimeout>5000</DefaultTestTimeout>
|
<DefaultTestTimeout>5000</DefaultTestTimeout>
|
||||||
<UseBuildConfiguration>Debug</UseBuildConfiguration>
|
<UseBuildConfiguration>RELEASE</UseBuildConfiguration>
|
||||||
<UseBuildPlatform>x86</UseBuildPlatform>
|
<UseBuildPlatform>x86</UseBuildPlatform>
|
||||||
<ProxyProcessPath></ProxyProcessPath>
|
<ProxyProcessPath></ProxyProcessPath>
|
||||||
<UseCPUArchitecture>x86</UseCPUArchitecture>
|
<UseCPUArchitecture>x86</UseCPUArchitecture>
|
||||||
|
@ -1,33 +1,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentValidation.Results;
|
|
||||||
using NzbDrone.Core.Datastore;
|
|
||||||
using NzbDrone.Core.Messaging.Events;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.ThingiProvider
|
namespace NzbDrone.Core.ThingiProvider
|
||||||
{
|
{
|
||||||
public interface IProviderRepository<TProvider> : IBasicRepository<TProvider> where TProvider : ModelBase, new()
|
|
||||||
{
|
|
||||||
TProvider GetByName(string name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class ProviderRepository<TProviderDefinition> : BasicRepository<TProviderDefinition>, IProviderRepository<TProviderDefinition>
|
|
||||||
where TProviderDefinition : ModelBase,
|
|
||||||
new()
|
|
||||||
{
|
|
||||||
protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator)
|
|
||||||
: base(database, eventAggregator)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public TProviderDefinition GetByName(string name)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IProvider
|
public interface IProvider
|
||||||
{
|
{
|
||||||
Type ConfigContract { get; }
|
Type ConfigContract { get; }
|
||||||
@ -35,45 +11,4 @@ public interface IProvider
|
|||||||
IEnumerable<ProviderDefinition> DefaultDefinitions { get; }
|
IEnumerable<ProviderDefinition> DefaultDefinitions { get; }
|
||||||
ProviderDefinition Definition { get; set; }
|
ProviderDefinition Definition { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ProviderDefinition : ModelBase
|
|
||||||
{
|
|
||||||
private IProviderConfig _settings;
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Implementation { get; set; }
|
|
||||||
public bool Enable { get; set; }
|
|
||||||
|
|
||||||
public string ConfigContract { get; set; }
|
|
||||||
|
|
||||||
public IProviderConfig Settings
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _settings;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_settings = value;
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
ConfigContract = value.GetType().Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IProviderConfig
|
|
||||||
{
|
|
||||||
ValidationResult Validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class NullConfig : IProviderConfig
|
|
||||||
{
|
|
||||||
public static readonly NullConfig Instance = new NullConfig();
|
|
||||||
|
|
||||||
public ValidationResult Validate()
|
|
||||||
{
|
|
||||||
return new ValidationResult();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
9
NzbDrone.Core/ThingiProvider/IProviderConfig.cs
Normal file
9
NzbDrone.Core/ThingiProvider/IProviderConfig.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using FluentValidation.Results;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ThingiProvider
|
||||||
|
{
|
||||||
|
public interface IProviderConfig
|
||||||
|
{
|
||||||
|
ValidationResult Validate();
|
||||||
|
}
|
||||||
|
}
|
17
NzbDrone.Core/ThingiProvider/IProviderFactory.cs
Normal file
17
NzbDrone.Core/ThingiProvider/IProviderFactory.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ThingiProvider
|
||||||
|
{
|
||||||
|
public interface IProviderFactory<TProvider, TProviderDefinition>
|
||||||
|
where TProviderDefinition : ProviderDefinition, new()
|
||||||
|
where TProvider : IProvider
|
||||||
|
{
|
||||||
|
List<TProviderDefinition> All();
|
||||||
|
List<TProvider> GetAvailableProviders();
|
||||||
|
TProviderDefinition Get(int id);
|
||||||
|
TProviderDefinition Create(TProviderDefinition indexer);
|
||||||
|
void Update(TProviderDefinition indexer);
|
||||||
|
void Delete(int id);
|
||||||
|
List<TProviderDefinition> Templates();
|
||||||
|
}
|
||||||
|
}
|
8
NzbDrone.Core/ThingiProvider/IProviderRepository.cs
Normal file
8
NzbDrone.Core/ThingiProvider/IProviderRepository.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ThingiProvider
|
||||||
|
{
|
||||||
|
public interface IProviderRepository<TProvider> : IBasicRepository<TProvider> where TProvider : ModelBase, new()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
14
NzbDrone.Core/ThingiProvider/NullConfig.cs
Normal file
14
NzbDrone.Core/ThingiProvider/NullConfig.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using FluentValidation.Results;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ThingiProvider
|
||||||
|
{
|
||||||
|
public class NullConfig : IProviderConfig
|
||||||
|
{
|
||||||
|
public static readonly NullConfig Instance = new NullConfig();
|
||||||
|
|
||||||
|
public ValidationResult Validate()
|
||||||
|
{
|
||||||
|
return new ValidationResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
NzbDrone.Core/ThingiProvider/ProviderDefinition.cs
Normal file
30
NzbDrone.Core/ThingiProvider/ProviderDefinition.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ThingiProvider
|
||||||
|
{
|
||||||
|
public abstract class ProviderDefinition : ModelBase
|
||||||
|
{
|
||||||
|
private IProviderConfig _settings;
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Implementation { get; set; }
|
||||||
|
public bool Enable { get; set; }
|
||||||
|
|
||||||
|
public string ConfigContract { get; set; }
|
||||||
|
|
||||||
|
public IProviderConfig Settings
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _settings;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_settings = value;
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
ConfigContract = value.GetType().Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,25 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Reflection;
|
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
|
||||||
namespace NzbDrone.Core.ThingiProvider
|
namespace NzbDrone.Core.ThingiProvider
|
||||||
{
|
{
|
||||||
public interface IProviderFactory<TProvider, TProviderDefinition>
|
|
||||||
where TProviderDefinition : ProviderDefinition, new()
|
|
||||||
where TProvider : IProvider
|
|
||||||
{
|
|
||||||
List<TProviderDefinition> All();
|
|
||||||
List<TProvider> GetAvailableProviders();
|
|
||||||
TProviderDefinition Get(int id);
|
|
||||||
TProviderDefinition Create(TProviderDefinition indexer);
|
|
||||||
void Update(TProviderDefinition indexer);
|
|
||||||
void Delete(int id);
|
|
||||||
List<TProviderDefinition> Templates();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class ProviderFactory<TProvider, TProviderDefinition> : IProviderFactory<TProvider, TProviderDefinition>, IHandle<ApplicationStartedEvent>
|
public abstract class ProviderFactory<TProvider, TProviderDefinition> : IProviderFactory<TProvider, TProviderDefinition>, IHandle<ApplicationStartedEvent>
|
||||||
where TProviderDefinition : ProviderDefinition, new()
|
where TProviderDefinition : ProviderDefinition, new()
|
||||||
where TProvider : IProvider
|
where TProvider : IProvider
|
16
NzbDrone.Core/ThingiProvider/ProviderRepository.cs
Normal file
16
NzbDrone.Core/ThingiProvider/ProviderRepository.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ThingiProvider
|
||||||
|
{
|
||||||
|
public class ProviderRepository<TProviderDefinition> : BasicRepository<TProviderDefinition>, IProviderRepository<TProviderDefinition>
|
||||||
|
where TProviderDefinition : ModelBase,
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator)
|
||||||
|
: base(database, eventAggregator)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user