Fixed bug with auto adding of AllDebrid torrents.

This commit is contained in:
Roger Far 2022-01-02 15:35:49 -07:00
parent 5de11cea6e
commit 2dd5810320
7 changed files with 54 additions and 28 deletions

View file

@ -4,6 +4,12 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.3] - 2022-01-02
### Changed
- Fixed automatic adding of AllDebrid torrents.
### Added
- Added update notification.
## [2.0.2] - 2021-11-24 ## [2.0.2] - 2021-11-24
### Changed ### Changed
- Fixed update timer for providers. - Fixed update timer for providers.

View file

@ -55,13 +55,13 @@
<a class="navbar-item"> Profile </a> <a class="navbar-item"> Profile </a>
<a class="navbar-item" (click)="logout()"> Logout </a> <a class="navbar-item" (click)="logout()"> Logout </a>
<hr class="navbar-divider" /> <hr class="navbar-divider" />
<div class="navbar-item">Version 2.0.2</div> <div class="navbar-item">Version 2.0.3</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</nav> </nav>
<div class="notification is-warning" *ngIf="profile.latestVersion && profile.currentVersion !== profile.latestVersion"> <div class="notification is-warning" *ngIf="profile && profile.latestVersion && profile.currentVersion !== profile.latestVersion">
Version {{ profile.latestVersion }} of RealDebrid Client was found. You are currently on version Version {{ profile.latestVersion }} of RealDebrid Client was found. You are currently on version
{{ profile.currentVersion }}. {{ profile.currentVersion }}.
</div> </div>

View file

@ -1,6 +1,6 @@
{ {
"name": "rdt-client", "name": "rdt-client",
"version": "2.0.2", "version": "2.0.3",
"description": "This is a web interface to manage your torrents on Real-Debrid.", "description": "This is a web interface to manage your torrents on Real-Debrid.",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {

View file

@ -6,9 +6,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AllDebrid.NET" Version="1.0.3" /> <PackageReference Include="AllDebrid.NET" Version="1.0.4" />
<PackageReference Include="Aria2.NET" Version="1.0.4" /> <PackageReference Include="Aria2.NET" Version="1.0.4" />
<PackageReference Include="Downloader" Version="2.3.0" /> <PackageReference Include="Downloader" Version="2.3.1" />
<PackageReference Include="MonoTorrent" Version="2.0.3" /> <PackageReference Include="MonoTorrent" Version="2.0.3" />
<PackageReference Include="RD.NET" Version="2.1.0" /> <PackageReference Include="RD.NET" Version="2.1.0" />
<PackageReference Include="Serilog" Version="2.10.0" /> <PackageReference Include="Serilog" Version="2.10.0" />

View file

@ -6,10 +6,12 @@ using System.Threading.Tasks;
using AllDebridNET; using AllDebridNET;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using RDNET;
using RDNET.Exceptions;
using RdtClient.Data.Enums; using RdtClient.Data.Enums;
using RdtClient.Data.Models.Data;
using RdtClient.Data.Models.TorrentClient; using RdtClient.Data.Models.TorrentClient;
using RdtClient.Service.Helpers; using RdtClient.Service.Helpers;
using Torrent = RdtClient.Data.Models.Data.Torrent;
namespace RdtClient.Service.Services.TorrentClients namespace RdtClient.Service.Services.TorrentClients
{ {
@ -192,9 +194,20 @@ namespace RdtClient.Service.Services.TorrentClients
_ => TorrentStatus.Error _ => TorrentStatus.Error
}; };
} }
catch (Exception ex) catch (AllDebridException ex)
{ {
if (ex.Message == "Resource not found") if (ex.ErrorCode == "MAGNET_INVALID_ID")
{
torrent.RdStatusRaw = "deleted";
}
else
{
throw;
}
}
catch (RealDebridException ex)
{
if (ex.ErrorCode == 7)
{ {
torrent.RdStatusRaw = "deleted"; torrent.RdStatusRaw = "deleted";
} }

View file

@ -370,14 +370,14 @@ namespace RdtClient.Service.Services
RdId = rdTorrent.Id RdId = rdTorrent.Id
}; };
await _torrentClient.UpdateData(newTorrent, rdTorrent);
if (newTorrent.RdStatus == TorrentStatus.WaitingForFileSelection) if (newTorrent.RdStatus == TorrentStatus.WaitingForFileSelection)
{ {
continue; continue;
} }
await _torrentData.Add(rdTorrent.Id, rdTorrent.Hash, null, false, newTorrent); torrent = await _torrentData.Add(rdTorrent.Id, rdTorrent.Hash, null, false, newTorrent);
await UpdateTorrentClientData(torrent, rdTorrent);
} }
else else
{ {
@ -624,23 +624,30 @@ namespace RdtClient.Service.Services
private async Task UpdateTorrentClientData(Torrent torrent, TorrentClientTorrent torrentClientTorrent = null) private async Task UpdateTorrentClientData(Torrent torrent, TorrentClientTorrent torrentClientTorrent = null)
{ {
var originalTorrent = JsonSerializer.Serialize(torrent, try
new JsonSerializerOptions
{
ReferenceHandler = ReferenceHandler.IgnoreCycles
});
await _torrentClient.UpdateData(torrent, torrentClientTorrent);
var newTorrent = JsonSerializer.Serialize(torrent,
new JsonSerializerOptions
{
ReferenceHandler = ReferenceHandler.IgnoreCycles
});
if (originalTorrent != newTorrent)
{ {
await _torrentData.UpdateRdData(torrent); var originalTorrent = JsonSerializer.Serialize(torrent,
new JsonSerializerOptions
{
ReferenceHandler = ReferenceHandler.IgnoreCycles
});
await _torrentClient.UpdateData(torrent, torrentClientTorrent);
var newTorrent = JsonSerializer.Serialize(torrent,
new JsonSerializerOptions
{
ReferenceHandler = ReferenceHandler.IgnoreCycles
});
if (originalTorrent != newTorrent)
{
await _torrentData.UpdateRdData(torrent);
}
}
catch (Exception ex)
{
// ignored
} }
} }

View file

@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<UserSecretsId>94c24cba-f03f-4453-a671-3640b517c573</UserSecretsId> <UserSecretsId>94c24cba-f03f-4453-a671-3640b517c573</UserSecretsId>
<Version>2.0.2</Version> <Version>2.0.3</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>