diff --git a/server/RdtClient.Data/Models/Internal/DbSettings.cs b/server/RdtClient.Data/Models/Internal/DbSettings.cs index 3866aa9..01bf906 100644 --- a/server/RdtClient.Data/Models/Internal/DbSettings.cs +++ b/server/RdtClient.Data/Models/Internal/DbSettings.cs @@ -47,7 +47,7 @@ public class DbSettingsGeneral public Int32 UnpackLimit { get; set; } = 1; [DisplayName("Categories")] - [Description("Expose these categories through the QBittorrent API.")] + [Description("Expose these categories through the QBittorrent API. Define multiple categories by separating them with a comma.")] public String? Categories { get; set; } = null; [DisplayName("Run external program on torrent completion")] diff --git a/server/RdtClient.Service/Services/Torrents.cs b/server/RdtClient.Service/Services/Torrents.cs index f87d14b..1188556 100644 --- a/server/RdtClient.Service/Services/Torrents.cs +++ b/server/RdtClient.Service/Services/Torrents.cs @@ -713,9 +713,18 @@ public class Torrents var downloadPath = DownloadPath(torrent); var torrentPath = Path.Combine(downloadPath, torrent.RdName ?? "Unknown"); + var filePath = torrentPath; + + var files = Directory.GetFiles(filePath); + + if (files.Length == 1) + { + filePath = Path.Combine(torrentPath, files[0]); + } + arguments = arguments.Replace("%N", $"\"{torrent.RdName}\""); arguments = arguments.Replace("%L", $"\"{torrent.Category}\""); - arguments = arguments.Replace("%F", $"\"{torrentPath}\""); + arguments = arguments.Replace("%F", $"\"{filePath}\""); arguments = arguments.Replace("%R", $"\"{downloadPath}\""); arguments = arguments.Replace("%D", $"\"{torrentPath}\""); arguments = arguments.Replace("%C", downloads.Count.ToString(CultureInfo.InvariantCulture).Replace(",", "").Replace(".", ""));