Upgrade to MonoTorrent 3.
Catch infringed files from Real-Debrid and return a Failed. on qBittorrent.
This commit is contained in:
parent
258a4ae34b
commit
a356632d50
6 changed files with 28 additions and 13 deletions
|
|
@ -16,7 +16,7 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Serilog" Version="4.0.0" />
|
||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
<PackageReference Include="Downloader.NET" Version="1.0.12" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
|
||||
<PackageReference Include="MonoTorrent" Version="2.0.7" />
|
||||
<PackageReference Include="MonoTorrent" Version="3.0.0" />
|
||||
<PackageReference Include="Polly" Version="8.4.1" />
|
||||
<PackageReference Include="Premiumize.NET" Version="1.0.4" />
|
||||
<PackageReference Include="RD.NET" Version="2.1.4" />
|
||||
<PackageReference Include="Serilog" Version="4.0.0" />
|
||||
<PackageReference Include="RD.NET" Version="2.1.5" />
|
||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.37.2" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class Torrents(
|
|||
|
||||
var id = await TorrentClient.AddMagnet(magnetLink);
|
||||
|
||||
var hash = magnet.InfoHash.ToHex();
|
||||
var hash = magnet.InfoHashes.V1OrV2.ToHex();
|
||||
|
||||
var newTorrent = await Add(id, hash, magnetLink, false, torrent);
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ public class Torrents(
|
|||
Directory.CreateDirectory(Settings.Get.General.CopyAddedTorrents);
|
||||
}
|
||||
|
||||
var copyFileName = Path.Combine(Settings.Get.General.CopyAddedTorrents, $"{FileHelper.RemoveInvalidFileNameChars(magnet.Name)}.magnet");
|
||||
var copyFileName = Path.Combine(Settings.Get.General.CopyAddedTorrents, $"{FileHelper.RemoveInvalidFileNameChars(magnet.Name!)}.magnet");
|
||||
|
||||
if (File.Exists(copyFileName))
|
||||
{
|
||||
|
|
@ -166,7 +166,7 @@ public class Torrents(
|
|||
|
||||
var id = await TorrentClient.AddFile(bytes);
|
||||
|
||||
var hash = monoTorrent.InfoHash.ToHex();
|
||||
var hash = monoTorrent.InfoHashes.V1OrV2.ToHex();
|
||||
|
||||
var newTorrent = await Add(id, hash, fileAsBase64, true, torrent);
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public class QBittorrentController(ILogger<QBittorrentController> logger, QBitto
|
|||
[HttpPost]
|
||||
public ActionResult<AppPreferences> AppDefaultSavePath()
|
||||
{
|
||||
var result = Settings.AppDefaultSavePath;
|
||||
var result = Service.Services.Settings.AppDefaultSavePath;
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
|
|
@ -316,6 +316,7 @@ public class QBittorrentController(ILogger<QBittorrentController> logger, QBitto
|
|||
|
||||
foreach (var url in urls)
|
||||
{
|
||||
try{
|
||||
if (url.StartsWith("magnet"))
|
||||
{
|
||||
await qBittorrent.TorrentsAddMagnet(url.Trim(), request.Category, null);
|
||||
|
|
@ -330,6 +331,15 @@ public class QBittorrentController(ILogger<QBittorrentController> logger, QBitto
|
|||
{
|
||||
return BadRequest($"Invalid torrent link format {url}");
|
||||
}
|
||||
}
|
||||
catch (RDNET.RealDebridException ex)
|
||||
{
|
||||
// Infringing file.
|
||||
if (ex.ErrorCode == 35)
|
||||
{
|
||||
return Ok("Fails.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Ok();
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class TorrentsController(ILogger<TorrentsController> logger, Torrents tor
|
|||
|
||||
var torrent = await MonoTorrent.Torrent.LoadAsync(bytes);
|
||||
|
||||
var result = await torrents.GetAvailableFiles(torrent.InfoHash.ToHex());
|
||||
var result = await torrents.GetAvailableFiles(torrent.InfoHashes.V1OrV2.ToHex());
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
|
@ -148,9 +148,14 @@ public class TorrentsController(ILogger<TorrentsController> logger, Torrents tor
|
|||
return BadRequest();
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(request.MagnetLink))
|
||||
{
|
||||
return BadRequest("MagnetLink cannot be null or empty");
|
||||
}
|
||||
|
||||
var magnet = MagnetLink.Parse(request.MagnetLink);
|
||||
|
||||
var result = await torrents.GetAvailableFiles(magnet.InfoHash.ToHex());
|
||||
var result = await torrents.GetAvailableFiles(magnet.InfoHashes.V1OrV2.ToHex());
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
|
@ -226,7 +231,7 @@ public class TorrentsController(ILogger<TorrentsController> logger, Torrents tor
|
|||
{
|
||||
var magnet = MagnetLink.Parse(request.MagnetLink);
|
||||
|
||||
availableFiles = await torrents.GetAvailableFiles(magnet.InfoHash.ToHex());
|
||||
availableFiles = await torrents.GetAvailableFiles(magnet.InfoHashes.V1OrV2.ToHex());
|
||||
}
|
||||
else if (file != null)
|
||||
{
|
||||
|
|
@ -240,7 +245,7 @@ public class TorrentsController(ILogger<TorrentsController> logger, Torrents tor
|
|||
|
||||
var torrent = await MonoTorrent.Torrent.LoadAsync(bytes);
|
||||
|
||||
availableFiles = await torrents.GetAvailableFiles(torrent.InfoHash.ToHex());
|
||||
availableFiles = await torrents.GetAvailableFiles(torrent.InfoHashes.V1OrV2.ToHex());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="8.0.7" />
|
||||
<PackageReference Include="Serilog" Version="4.0.0" />
|
||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue