Merge pull request #930 from omgbeez/upstream/downloads-fix

Fix broken download status in the UI
This commit is contained in:
Roger Far 2026-02-21 15:18:08 -07:00 committed by GitHub
commit f4e1cf4717
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 80 additions and 54 deletions

View file

@ -51,8 +51,17 @@ public class SabnzbdHandler(Authentication authentication, IHttpContextAccessor
if (loginResult.Succeeded) if (loginResult.Succeeded)
{ {
context.Succeed(requirement); context.Succeed(requirement);
return;
} }
// Invalid credentials provided
context.Fail();
return;
} }
// Authentication required but missing credentials
context.Fail();
return;
} }
} }
} }

View file

@ -102,6 +102,7 @@ public class DownloadClient(Download download, Torrent torrent, String destinati
await Downloader.Cancel(); await Downloader.Cancel();
} }
Error = ex.Message;
Finished = true; Finished = true;
throw new($"An unexpected error occurred preparing download {download.Link} for torrent {torrent.RdName}: {ex.Message}"); throw new($"An unexpected error occurred preparing download {download.Link} for torrent {torrent.RdName}: {ex.Message}");

View file

@ -48,25 +48,30 @@ public class RemoteService(IHubContext<RdtHub> hub, Torrents torrents)
RdSpeed = torrent.RdSpeed, RdSpeed = torrent.RdSpeed,
RdSeeders = torrent.RdSeeders, RdSeeders = torrent.RdSeeders,
Files = torrent.Files, Files = torrent.Files,
Downloads = torrent.Downloads.Select(download => new DownloadDto Downloads = torrent.Downloads.Select(download =>
{ {
DownloadId = download.DownloadId, var (speed, bytesTotal, bytesDone) = torrents.GetDownloadStats(download.DownloadId);
TorrentId = download.TorrentId,
Path = download.Path, return new DownloadDto
Link = download.Link, {
Added = download.Added, DownloadId = download.DownloadId,
DownloadQueued = download.DownloadQueued, TorrentId = download.TorrentId,
DownloadStarted = download.DownloadStarted, Path = download.Path,
DownloadFinished = download.DownloadFinished, Link = download.Link,
UnpackingQueued = download.UnpackingQueued, Added = download.Added,
UnpackingStarted = download.UnpackingStarted, DownloadQueued = download.DownloadQueued,
UnpackingFinished = download.UnpackingFinished, DownloadStarted = download.DownloadStarted,
Completed = download.Completed, DownloadFinished = download.DownloadFinished,
RetryCount = download.RetryCount, UnpackingQueued = download.UnpackingQueued,
Error = download.Error, UnpackingStarted = download.UnpackingStarted,
BytesTotal = download.BytesTotal, UnpackingFinished = download.UnpackingFinished,
BytesDone = download.BytesDone, Completed = download.Completed,
Speed = download.Speed RetryCount = download.RetryCount,
Error = download.Error,
BytesTotal = bytesTotal,
BytesDone = bytesDone,
Speed = speed
};
}).ToList() }).ToList()
}).ToList(); }).ToList();
await hub.Clients.All.SendCoreAsync("update", await hub.Clients.All.SendCoreAsync("update",

View file

@ -544,6 +544,7 @@ public class TorrentRunner(ILogger<TorrentRunner> logger, Torrents torrents, Dow
catch (Exception ex) catch (Exception ex)
{ {
LogError($"Unable to start download: {ex.Message}", download, torrent); LogError($"Unable to start download: {ex.Message}", download, torrent);
continue;
} }
Log($"Started download", download, torrent); Log($"Started download", download, torrent);

View file

@ -60,25 +60,30 @@ public class TorrentsController(ILogger<TorrentsController> logger, Torrents tor
RdSpeed = torrent.RdSpeed, RdSpeed = torrent.RdSpeed,
RdSeeders = torrent.RdSeeders, RdSeeders = torrent.RdSeeders,
Files = torrent.Files, Files = torrent.Files,
Downloads = torrent.Downloads.Select(download => new DownloadDto Downloads = torrent.Downloads.Select(download =>
{ {
DownloadId = download.DownloadId, var (speed, bytesTotal, bytesDone) = torrents.GetDownloadStats(download.DownloadId);
TorrentId = download.TorrentId,
Path = download.Path, return new DownloadDto
Link = download.Link, {
Added = download.Added, DownloadId = download.DownloadId,
DownloadQueued = download.DownloadQueued, TorrentId = download.TorrentId,
DownloadStarted = download.DownloadStarted, Path = download.Path,
DownloadFinished = download.DownloadFinished, Link = download.Link,
UnpackingQueued = download.UnpackingQueued, Added = download.Added,
UnpackingStarted = download.UnpackingStarted, DownloadQueued = download.DownloadQueued,
UnpackingFinished = download.UnpackingFinished, DownloadStarted = download.DownloadStarted,
Completed = download.Completed, DownloadFinished = download.DownloadFinished,
RetryCount = download.RetryCount, UnpackingQueued = download.UnpackingQueued,
Error = download.Error, UnpackingStarted = download.UnpackingStarted,
BytesTotal = download.BytesTotal, UnpackingFinished = download.UnpackingFinished,
BytesDone = download.BytesDone, Completed = download.Completed,
Speed = download.Speed RetryCount = download.RetryCount,
Error = download.Error,
BytesTotal = bytesTotal,
BytesDone = bytesDone,
Speed = speed
};
}).ToList() }).ToList()
}).ToList(); }).ToList();
@ -140,25 +145,30 @@ public class TorrentsController(ILogger<TorrentsController> logger, Torrents tor
RdSpeed = torrent.RdSpeed, RdSpeed = torrent.RdSpeed,
RdSeeders = torrent.RdSeeders, RdSeeders = torrent.RdSeeders,
Files = torrent.Files, Files = torrent.Files,
Downloads = torrent.Downloads.Select(download => new DownloadDto Downloads = torrent.Downloads.Select(download =>
{ {
DownloadId = download.DownloadId, var (speed, bytesTotal, bytesDone) = torrents.GetDownloadStats(download.DownloadId);
TorrentId = download.TorrentId,
Path = download.Path, return new DownloadDto
Link = download.Link, {
Added = download.Added, DownloadId = download.DownloadId,
DownloadQueued = download.DownloadQueued, TorrentId = download.TorrentId,
DownloadStarted = download.DownloadStarted, Path = download.Path,
DownloadFinished = download.DownloadFinished, Link = download.Link,
UnpackingQueued = download.UnpackingQueued, Added = download.Added,
UnpackingStarted = download.UnpackingStarted, DownloadQueued = download.DownloadQueued,
UnpackingFinished = download.UnpackingFinished, DownloadStarted = download.DownloadStarted,
Completed = download.Completed, DownloadFinished = download.DownloadFinished,
RetryCount = download.RetryCount, UnpackingQueued = download.UnpackingQueued,
Error = download.Error, UnpackingStarted = download.UnpackingStarted,
BytesTotal = download.BytesTotal, UnpackingFinished = download.UnpackingFinished,
BytesDone = download.BytesDone, Completed = download.Completed,
Speed = download.Speed RetryCount = download.RetryCount,
Error = download.Error,
BytesTotal = bytesTotal,
BytesDone = bytesDone,
Speed = speed
};
}).ToList() }).ToList()
}; };