added Deluge label creation
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Common.Configuration;
|
using Common.Configuration;
|
||||||
using Common.Configuration.DownloadClient;
|
using Common.Configuration.DownloadClient;
|
||||||
@@ -194,6 +194,16 @@ public sealed class DelugeClient
|
|||||||
return webResponse.Result;
|
return webResponse.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyList<string>> GetLabels()
|
||||||
|
{
|
||||||
|
return await SendRequest<IReadOnlyList<string>>("label.label.get_labels");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CreateLabel(string label)
|
||||||
|
{
|
||||||
|
await SendRequest<DelugeResponse<object>>("label.add", label);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task SetTorrentLabel(string hash, string newLabel)
|
public async Task SetTorrentLabel(string hash, string newLabel)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@@ -298,7 +298,14 @@ public class DelugeService : DownloadService, IDelugeService
|
|||||||
|
|
||||||
public override async Task CreateCategoryAsync(string name)
|
public override async Task CreateCategoryAsync(string name)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
IReadOnlyList<string> existingLabels = await _client.GetLabels();
|
||||||
|
|
||||||
|
if (existingLabels.Contains(name, StringComparer.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await _client.CreateLabel(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task ChangeCategoryForNoHardLinksAsync(List<object>? downloads, HashSet<string> excludedHashes, IReadOnlyList<string> ignoredDownloads)
|
public override async Task ChangeCategoryForNoHardLinksAsync(List<object>? downloads, HashSet<string> excludedHashes, IReadOnlyList<string> ignoredDownloads)
|
||||||
|
|||||||
Reference in New Issue
Block a user