Skip to content

Commit

Permalink
NEW! Add RecheckTorrents()
Browse files Browse the repository at this point in the history
- Call
- Test
- Readme
  • Loading branch information
rafaelkan committed Oct 29, 2024
1 parent 7c6e08c commit 50f63d3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
22 changes: 22 additions & 0 deletions DelugeRPCClient.Net.Tests/TorrentsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -104,5 +105,26 @@ public async Task PauseResumeTorrent()
bool logoutResult = await client.Logout();
Assert.IsTrue(logoutResult);
}

[TestMethod]
public async Task RecheckTorrents()
{
DelugeClient client = new DelugeClient(url: Constants.DelugeUrl, password: Constants.DelugePassword);

bool loginResult = await client.Login();
Assert.IsTrue(loginResult);

List<Torrent> torrents = await client.ListTorrents();
Assert.IsNotNull(torrents);
Assert.AreNotEqual(0, torrents.Count);

Torrent torrent = torrents[0];

bool? recheckResult = await client.RecheckTorrents(torrent.Hash.Split(",").ToList());
Assert.IsNull(recheckResult);

bool logoutResult = await client.Logout();
Assert.IsTrue(logoutResult);
}
}
}
10 changes: 10 additions & 0 deletions DelugeRPCClient.Net/DelugeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ public async Task<bool> ResumeTorrent(string hash)
return result == null;
}

/// <summary>
/// Recheck torrents
/// </summary>
/// <param name="hash">Hash of the target torrents</param>
/// <returns>true if the action is successfull</returns>
public async Task<bool?> RecheckTorrents(List<string> hash)
{
return await SendRequest<bool?>("core.force_recheck", hash);
}

#endregion

#region Config
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Resume Torrent
bool resumeResult = await client.ResumeTorrent(torrentHash);
```

#### Recheck Torrents
```C#
bool recheckTorrentResult = await client.RecheckTorrents(List<string> torrentsHash);
```

## Configs

#### List configs
Expand Down

0 comments on commit 50f63d3

Please sign in to comment.