mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-21 12:20:59 +02:00
New: Sync seeding limits for LazyLibrarian (#2215)
* add support for seeders, seed_ratio and seed_duration for LazyLibrarian
This commit is contained in:
parent
eee8c95ca6
commit
434b07ae64
3 changed files with 29 additions and 1 deletions
|
|
@ -165,6 +165,13 @@ private LazyLibrarianIndexer BuildLazyLibrarianIndexer(IndexerDefinition indexer
|
|||
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 @@ public class LazyLibrarianIndexer
|
|||
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 @@ public bool Equals(LazyLibrarianIndexer other)
|
|||
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 @@ public LazyLibrarianIndexer AddIndexer(LazyLibrarianIndexer indexer, LazyLibrari
|
|||
{ "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 @@ public LazyLibrarianIndexer UpdateIndexer(LazyLibrarianIndexer indexer, LazyLibr
|
|||
{ "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…
Reference in a new issue