diff --git a/CHANGELOG.md b/CHANGELOG.md index b5dad9f..97a0ceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.9.5] - 2021-10-28 +### Changed +- Fixed issues with the simple downloader. +- Fixed issue with retrying downloads. + +### Added +- Added torrent uploading status from Real Debrid. +- Restored removing of torrents when deleted from Real Debrid. + ## [1.9.4] - 2021-10-28 ### Changed - Fixed issues retrying torrents after multiple failed downloads in large torrents. diff --git a/client/src/app/add-new-torrent/add-new-torrent.component.html b/client/src/app/add-new-torrent/add-new-torrent.component.html index 99f539a..8fa2e4d 100644 --- a/client/src/app/add-new-torrent/add-new-torrent.component.html +++ b/client/src/app/add-new-torrent/add-new-torrent.component.html @@ -52,7 +52,7 @@
Set the priority for this torrent where 1 is the highest. When empty it will be assigned the lowest priority. diff --git a/client/src/app/models/torrent.model.ts b/client/src/app/models/torrent.model.ts index eaad6a7..52e871b 100644 --- a/client/src/app/models/torrent.model.ts +++ b/client/src/app/models/torrent.model.ts @@ -56,6 +56,7 @@ export enum RealDebridStatus { WaitingForFileSelection = 1, Downloading = 2, Finished = 3, + Uploading = 4, Error = 99, } diff --git a/client/src/app/navbar/navbar.component.html b/client/src/app/navbar/navbar.component.html index a4e9317..01e6bff 100644 --- a/client/src/app/navbar/navbar.component.html +++ b/client/src/app/navbar/navbar.component.html @@ -55,7 +55,7 @@ Profile Logout
Maximum amount of downloads that get unpacked on your host at the same time.
Maximum amount of torrents that get downloaded to your host at the same time.
Maximum amount of parallel threads that are used to download a single torrent to your host. If set to 1 no @@ -117,7 +117,7 @@
Maximum download speed in Megabytes per second. When set to 0 unlimited speed is used.
Set the priority for this torrent where 1 is the highest. When empty it will be assigned the lowest priority.
diff --git a/package.json b/package.json
index d373624..83a7909 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "rdt-client",
- "version": "1.9.4",
+ "version": "1.9.5",
"description": "This is a web interface to manage your torrents on Real-Debrid.",
"main": "index.js",
"dependencies": {
diff --git a/server/RdtClient.Data/Data/SettingData.cs b/server/RdtClient.Data/Data/SettingData.cs
index f710e98..9e51b6d 100644
--- a/server/RdtClient.Data/Data/SettingData.cs
+++ b/server/RdtClient.Data/Data/SettingData.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using RdtClient.Data.Models.Data;
using RdtClient.Data.Models.Internal;
+using Serilog;
namespace RdtClient.Data.Data
{
@@ -26,8 +27,24 @@ namespace RdtClient.Data.Data
{
var allSettings = await _dataContext.Settings.AsNoTracking().ToListAsync();
- String GetString(String name) => allSettings.FirstOrDefault(m => m.SettingId == name)?.Value;
- Int32 GetInt32(String name) => Int32.Parse(allSettings.FirstOrDefault(m => m.SettingId == name)?.Value ?? "0");
+ String GetString(String name)
+ {
+ return allSettings.FirstOrDefault(m => m.SettingId == name)?.Value;
+ }
+
+ Int32 GetInt32(String name)
+ {
+ var strVal = GetString(name);
+
+ if (!Int32.TryParse(strVal, out var intVal))
+ {
+ Log.Error("Unable to parse setting {name} to Int32", name);
+ return 0;
+ }
+
+ return intVal;
+
+ }
Get = new DbSettings
{
diff --git a/server/RdtClient.Data/Enums/TorrentStatus.cs b/server/RdtClient.Data/Enums/TorrentStatus.cs
index 1471da2..3ef4341 100644
--- a/server/RdtClient.Data/Enums/TorrentStatus.cs
+++ b/server/RdtClient.Data/Enums/TorrentStatus.cs
@@ -6,6 +6,7 @@
WaitingForFileSelection = 1,
Downloading = 2,
Finished = 3,
+ Uploading = 4,
Error = 99
}
diff --git a/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs
new file mode 100644
index 0000000..6c13a32
--- /dev/null
+++ b/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs
@@ -0,0 +1,155 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Threading.Tasks;
+using RDNET;
+using RdtClient.Service.Models.TorrentClient;
+
+namespace RdtClient.Service.Services.TorrentClients
+{
+ public class AllDebridTorrentClient : ITorrentClient
+ {
+ private readonly IHttpClientFactory _httpClientFactory;
+
+ public AllDebridTorrentClient(IHttpClientFactory httpClientFactory)
+ {
+ _httpClientFactory = httpClientFactory;
+ }
+
+ private RdNetClient GetRdNetClient()
+ {
+ var apiKey = Settings.Get.RealDebridApiKey;
+
+ if (String.IsNullOrWhiteSpace(apiKey))
+ {
+ throw new Exception("Real-Debrid API Key not set in the settings");
+ }
+
+ var httpClient = _httpClientFactory.CreateClient();
+ httpClient.Timeout = TimeSpan.FromSeconds(10);
+
+ var rdtNetClient = new RdNetClient(null, httpClient, 5);
+ rdtNetClient.UseApiAuthentication(apiKey);
+
+ return rdtNetClient;
+ }
+
+ private static TorrentClientTorrent Map(Torrent torrent)
+ {
+ return new TorrentClientTorrent
+ {
+ Id = torrent.Id,
+ Filename = torrent.Filename,
+ OriginalFilename = torrent.OriginalFilename,
+ Hash = torrent.Hash,
+ Bytes = torrent.Bytes,
+ OriginalBytes = torrent.OriginalBytes,
+ Host = torrent.Host,
+ Split = torrent.Split,
+ Progress = torrent.Progress,
+ Status = torrent.Status,
+ Added = torrent.Added,
+ Files = (torrent.Files ?? new List> GetAvailableFiles(String hash)
+ {
+ var result = await GetRdNetClient().Torrents.GetAvailableFiles(hash);
+
+ var files = result.SelectMany(m => m.Value).SelectMany(m => m.Value).SelectMany(m => m.Values);
+
+ var groups = files.GroupBy(m => $"{m.Filename}-{m.Filesize}");
+
+ var torrentClientAvailableFiles = groups.Select(m => new TorrentClientAvailableFile
+ {
+ Filename = m.First().Filename,
+ Filesize = m.First().Filesize
+ } ).ToList();
+
+ return torrentClientAvailableFiles;
+ }
+
+ public async Task SelectFiles(String torrentId, IList