New: Sync seeding limits for LazyLibrarian (#2215)

* add support for seeders, seed_ratio and seed_duration for LazyLibrarian
pull/1882/head
jaype87 5 months ago committed by GitHub
parent eee8c95ca6
commit 434b07ae64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -165,6 +165,13 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
Priority = indexer.Priority
};
if (indexer.Protocol == DownloadProtocol.Torrent)
{
lazyLibrarianIndexer.MinimumSeeders = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.AppMinimumSeeders ?? indexer.AppProfile.Value.MinimumSeeders;
lazyLibrarianIndexer.SeedRatio = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio.GetValueOrDefault();
lazyLibrarianIndexer.SeedTime = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime.GetValueOrDefault();
}
return lazyLibrarianIndexer;
}
}

@ -31,6 +31,9 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
public string Altername { get; set; }
public LazyLibrarianProviderType Type { get; set; }
public int Priority { get; set; }
public double SeedRatio { get; set; }
public int SeedTime { get; set; }
public int MinimumSeeders { get; set; }
public bool Equals(LazyLibrarianIndexer other)
{
@ -45,7 +48,10 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
other.Categories == Categories &&
other.Enabled == Enabled &&
other.Altername == Altername &&
other.Priority == Priority;
other.Priority == Priority &&
other.SeedRatio == SeedRatio &&
other.SeedTime == SeedTime &&
other.MinimumSeeders == MinimumSeeders;
}
}
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using FluentValidation.Results;
@ -96,6 +97,13 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
{ "dlpriority", CalculatePriority(indexer.Priority).ToString() }
};
if (indexer.Type == LazyLibrarianProviderType.Torznab)
{
parameters.Add("seeders", indexer.MinimumSeeders.ToString());
parameters.Add("seed_ratio", indexer.SeedRatio.ToString(CultureInfo.InvariantCulture));
parameters.Add("seed_duration", indexer.SeedTime.ToString());
}
var request = BuildRequest(settings, "/api", "addProvider", HttpMethod.Get, parameters);
CheckForError(Execute<LazyLibrarianStatus>(request));
return indexer;
@ -115,6 +123,13 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
{ "dlpriority", CalculatePriority(indexer.Priority).ToString() }
};
if (indexer.Type == LazyLibrarianProviderType.Torznab)
{
parameters.Add("seeders", indexer.MinimumSeeders.ToString());
parameters.Add("seed_ratio", indexer.SeedRatio.ToString(CultureInfo.InvariantCulture));
parameters.Add("seed_duration", indexer.SeedTime.ToString());
}
var request = BuildRequest(settings, "/api", "changeProvider", HttpMethod.Get, parameters);
CheckForError(Execute<LazyLibrarianStatus>(request));
return indexer;

Loading…
Cancel
Save