mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 05:47:22 -04: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 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
|||
}
|
||||
|
||||
public override string Name => "Transmission";
|
||||
public override bool SupportsCategories => false;
|
||||
public override bool SupportsCategories => true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,10 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
|||
|
||||
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 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
|||
|
||||
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 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
|||
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 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
|||
var config = _proxy.GetConfig(Settings);
|
||||
var destDir = config.DownloadDir;
|
||||
|
||||
return $"{destDir.TrimEnd('/')}/{Settings.Category}";
|
||||
return $"{destDir.TrimEnd('/')}/{category}";
|
||||
}
|
||||
|
||||
protected ValidationFailure TestConnection()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue