Fixed: (LazyLibrarian) Sync priority

pull/1365/head
Bogdan 2 years ago
parent 077e4727f2
commit bea9bd39ff

@ -147,6 +147,7 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
Categories = string.Join(",", indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray())), Categories = string.Join(",", indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray())),
Enabled = indexer.Enable, Enabled = indexer.Enable,
Type = schema, Type = schema,
Priority = indexer.Priority
}; };
return lazyLibrarianIndexer; return lazyLibrarianIndexer;

@ -30,6 +30,7 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
public bool Enabled { get; set; } public bool Enabled { get; set; }
public string Altername { get; set; } public string Altername { get; set; }
public LazyLibrarianProviderType Type { get; set; } public LazyLibrarianProviderType Type { get; set; }
public int Priority { get; set; }
public bool Equals(LazyLibrarianIndexer other) public bool Equals(LazyLibrarianIndexer other)
{ {
@ -43,7 +44,8 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
other.Name == Name && other.Name == Name &&
other.Categories == Categories && other.Categories == Categories &&
other.Enabled == Enabled && other.Enabled == Enabled &&
other.Altername == Altername; other.Altername == Altername &&
other.Priority == Priority;
} }
} }
} }

@ -21,6 +21,8 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
public class LazyLibrarianV1Proxy : ILazyLibrarianV1Proxy public class LazyLibrarianV1Proxy : ILazyLibrarianV1Proxy
{ {
private const int ProwlarrHighestPriority = 50;
private readonly IHttpClient _httpClient; private readonly IHttpClient _httpClient;
private readonly Logger _logger; private readonly Logger _logger;
@ -90,7 +92,8 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
{ "host", indexer.Host }, { "host", indexer.Host },
{ "prov_apikey", indexer.Apikey }, { "prov_apikey", indexer.Apikey },
{ "enabled", indexer.Enabled.ToString().ToLower() }, { "enabled", indexer.Enabled.ToString().ToLower() },
{ "categories", indexer.Categories } { "categories", indexer.Categories },
{ "dlpriority", CalculatePriority(indexer.Priority).ToString() }
}; };
var request = BuildRequest(settings, "/api", "addProvider", HttpMethod.Get, parameters); var request = BuildRequest(settings, "/api", "addProvider", HttpMethod.Get, parameters);
@ -108,7 +111,8 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
{ "prov_apikey", indexer.Apikey }, { "prov_apikey", indexer.Apikey },
{ "enabled", indexer.Enabled.ToString().ToLower() }, { "enabled", indexer.Enabled.ToString().ToLower() },
{ "categories", indexer.Categories }, { "categories", indexer.Categories },
{ "altername", indexer.Altername } { "altername", indexer.Altername },
{ "dlpriority", CalculatePriority(indexer.Priority).ToString() }
}; };
var request = BuildRequest(settings, "/api", "changeProvider", HttpMethod.Get, parameters); var request = BuildRequest(settings, "/api", "changeProvider", HttpMethod.Get, parameters);
@ -191,5 +195,7 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
return results; return results;
} }
private int CalculatePriority(int indexerPriority) => ProwlarrHighestPriority - indexerPriority + 1;
} }
} }

Loading…
Cancel
Save