Small fixes in the download client.

This commit is contained in:
Roger Far 2025-01-29 19:03:38 -07:00
parent 809903eebb
commit 24c759e4e6
2 changed files with 6 additions and 8 deletions

View file

@ -40,17 +40,16 @@ public class DownloadClient(Download download, Torrent torrent, String destinati
var filePath = DownloadHelper.GetDownloadPath(destinationPath, torrent, download);
var downloadPath = DownloadHelper.GetDownloadPath(torrent, download);
if (torrent.ClientKind == Torrent.TorrentClientKind.AllDebrid && Type == Data.Enums.DownloadClient.Symlink)
{
downloadPath = AllDebridTorrentClient.GetSymlinkPath(torrent, download);
}
if (filePath == null || downloadPath == null)
{
throw new("Invalid download path");
}
var symlinkSourcePath = torrent.ClientKind switch
{
Torrent.TorrentClientKind.AllDebrid => AllDebridTorrentClient.GetSymlinkPath(torrent, download),
_ => downloadPath
};
Type = torrent.DownloadClient;
if (Type != Data.Enums.DownloadClient.Symlink)
@ -63,7 +62,6 @@ public class DownloadClient(Download download, Torrent torrent, String destinati
Data.Enums.DownloadClient.Internal => new InternalDownloader(download.Link, filePath),
Data.Enums.DownloadClient.Bezzad => new BezzadDownloader(download.Link, filePath),
Data.Enums.DownloadClient.Aria2c => new Aria2cDownloader(download.RemoteId, download.Link, filePath, downloadPath, category),
Data.Enums.DownloadClient.Symlink => new SymlinkDownloader(download.Link, filePath, symlinkSourcePath, torrent.ClientKind),
Data.Enums.DownloadClient.Symlink => new SymlinkDownloader(download.Link, filePath, downloadPath, torrent.ClientKind),
Data.Enums.DownloadClient.DownloadStation => await DownloadStationDownloader.Init(download.RemoteId, download.Link, filePath, downloadPath, category),
_ => throw new($"Unknown download client {Type}")

View file

@ -426,7 +426,7 @@ public class AllDebridTorrentClient(ILogger<AllDebridTorrentClient> logger, IHtt
if (matchingTorrentFiles.Count == 0)
{
throw new Exception($"Could not find file {fileName} in {torrent.RdName}");
throw new($"Could not find file {fileName} in {torrent.RdName}");
}
// Torrents with a single file in them don't need to have the `RdName` added