Fixed issue with AllDebrid deserialization of magnet link files.

This commit is contained in:
Roger Far 2021-11-24 07:59:45 -07:00
parent 763ce5a036
commit cdef655a00
4 changed files with 56 additions and 14 deletions

View file

@ -4,6 +4,11 @@ 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).
## [2.0.1] - 2021-11-24
### Changed
- Fixed potential issue with the Real-Debrid mapper.
- Fixed serialization issue for AllDebrid.
## [2.0.0] - 2021-11-21
### Changed
- Update projects to .NET6 and Angular 13.

View file

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

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AllDebrid.NET" Version="1.0.2" />
<PackageReference Include="AllDebrid.NET" Version="1.0.3" />
<PackageReference Include="Aria2.NET" Version="1.0.4" />
<PackageReference Include="Downloader" Version="2.3.0" />
<PackageReference Include="MonoTorrent" Version="2.0.1" />
@ -14,7 +14,7 @@
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="SharpCompress" Version="0.30.0" />
<PackageReference Include="SharpCompress" Version="0.30.1" />
</ItemGroup>
<ItemGroup>

View file

@ -238,9 +238,9 @@ namespace RdtClient.Service.Services.TorrentClients
foreach (var link in links)
{
var fileList = link.Files.SelectMany(file => GetFiles(file));
var fileList = GetFiles(link.Files, "");
Log($"{link.Filename} ({link.Size}b) {link.LinkUrl}, contains {String.Join(", ", fileList)}");
Log($"{link.Filename} ({link.Size}b) {link.LinkUrl}, contains files:{Environment.NewLine}{String.Join(Environment.NewLine, fileList)}");
}
Log("", torrent);
@ -248,18 +248,55 @@ namespace RdtClient.Service.Services.TorrentClients
return links.Select(m => m.LinkUrl.ToString()).ToList();
}
private static IList<String> GetFiles(File file, String parent = null)
private static IEnumerable<String> GetFiles(IList<File> files, String parent)
{
var result = new List<String>
{
$"{parent}/{file.Name}"
};
var result = new List<String>();
if (file.Files != null && file.Files.Count > 0)
foreach (var file in files)
{
foreach (var subFile in file.Files)
if (!String.IsNullOrWhiteSpace(file.N))
{
result.AddRange(GetFiles(subFile, file.Name));
result.Add($"{parent}/{file.N}");
}
if (file.E != null && file.E.Value.PurpleEArray != null && file.E.Value.PurpleEArray.Count > 0)
{
result.AddRange(GetFiles(file.E.Value.PurpleEArray, file.N));
}
}
return result;
}
private static IEnumerable<String> GetFiles(IList<FileE1> files, String parent)
{
var result = new List<String>();
foreach (var file in files)
{
if (!String.IsNullOrWhiteSpace(file.N))
{
result.Add($"{parent}/{file.N}");
}
if (file.E != null && file.E.Count > 0)
{
result.AddRange(GetFiles(file.E, file.N));
}
}
return result;
}
private static IEnumerable<String> GetFiles(IList<FileE2> files, String parent)
{
var result = new List<String>();
foreach (var file in files)
{
if (!String.IsNullOrWhiteSpace(file.N))
{
result.Add($"{parent}/{file.N}");
}
}