mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-01-06 15:53:41 +01:00
Support categories with Transmission
This commit is contained in:
parent
d153746a98
commit
efd5e92ca5
2 changed files with 12 additions and 6 deletions
|
|
@ -38,6 +38,6 @@ protected override ValidationFailure ValidateVersion()
|
|||
}
|
||||
|
||||
public override string Name => "Transmission";
|
||||
public override bool SupportsCategories => false;
|
||||
public override bool SupportsCategories => true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@ public TransmissionBase(ITransmissionProxy proxy,
|
|||
|
||||
protected override string AddFromMagnetLink(TorrentInfo release, string hash, string magnetLink)
|
||||
{
|
||||
_proxy.AddTorrentFromUrl(magnetLink, GetDownloadDirectory(), Settings);
|
||||
var category = GetCategoryForRelease(release) ?? Settings.Category;
|
||||
var downloadDirectory = GetDownloadDirectory(category);
|
||||
|
||||
_proxy.AddTorrentFromUrl(magnetLink, downloadDirectory, Settings);
|
||||
_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
|
||||
|
||||
if (Settings.Priority == (int)TransmissionPriority.First)
|
||||
|
|
@ -41,7 +44,10 @@ protected override string AddFromMagnetLink(TorrentInfo release, string hash, st
|
|||
|
||||
protected override string AddFromTorrentFile(TorrentInfo release, string hash, string filename, byte[] fileContent)
|
||||
{
|
||||
_proxy.AddTorrentFromData(fileContent, GetDownloadDirectory(), Settings);
|
||||
var category = GetCategoryForRelease(release) ?? Settings.Category;
|
||||
var downloadDirectory = GetDownloadDirectory(category);
|
||||
|
||||
_proxy.AddTorrentFromData(fileContent, downloadDirectory, Settings);
|
||||
_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
|
||||
|
||||
if (Settings.Priority == (int)TransmissionPriority.First)
|
||||
|
|
@ -73,14 +79,14 @@ protected virtual OsPath GetOutputPath(OsPath outputPath, TransmissionTorrent to
|
|||
return outputPath + torrent.Name.Replace(":", "_");
|
||||
}
|
||||
|
||||
protected string GetDownloadDirectory()
|
||||
protected string GetDownloadDirectory(string category)
|
||||
{
|
||||
if (Settings.Directory.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
return Settings.Directory;
|
||||
}
|
||||
|
||||
if (!Settings.Category.IsNotNullOrWhiteSpace())
|
||||
if (category.IsNullOrWhiteSpace())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
@ -88,7 +94,7 @@ protected string GetDownloadDirectory()
|
|||
var config = _proxy.GetConfig(Settings);
|
||||
var destDir = config.DownloadDir;
|
||||
|
||||
return $"{destDir.TrimEnd('/')}/{Settings.Category}";
|
||||
return $"{destDir.TrimEnd('/')}/{category}";
|
||||
}
|
||||
|
||||
protected ValidationFailure TestConnection()
|
||||
|
|
|
|||
Loading…
Reference in a new issue