mirror of
https://github.com/Radarr/Radarr
synced 2026-03-06 04:23:37 +01:00
33 lines
963 B
C#
33 lines
963 B
C#
using NzbDrone.Core.Download.Clients;
|
|
using NzbDrone.Core.Indexers;
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
namespace NzbDrone.Core.Configuration
|
|
{
|
|
public class SeedConfigProvider: ISeedConfigProvider
|
|
{
|
|
private readonly IIndexerFactory _indexerFactory;
|
|
|
|
public SeedConfigProvider(IIndexerFactory indexerFactory)
|
|
{
|
|
_indexerFactory = indexerFactory;
|
|
}
|
|
|
|
public TorrentSeedConfiguration GetSeedConfiguration(ReleaseInfo release)
|
|
{
|
|
if (release.DownloadProtocol != DownloadProtocol.Torrent) return null;
|
|
|
|
var indexer = _indexerFactory.Get(release.IndexerId);
|
|
|
|
if (indexer.Settings is ITorrentIndexerSettings torrentIndexerSettings)
|
|
{
|
|
return new TorrentSeedConfiguration
|
|
{
|
|
Ratio = torrentIndexerSettings.SeedCriteria.SeedRatio
|
|
};
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|