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)
{
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();
}
Error = ex.Message;
Finished = true;
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,
RdSeeders = torrent.RdSeeders,
Files = torrent.Files,
Downloads = torrent.Downloads.Select(download => new DownloadDto
Downloads = torrent.Downloads.Select(download =>
{
DownloadId = download.DownloadId,
TorrentId = download.TorrentId,
Path = download.Path,
Link = download.Link,
Added = download.Added,
DownloadQueued = download.DownloadQueued,
DownloadStarted = download.DownloadStarted,
DownloadFinished = download.DownloadFinished,
UnpackingQueued = download.UnpackingQueued,
UnpackingStarted = download.UnpackingStarted,
UnpackingFinished = download.UnpackingFinished,
Completed = download.Completed,
RetryCount = download.RetryCount,
Error = download.Error,
BytesTotal = download.BytesTotal,
BytesDone = download.BytesDone,
Speed = download.Speed
var (speed, bytesTotal, bytesDone) = torrents.GetDownloadStats(download.DownloadId);
return new DownloadDto
{
DownloadId = download.DownloadId,
TorrentId = download.TorrentId,
Path = download.Path,
Link = download.Link,
Added = download.Added,
DownloadQueued = download.DownloadQueued,
DownloadStarted = download.DownloadStarted,
DownloadFinished = download.DownloadFinished,
UnpackingQueued = download.UnpackingQueued,
UnpackingStarted = download.UnpackingStarted,
UnpackingFinished = download.UnpackingFinished,
Completed = download.Completed,
RetryCount = download.RetryCount,
Error = download.Error,
BytesTotal = bytesTotal,
BytesDone = bytesDone,
Speed = speed
};
}).ToList()
}).ToList();
await hub.Clients.All.SendCoreAsync("update",

View file

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

View file

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