Refactored TorrentClientKind to Provider. Upgrade Downloader.NET
This commit is contained in:
parent
780d0e5118
commit
f58b7d3e72
9 changed files with 13 additions and 20 deletions
|
|
@ -44,7 +44,7 @@ public class Torrent
|
|||
[InverseProperty("Torrent")]
|
||||
public IList<Download> Downloads { get; set; } = [];
|
||||
|
||||
public TorrentClientKind? ClientKind { get; set; }
|
||||
public Provider? ClientKind { get; set; }
|
||||
public String? RdId { get; set; }
|
||||
public String? RdName { get; set; }
|
||||
public Int64? RdSize { get; set; }
|
||||
|
|
@ -93,12 +93,4 @@ public class Torrent
|
|||
return DownloadManualFiles.Split(",");
|
||||
}
|
||||
}
|
||||
|
||||
public enum TorrentClientKind
|
||||
{
|
||||
AllDebrid,
|
||||
Premiumize,
|
||||
RealDebrid,
|
||||
TorBox
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<PackageReference Include="AllDebrid.NET" Version="1.0.16" />
|
||||
<PackageReference Include="Aria2.NET" Version="1.0.5" />
|
||||
<PackageReference Include="Downloader" Version="3.3.3" />
|
||||
<PackageReference Include="Downloader.NET" Version="1.0.12" />
|
||||
<PackageReference Include="Downloader.NET" Version="1.0.13" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.2.0" />
|
||||
<PackageReference Include="MonoTorrent" Version="3.0.2" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using RdtClient.Data.Models.Data;
|
||||
using RdtClient.Data.Enums;
|
||||
using RdtClient.Data.Models.Data;
|
||||
using RdtClient.Service.Helpers;
|
||||
using RdtClient.Service.Services.Downloaders;
|
||||
using RdtClient.Service.Services.TorrentClients;
|
||||
|
|
@ -40,7 +41,7 @@ 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)
|
||||
if (torrent.ClientKind == Provider.AllDebrid && Type == Data.Enums.DownloadClient.Symlink)
|
||||
{
|
||||
downloadPath = AllDebridTorrentClient.GetSymlinkPath(torrent, download);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using RdtClient.Data.Models.Data;
|
||||
using RdtClient.Data.Enums;
|
||||
using RdtClient.Service.Helpers;
|
||||
using Serilog;
|
||||
|
||||
namespace RdtClient.Service.Services.Downloaders;
|
||||
|
||||
public class SymlinkDownloader(String uri, String destinationPath, String path, Torrent.TorrentClientKind? clientKind) : IDownloader
|
||||
public class SymlinkDownloader(String uri, String destinationPath, String path, Provider? clientKind) : IDownloader
|
||||
{
|
||||
public event EventHandler<DownloadCompleteEventArgs>? DownloadComplete;
|
||||
public event EventHandler<DownloadProgressEventArgs>? DownloadProgress;
|
||||
|
|
@ -62,7 +62,7 @@ public class SymlinkDownloader(String uri, String destinationPath, String path,
|
|||
var shouldSearch = true;
|
||||
|
||||
// When resolving symlinks for AllDebrid, we know the exact file path, so we can skip the search.
|
||||
if (clientKind == Torrent.TorrentClientKind.AllDebrid)
|
||||
if (clientKind == Provider.AllDebrid)
|
||||
{
|
||||
var potentialFilePath = Path.Combine(rcloneMountPath, path);
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public class QBittorrent(ILogger<QBittorrent> logger, Settings settings, Authent
|
|||
if (!String.IsNullOrWhiteSpace(torrent.RdName))
|
||||
{
|
||||
// Alldebrid stores single file torrents at the root folder.
|
||||
if (torrent.ClientKind == Torrent.TorrentClientKind.AllDebrid && torrent.Files.Count == 1)
|
||||
if (torrent.ClientKind == Provider.AllDebrid && torrent.Files.Count == 1)
|
||||
{
|
||||
torrentPath = Path.Combine(downloadPath, torrent.Files[0].Path);
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ public class AllDebridTorrentClient(ILogger<AllDebridTorrentClient> logger, IHtt
|
|||
torrent.RdFiles = JsonConvert.SerializeObject(torrentClientTorrent.Files);
|
||||
}
|
||||
|
||||
torrent.ClientKind = Torrent.TorrentClientKind.AllDebrid;
|
||||
torrent.ClientKind = Provider.AllDebrid;
|
||||
torrent.RdHost = torrentClientTorrent.Host;
|
||||
torrent.RdSplit = torrentClientTorrent.Split;
|
||||
torrent.RdProgress = torrentClientTorrent.Progress;
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ public class PremiumizeTorrentClient(ILogger<PremiumizeTorrentClient> logger, IH
|
|||
torrent.RdFiles = JsonConvert.SerializeObject(torrentClientTorrent.Files);
|
||||
}
|
||||
|
||||
torrent.ClientKind = Torrent.TorrentClientKind.Premiumize;
|
||||
torrent.ClientKind = Provider.Premiumize;
|
||||
torrent.RdHost = torrentClientTorrent.Host;
|
||||
torrent.RdSplit = torrentClientTorrent.Split;
|
||||
torrent.RdProgress = torrentClientTorrent.Progress;
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ public class RealDebridTorrentClient(ILogger<RealDebridTorrentClient> logger, IH
|
|||
torrent.RdFiles = JsonConvert.SerializeObject(torrentClientTorrent.Files);
|
||||
}
|
||||
|
||||
torrent.ClientKind = Data.Models.Data.Torrent.TorrentClientKind.RealDebrid;
|
||||
torrent.ClientKind = Provider.RealDebrid;
|
||||
torrent.RdHost = torrentClientTorrent.Host;
|
||||
torrent.RdSplit = torrentClientTorrent.Split;
|
||||
torrent.RdProgress = torrentClientTorrent.Progress;
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
torrent.RdFiles = JsonConvert.SerializeObject(rdTorrent.Files);
|
||||
}
|
||||
|
||||
torrent.ClientKind = Torrent.TorrentClientKind.TorBox;
|
||||
torrent.ClientKind = Provider.TorBox;
|
||||
torrent.RdHost = rdTorrent.Host;
|
||||
torrent.RdSplit = rdTorrent.Split;
|
||||
torrent.RdProgress = rdTorrent.Progress;
|
||||
|
|
|
|||
Loading…
Reference in a new issue