Fixed downloadpath and contentpath
This commit is contained in:
parent
7f9d6e6cba
commit
55f2c4a338
6 changed files with 51 additions and 39 deletions
|
|
@ -68,7 +68,8 @@ Replace the paths in `volumes` as in the above step.
|
||||||
1. Browse to [http://127.0.0.1:6500](http://127.0.0.1:6500) (or the path of your server).
|
1. Browse to [http://127.0.0.1:6500](http://127.0.0.1:6500) (or the path of your server).
|
||||||
1. The very first credentials you enter in will be remembered for future logins.
|
1. The very first credentials you enter in will be remembered for future logins.
|
||||||
1. Click on `Settings` on the top and enter your Real-Debrid API key (found here: [https://real-debrid.com/apitoken](https://real-debrid.com/apitoken).
|
1. Click on `Settings` on the top and enter your Real-Debrid API key (found here: [https://real-debrid.com/apitoken](https://real-debrid.com/apitoken).
|
||||||
1. Change your download path if needed. When using Docker, this path will be the path on your local machine.
|
1. If you are using docker then the `Download path` setting needs to be the same as in your docker file mapping. By default this is `/data/downloads`
|
||||||
|
1. Same goes for `Mapped path`, but this is the destination path from your docker mapping. This is a path on your host.
|
||||||
1. Save your settings.
|
1. Save your settings.
|
||||||
|
|
||||||
### Troubleshooting
|
### Troubleshooting
|
||||||
|
|
@ -90,6 +91,8 @@ RdtClient emulates the qBittorrent web protocol and allow applications to use th
|
||||||
1. Hit `Test` and then `Save` if all is well.
|
1. Hit `Test` and then `Save` if all is well.
|
||||||
1. Sonarr will now think you have a regular Torrent client hooked up.
|
1. Sonarr will now think you have a regular Torrent client hooked up.
|
||||||
|
|
||||||
|
When downloading files it will append the `category` setting in the Sonarr/Radarr Download Client setting. For example if your Remote Path setting is set to `C:\Downloads` and your Sonarr Download Client setting `category` is set to `sonarr` files will be downloaded to `C:\Downloads\sonarr`.
|
||||||
|
|
||||||
Notice: the progress and ETA reported in Sonarr's Activity tab will not be accurate, but it will report the torrent as completed so it can be processed after it is done downloading.
|
Notice: the progress and ETA reported in Sonarr's Activity tab will not be accurate, but it will report the torrent as completed so it can be processed after it is done downloading.
|
||||||
|
|
||||||
## Build instructions
|
## Build instructions
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<table class="table is-fullwidth is-hoverable">
|
<table class="table is-fullwidth is-hoverable">
|
||||||
<colgroup>
|
|
||||||
<col style="width: calc(60% - 650px)" />
|
|
||||||
<col style="width: 100px" />
|
|
||||||
<col style="width: 150px" />
|
|
||||||
<col style="width: 150px" />
|
|
||||||
<col style="width: 150px" />
|
|
||||||
<col style="width: 40%" />
|
|
||||||
<col style="width: 100px" />
|
|
||||||
</colgroup>
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
|
|
||||||
|
|
@ -216,15 +216,16 @@ namespace RdtClient.Service.Services
|
||||||
var downloadPath = await _settings.GetString("MappedPath");
|
var downloadPath = await _settings.GetString("MappedPath");
|
||||||
downloadPath = downloadPath.TrimEnd('\\')
|
downloadPath = downloadPath.TrimEnd('\\')
|
||||||
.TrimEnd('/');
|
.TrimEnd('/');
|
||||||
|
|
||||||
downloadPath += Path.DirectorySeparatorChar;
|
downloadPath += Path.DirectorySeparatorChar;
|
||||||
|
|
||||||
return downloadPath;
|
return downloadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IList<TorrentInfo>> TorrentInfo()
|
public async Task<IList<TorrentInfo>> TorrentInfo()
|
||||||
{
|
{
|
||||||
var savePath = await AppDefaultSavePath();
|
var savePath = await AppDefaultSavePath();
|
||||||
|
|
||||||
var results = new List<TorrentInfo>();
|
var results = new List<TorrentInfo>();
|
||||||
|
|
||||||
var torrents = await _torrents.Get();
|
var torrents = await _torrents.Get();
|
||||||
|
|
@ -232,6 +233,13 @@ namespace RdtClient.Service.Services
|
||||||
var prio = 0;
|
var prio = 0;
|
||||||
foreach (var torrent in torrents)
|
foreach (var torrent in torrents)
|
||||||
{
|
{
|
||||||
|
var downloadPath = savePath;
|
||||||
|
|
||||||
|
if (!String.IsNullOrWhiteSpace(torrent?.Category))
|
||||||
|
{
|
||||||
|
downloadPath = Path.Combine(downloadPath, torrent.Category);
|
||||||
|
}
|
||||||
|
|
||||||
var result = new TorrentInfo();
|
var result = new TorrentInfo();
|
||||||
result.AddedOn = torrent.RdAdded.ToUnixTimeSeconds();
|
result.AddedOn = torrent.RdAdded.ToUnixTimeSeconds();
|
||||||
result.AmountLeft = (Int64) (torrent.RdSize * (100.0 - torrent.RdProgress) / 100.0);
|
result.AmountLeft = (Int64) (torrent.RdSize * (100.0 - torrent.RdProgress) / 100.0);
|
||||||
|
|
@ -261,7 +269,8 @@ namespace RdtClient.Service.Services
|
||||||
result.Progress = (Int64) (torrent.RdProgress / 100.0);
|
result.Progress = (Int64) (torrent.RdProgress / 100.0);
|
||||||
result.Ratio = 1;
|
result.Ratio = 1;
|
||||||
result.RatioLimit = 1;
|
result.RatioLimit = 1;
|
||||||
result.SavePath = savePath;
|
result.ContentPath = downloadPath;
|
||||||
|
result.SavePath = downloadPath;
|
||||||
result.SeedingTimeLimit = 1;
|
result.SeedingTimeLimit = 1;
|
||||||
result.SeenComplete = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
result.SeenComplete = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||||
result.SeqDl = false;
|
result.SeqDl = false;
|
||||||
|
|
@ -317,13 +326,18 @@ namespace RdtClient.Service.Services
|
||||||
public async Task<TorrentProperties> TorrentProperties(String hash)
|
public async Task<TorrentProperties> TorrentProperties(String hash)
|
||||||
{
|
{
|
||||||
var savePath = await AppDefaultSavePath();
|
var savePath = await AppDefaultSavePath();
|
||||||
|
|
||||||
var torrent = await _torrents.GetByHash(hash);
|
var torrent = await _torrents.GetByHash(hash);
|
||||||
|
|
||||||
if (torrent == null)
|
if (torrent == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrWhiteSpace(torrent.Category))
|
||||||
|
{
|
||||||
|
savePath = Path.Combine(savePath, torrent.Category);
|
||||||
|
}
|
||||||
|
|
||||||
var result = new TorrentProperties
|
var result = new TorrentProperties
|
||||||
{
|
{
|
||||||
|
|
@ -374,19 +388,7 @@ namespace RdtClient.Service.Services
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _torrents.Delete(torrent.TorrentId, true, true, true);
|
await _torrents.Delete(torrent.TorrentId, true, true, deleteFiles);
|
||||||
|
|
||||||
if (deleteFiles)
|
|
||||||
{
|
|
||||||
var savePath = await AppDefaultSavePath();
|
|
||||||
|
|
||||||
var torrentPath = Path.Combine(savePath, torrent.RdName);
|
|
||||||
|
|
||||||
if (Directory.Exists(torrentPath))
|
|
||||||
{
|
|
||||||
Directory.Delete(torrentPath, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task TorrentsAdd(String magnetLink, Boolean autoDownload, Boolean autoUnpack, Boolean autoDelete)
|
public async Task TorrentsAdd(String magnetLink, Boolean autoDownload, Boolean autoUnpack, Boolean autoDelete)
|
||||||
|
|
@ -423,7 +425,7 @@ namespace RdtClient.Service.Services
|
||||||
m => new TorrentCategory
|
m => new TorrentCategory
|
||||||
{
|
{
|
||||||
Name = m.Category,
|
Name = m.Category,
|
||||||
SavePath = savePath
|
SavePath = Path.Combine(savePath, m.Category)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace RdtClient.Service.Services
|
||||||
_logger.LogInformation("TaskRunner started.");
|
_logger.LogInformation("TaskRunner started.");
|
||||||
|
|
||||||
await torrentRunner.Initialize();
|
await torrentRunner.Initialize();
|
||||||
|
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ namespace RdtClient.Service.Services
|
||||||
var settingApiKey = await _settings.GetString("RealDebridApiKey");
|
var settingApiKey = await _settings.GetString("RealDebridApiKey");
|
||||||
var minFileSizeSetting = await _settings.GetNumber("MinFileSize");
|
var minFileSizeSetting = await _settings.GetNumber("MinFileSize");
|
||||||
|
|
||||||
|
minFileSizeSetting = minFileSizeSetting * 1024 * 1024;
|
||||||
|
|
||||||
if (String.IsNullOrWhiteSpace(settingApiKey))
|
if (String.IsNullOrWhiteSpace(settingApiKey))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -168,7 +170,7 @@ namespace RdtClient.Service.Services
|
||||||
if (minFileSizeSetting > 0)
|
if (minFileSizeSetting > 0)
|
||||||
{
|
{
|
||||||
fileIds = torrent.Files
|
fileIds = torrent.Files
|
||||||
.Where(m => m.Bytes * 1024 * 1024 > minFileSizeSetting)
|
.Where(m => m.Bytes > minFileSizeSetting)
|
||||||
.Select(m => m.Id.ToString())
|
.Select(m => m.Id.ToString())
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,13 +165,12 @@ namespace RdtClient.Service.Services
|
||||||
{
|
{
|
||||||
if (deleteLocalFiles)
|
if (deleteLocalFiles)
|
||||||
{
|
{
|
||||||
var settingDownloadPath = await _settings.GetString("DownloadPath");
|
var downloadPath = await DownloadPath(torrent);
|
||||||
|
downloadPath = Path.Combine(downloadPath, torrent.RdName);
|
||||||
|
|
||||||
var torrentPath = Path.Combine(settingDownloadPath, torrent.RdName);
|
if (Directory.Exists(downloadPath))
|
||||||
|
|
||||||
if (Directory.Exists(torrentPath))
|
|
||||||
{
|
{
|
||||||
Directory.Delete(torrentPath, true);
|
Directory.Delete(downloadPath, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,10 +209,11 @@ namespace RdtClient.Service.Services
|
||||||
public async Task Download(Guid downloadId)
|
public async Task Download(Guid downloadId)
|
||||||
{
|
{
|
||||||
var settingDownloadLimit = await _settings.GetNumber("DownloadLimit");
|
var settingDownloadLimit = await _settings.GetNumber("DownloadLimit");
|
||||||
var settingDownloadPath = await _settings.GetString("DownloadPath");
|
|
||||||
|
|
||||||
var download = await _downloads.GetById(downloadId);
|
var download = await _downloads.GetById(downloadId);
|
||||||
|
|
||||||
|
var downloadPath = await DownloadPath(download.Torrent);
|
||||||
|
|
||||||
// Check if we have reached the download limit, if so queue the download, but don't start it.
|
// Check if we have reached the download limit, if so queue the download, but don't start it.
|
||||||
if (TorrentRunner.ActiveDownloadClients.Count >= settingDownloadLimit)
|
if (TorrentRunner.ActiveDownloadClients.Count >= settingDownloadLimit)
|
||||||
{
|
{
|
||||||
|
|
@ -224,7 +224,7 @@ namespace RdtClient.Service.Services
|
||||||
await _downloads.UpdateDownloadStarted(download.DownloadId, download.DownloadStarted);
|
await _downloads.UpdateDownloadStarted(download.DownloadId, download.DownloadStarted);
|
||||||
|
|
||||||
// Start the download process
|
// Start the download process
|
||||||
var downloadClient = new DownloadClient(download, settingDownloadPath);
|
var downloadClient = new DownloadClient(download, downloadPath);
|
||||||
|
|
||||||
if (TorrentRunner.ActiveDownloadClients.TryAdd(downloadId, downloadClient))
|
if (TorrentRunner.ActiveDownloadClients.TryAdd(downloadId, downloadClient))
|
||||||
{
|
{
|
||||||
|
|
@ -235,10 +235,11 @@ namespace RdtClient.Service.Services
|
||||||
public async Task Unpack(Guid downloadId)
|
public async Task Unpack(Guid downloadId)
|
||||||
{
|
{
|
||||||
var settingUnpackLimit = await _settings.GetNumber("UnpackLimit");
|
var settingUnpackLimit = await _settings.GetNumber("UnpackLimit");
|
||||||
var settingDownloadPath = await _settings.GetString("DownloadPath");
|
|
||||||
|
|
||||||
var download = await _downloads.GetById(downloadId);
|
var download = await _downloads.GetById(downloadId);
|
||||||
|
|
||||||
|
var downloadPath = await DownloadPath(download.Torrent);
|
||||||
|
|
||||||
// Check if the file is even unpackable.
|
// Check if the file is even unpackable.
|
||||||
var uri = new Uri(download.Link);
|
var uri = new Uri(download.Link);
|
||||||
var fileName = uri.Segments.Last();
|
var fileName = uri.Segments.Last();
|
||||||
|
|
@ -270,7 +271,7 @@ namespace RdtClient.Service.Services
|
||||||
await _downloads.UpdateUnpackingStarted(download.DownloadId, download.UnpackingStarted);
|
await _downloads.UpdateUnpackingStarted(download.DownloadId, download.UnpackingStarted);
|
||||||
|
|
||||||
// Start the unpacking process
|
// Start the unpacking process
|
||||||
var unpackClient = new UnpackClient(download, settingDownloadPath);
|
var unpackClient = new UnpackClient(download, downloadPath);
|
||||||
|
|
||||||
if (TorrentRunner.ActiveUnpackClients.TryAdd(downloadId, unpackClient))
|
if (TorrentRunner.ActiveUnpackClients.TryAdd(downloadId, unpackClient))
|
||||||
{
|
{
|
||||||
|
|
@ -388,6 +389,18 @@ namespace RdtClient.Service.Services
|
||||||
await _torrentData.UpdateComplete(torrentId, datetime);
|
await _torrentData.UpdateComplete(torrentId, datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<String> DownloadPath(Torrent torrent)
|
||||||
|
{
|
||||||
|
var settingDownloadPath = await _settings.GetString("DownloadPath");
|
||||||
|
|
||||||
|
if (!String.IsNullOrWhiteSpace(torrent.Category))
|
||||||
|
{
|
||||||
|
settingDownloadPath = Path.Combine(settingDownloadPath, torrent.Category);
|
||||||
|
}
|
||||||
|
|
||||||
|
return settingDownloadPath;
|
||||||
|
}
|
||||||
|
|
||||||
private async Task Update(Torrent torrent, RDNET.Torrent rdTorrent)
|
private async Task Update(Torrent torrent, RDNET.Torrent rdTorrent)
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrWhiteSpace(rdTorrent.Filename))
|
if (!String.IsNullOrWhiteSpace(rdTorrent.Filename))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue