diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb2c84e..a8b64aa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [2.0.79] - 2024-06-03
+### Changed
+- Fixed issue with qBittorrent progress sometimes throwing errors.
+
## [2.0.78] - 2024-05-04
### Changed
- Fixed Aria2c download path issue when a category is set.
diff --git a/client/src/app/navbar/navbar.component.html b/client/src/app/navbar/navbar.component.html
index db1d23b..8a0b7eb 100644
--- a/client/src/app/navbar/navbar.component.html
+++ b/client/src/app/navbar/navbar.component.html
@@ -55,7 +55,7 @@
Profile
Logout
- Version 2.0.78
+ Version 2.0.79
diff --git a/package.json b/package.json
index 56a3da3..7b1dfbb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "rdt-client",
- "version": "2.0.78",
+ "version": "2.0.79",
"description": "This is a web interface to manage your torrents on Real-Debrid.",
"main": "index.js",
"dependencies": {
diff --git a/server/RdtClient.Service/Services/QBittorrent.cs b/server/RdtClient.Service/Services/QBittorrent.cs
index 5830840..ff3f809 100644
--- a/server/RdtClient.Service/Services/QBittorrent.cs
+++ b/server/RdtClient.Service/Services/QBittorrent.cs
@@ -211,20 +211,36 @@ public class QBittorrent(ILogger logger, Settings settings, Authent
torrentPath = Path.Combine(downloadPath, torrent.RdName) + Path.DirectorySeparatorChar;
}
- var rdProgress = (torrent.RdProgress ?? 0) / 100.0m;
- var bytesTotal = torrent.RdSize ?? 1;
- var bytesDone = (Int64)(bytesTotal * rdProgress);
- var speed = torrent.RdSpeed ?? 0;
+ Int64 bytesDone = 0;
+ Int64 bytesTotal = 0;
+ Int64 speed = 0;
+ Int64 rdProgress = 0;
+ try
+ {
+ rdProgress = (Int64) ((torrent.RdProgress ?? 0) / 100.0m);
+ bytesTotal = torrent.RdSize ?? 1;
+ bytesDone = bytesTotal * rdProgress;
+ speed = torrent.RdSpeed ?? 0;
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, $"""
+ Error calculating progress:
+ RdProgress: {torrent.RdProgress}
+ RdSize: {torrent.RdSize}
+ RdSpeed: {torrent.RdSpeed}
+ """);
+ }
if (torrent.Downloads.Count > 0)
{
bytesDone = torrent.Downloads.Sum(m => m.BytesDone);
bytesTotal = torrent.Downloads.Sum(m => m.BytesTotal);
speed = (Int32) torrent.Downloads.Average(m => m.Speed);
- downloadProgress = bytesTotal > 0 ? (Decimal)bytesDone / bytesTotal : 0;
+ downloadProgress = bytesTotal > 0 ? (Decimal) bytesDone / bytesTotal : 0;
}
- var progress = (rdProgress + downloadProgress) / 2m;
+ var progress = (Int64) ((rdProgress + downloadProgress) / 2m);
var result = new TorrentInfo
{
diff --git a/server/RdtClient.Web/RdtClient.Web.csproj b/server/RdtClient.Web/RdtClient.Web.csproj
index 72d00f3..ef6a09f 100644
--- a/server/RdtClient.Web/RdtClient.Web.csproj
+++ b/server/RdtClient.Web/RdtClient.Web.csproj
@@ -4,7 +4,7 @@
net8.0
Exe
94c24cba-f03f-4453-a671-3640b517c573
- 2.0.78
+ 2.0.79
enable
enable
latest