✨ Use exact path for symlink source when using SymlinkDownloader
This commit is contained in:
parent
303244127b
commit
56a61ad012
3 changed files with 24 additions and 1 deletions
|
|
@ -45,6 +45,11 @@ public class DownloadClient(Download download, Torrent torrent, String destinati
|
||||||
downloadPath = AllDebridTorrentClient.GetSymlinkPath(torrent, download);
|
downloadPath = AllDebridTorrentClient.GetSymlinkPath(torrent, download);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (torrent.ClientKind == Torrent.TorrentClientKind.DebridLink && Type == Data.Enums.DownloadClient.Symlink)
|
||||||
|
{
|
||||||
|
downloadPath = DebridLinkClient.GetSymlinkPath(torrent, download);
|
||||||
|
}
|
||||||
|
|
||||||
if (filePath == null || downloadPath == null)
|
if (filePath == null || downloadPath == null)
|
||||||
{
|
{
|
||||||
throw new("Invalid download path");
|
throw new("Invalid download path");
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class SymlinkDownloader(String uri, String destinationPath, String path,
|
||||||
var shouldSearch = true;
|
var shouldSearch = true;
|
||||||
|
|
||||||
// When resolving symlinks for AllDebrid, we know the exact file path, so we can skip the search.
|
// When resolving symlinks for AllDebrid, we know the exact file path, so we can skip the search.
|
||||||
if (clientKind == Torrent.TorrentClientKind.AllDebrid)
|
if (clientKind is Torrent.TorrentClientKind.AllDebrid or Torrent.TorrentClientKind.DebridLink)
|
||||||
{
|
{
|
||||||
var potentialFilePath = Path.Combine(rcloneMountPath, path);
|
var potentialFilePath = Path.Combine(rcloneMountPath, path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ using RdtClient.Data.Models.TorrentClient;
|
||||||
using RdtClient.Service.Helpers;
|
using RdtClient.Service.Helpers;
|
||||||
using DebridLinkFrNET.Models;
|
using DebridLinkFrNET.Models;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using RdtClient.Data.Models.Data;
|
||||||
|
using Torrent = RdtClient.Data.Models.Data.Torrent;
|
||||||
|
|
||||||
namespace RdtClient.Service.Services.TorrentClients;
|
namespace RdtClient.Service.Services.TorrentClients;
|
||||||
|
|
||||||
|
|
@ -316,4 +318,20 @@ public class DebridLinkClient : ITorrentClient
|
||||||
|
|
||||||
return Task.FromResult(HttpUtility.UrlDecode(uri.Segments.Last()));
|
return Task.FromResult(HttpUtility.UrlDecode(uri.Segments.Last()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String? GetSymlinkPath(Torrent torrent, Download download)
|
||||||
|
{
|
||||||
|
if (torrent.RdName == null || download.FileName == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Single file torrents always have that file at `/mnt-root/Seedbox/filename.ext`
|
||||||
|
if (torrent.Files?.Count == 1)
|
||||||
|
{
|
||||||
|
return download.FileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Path.Combine(torrent.RdName, download.FileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue