Skip to content

Commit

Permalink
Merge v2.0.92
Browse files Browse the repository at this point in the history
  • Loading branch information
MentalBlank committed Dec 20, 2024
2 parents 1739a18 + 9a2d59a commit f21b137
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A quick and dirty fix for RdName including a file type extension, such as MKV and RDT-Client using the extension in the directory path causing issues, eg. with ARR apps, unless it's removed.
- Added missing TorBox information to readme.
- Added links to every provider's API keys to readme.
- Added uploading torrents to a secondary provider.
### Changed
- Modified list sorting.
- Multiple changes to default setting values including some regex in default settings to exclude certain files from being downloaded.
Expand All @@ -27,6 +28,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- GHCR in build workflow.
- Removed some junk from changelog.

## [2.0.92] - 2024-12-18
### Changed
- Torbox fixes.

## [2.0.91] - 2024-12-11
### Changed
- Torbox fixes.
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<a class="navbar-item" routerLink="profile"> Profile </a>
<a class="navbar-item" (click)="logout()"> Logout </a>
<hr class="navbar-divider" />
<a href="https://github.com/mentalblank/rdt-client" target="_blank" class="navbar-item">Version 2.0.91</a>
<a href="https://github.com/mentalblank/rdt-client" target="_blank" class="navbar-item">Version 2.0.92</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rdt-client",
"version": "2.0.91",
"version": "2.0.92",
"description": "A web interface to manage your torrents on various debrid services.",
"main": "index.js",
"dependencies": {
Expand Down
18 changes: 18 additions & 0 deletions server/RdtClient.Data/Enums/SecondaryProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.ComponentModel;

namespace RdtClient.Data.Enums;

public enum SecondaryProvider
{
[Description("RealDebrid")]
RealDebrid,

[Description("AllDebrid")]
AllDebrid,

[Description("Premiumize")]
Premiumize,

[Description("TorBox")]
TorBox
}
48 changes: 46 additions & 2 deletions server/RdtClient.Data/Models/Internal/DbSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public class DbSettings
[DisplayName("Provider")]
[Description("")]
public DbSettingsProvider Provider { get; set; } = new();

[DisplayName("Secondary Provider")]
[Description("")]
public DbSettingsSecondaryProvider SecondaryProvider { get; set; } = new();

[DisplayName("qBittorrent / *darr")]
[Description("The following settings only apply when a torrent gets added through the qbittorrent API, usually Radarr or Sonarr.")]
Expand Down Expand Up @@ -151,8 +155,7 @@ public class DbSettingsProvider
<a href=""https://real-debrid.com/"" target=""_blank"" rel=""noopener"">https://real-debrid.com/</a>
<a href=""https://alldebrid.com/"" target=""_blank"" rel=""noopener"">https://alldebrid.com/</a>
<a href=""https://www.premiumize.me/"" target=""_blank"" rel=""noopener"">https://www.premiumize.me/</a>
<a href=""https://torbox.app/"" target=""_blank"" rel=""noopener"">https://torbox.app/</a>
At this point only 1 provider can be used at the time.")]
<a href=""https://torbox.app/"" target=""_blank"" rel=""noopener"">https://torbox.app/</a>")]
public Provider Provider { get; set; } = Provider.RealDebrid;

[DisplayName("API Key")]
Expand All @@ -165,7 +168,48 @@ public class DbSettingsProvider
or
<a href=""https://torbox.app/settings/"" target=""_blank"" rel=""noopener"">https://torbox.app/settings/</a>")]
public String ApiKey { get; set; } = "";

[DisplayName("Automatically import and process torrents added to provider")]
[Description("When selected, import downloads that are not added through DebridClient but have been directly added to your debrid provider.")]
public Boolean AutoImport { get; set; } = false;

[DisplayName("Automatically delete downloads removed from provider")]
[Description("When selected, cancel and delete downloads that have been removed from your debrid provider.")]
public Boolean AutoDelete { get; set; } = false;

[DisplayName("Connection Timeout")]
[Description("Timeout in seconds to make a connection to the provider. Increase if you experience timeouts in the logs.")]
public Int32 Timeout { get; set; } = 10;

[DisplayName("Check Interval")]
[Description("The interval to check the torrents info on the providers API. Minumum is 3 seconds. When there are no active downloads this limit is increased * 3.")]
public Int32 CheckInterval { get; set; } = 10;

[DisplayName("Auto Import Defaults")]
public DbSettingsDefaultsWithCategory Default { get; set; } = new();
}

public class DbSettingsSecondaryProvider
{
[DisplayName("Secondary Provider")]
[Description(@"The following 4 providers are supported:
<a href=""https://real-debrid.com/"" target=""_blank"" rel=""noopener"">https://real-debrid.com/</a>
<a href=""https://alldebrid.com/"" target=""_blank"" rel=""noopener"">https://alldebrid.com/</a>
<a href=""https://www.premiumize.me/"" target=""_blank"" rel=""noopener"">https://www.premiumize.me/</a>
<a href=""https://torbox.app/"" target=""_blank"" rel=""noopener"">https://torbox.app/</a>")]
public SecondaryProvider SecondaryProvider { get; set; } = SecondaryProvider.TorBox;

[DisplayName("Secondary API Key")]
[Description(@"You can find your API key here:
<a href=""https://real-debrid.com/apitoken"" target=""_blank"" rel=""noopener"">https://real-debrid.com/apitoken</a>
or
<a href=""https://alldebrid.com/apikeys/"" target=""_blank"" rel=""noopener"">https://alldebrid.com/apikeys/</a>
or
<a href=""https://www.premiumize.me/account/"" target=""_blank"" rel=""noopener"">https://www.premiumize.me/account/</a>
or
<a href=""https://torbox.app/settings/"" target=""_blank"" rel=""noopener"">https://torbox.app/settings/</a>")]
public String SecondaryApiKey { get; set; } = "";

[DisplayName("Automatically import and process torrents added to provider")]
[Description("When selected, import downloads that are not added through DebridClient but have been directly added to your debrid provider.")]
public Boolean AutoImport { get; set; } = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ private AllDebridNETClient GetClient()
try
{
var apiKey = Settings.Get.Provider.ApiKey;

if (Settings.Get.SecondaryProvider.SecondaryProvider == SecondaryProvider.AllDebrid)
{
apiKey = Settings.Get.SecondaryProvider.SecondaryApiKey;
}
else
{
throw new InvalidOperationException("All-Debrid is not set as a provider.");
}

if (String.IsNullOrWhiteSpace(apiKey))
{
throw new("All-Debrid API Key not set in the settings");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ private PremiumizeNETClient GetClient()
try
{
var apiKey = Settings.Get.Provider.ApiKey;

if (Settings.Get.SecondaryProvider.SecondaryProvider == SecondaryProvider.Premiumize)
{
apiKey = Settings.Get.SecondaryProvider.SecondaryApiKey;
}
else
{
throw new InvalidOperationException("Premiumize is not set as a provider.");
}

if (String.IsNullOrWhiteSpace(apiKey))
{
throw new("Premiumize API Key not set in the settings");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ private RdNetClient GetClient()
try
{
var apiKey = Settings.Get.Provider.ApiKey;

if (Settings.Get.SecondaryProvider.SecondaryProvider == SecondaryProvider.RealDebrid)
{
apiKey = Settings.Get.SecondaryProvider.SecondaryApiKey;
}
else
{
throw new InvalidOperationException("Real-Debrid is not set as a provider.");
}

if (String.IsNullOrWhiteSpace(apiKey))
{
throw new("Real-Debrid API Key not set in the settings");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ private TorBoxNetClient GetClient()
try
{
var apiKey = Settings.Get.Provider.ApiKey;

if (Settings.Get.SecondaryProvider.SecondaryProvider == SecondaryProvider.TorBox)
{
apiKey = Settings.Get.SecondaryProvider.SecondaryApiKey;
}
else
{
throw new InvalidOperationException("TorBox is not set as a provider.");
}

if (String.IsNullOrWhiteSpace(apiKey))
{
throw new("TorBox API Key not set in the settings");
Expand Down Expand Up @@ -74,7 +82,7 @@ private TorrentClientTorrent Map(TorrentInfoResult torrent)
Progress = (Int64)(torrent.Progress * 100.0),
Status = torrent.DownloadState,
Added = ChangeTimeZone(torrent.CreatedAt)!.Value,
Files = (torrent.Files).Select(m => new TorrentClientFile
Files = (torrent.Files ?? []).Select(m => new TorrentClientFile
{
Path = String.Join("/", m.Name.Split('/').Skip(1)),
Bytes = m.Size,
Expand Down
29 changes: 29 additions & 0 deletions server/RdtClient.Service/Services/Torrents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ private ITorrentClient TorrentClient
};
}
}

private ITorrentClient SecondaryTorrentClient
{
get
{
return Settings.Get.SecondaryProvider.SecondaryProvider switch
{
SecondaryProvider.Premiumize => premiumizeTorrentClient,
SecondaryProvider.RealDebrid => realDebridTorrentClient,
SecondaryProvider.AllDebrid => allDebridTorrentClient,
SecondaryProvider.TorBox => torBoxTorrentClient,
_ => throw new("Invalid Secondary Provider")
};
}
}

private static readonly SemaphoreSlim TorrentResetLock = new(1, 1);

Expand Down Expand Up @@ -147,6 +162,13 @@ public async Task<Torrent> UploadMagnet(String magnetLink, Torrent torrent)
}
}

if (!String.IsNullOrWhiteSpace(Settings.Get.SecondaryProvider.SecondaryApiKey))
{
// Add to secondary provider
var secondaryID = await SecondaryTorrentClient.AddMagnet(magnetLink);
Log($"Magnet link also added to secondary provider with ID {secondaryID}", torrent);
}

return newTorrent;
}

Expand Down Expand Up @@ -198,6 +220,13 @@ public async Task<Torrent> UploadFile(Byte[] bytes, Torrent torrent)
}
}

if (!String.IsNullOrWhiteSpace(Settings.Get.SecondaryProvider.SecondaryApiKey))
{
// Add to secondary provider
var secondaryID = await SecondaryTorrentClient.AddFile(bytes);
Log($"Magnet link also added to secondary provider with ID {secondaryID}", torrent);
}

return newTorrent;
}

Expand Down
2 changes: 1 addition & 1 deletion server/RdtClient.Web/RdtClient.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
<UserSecretsId>94c24cba-f03f-4453-a671-3640b517c573</UserSecretsId>
<Version>2.0.91</Version>
<Version>2.0.92</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
Expand Down

0 comments on commit f21b137

Please sign in to comment.