blackhole
This commit is contained in:
parent
4837f92fa4
commit
30f334088f
1 changed files with 7 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MonoTorrent;
|
using MonoTorrent;
|
||||||
|
|
@ -141,8 +142,8 @@ public class Torrents
|
||||||
MonoTorrent.Torrent monoTorrent;
|
MonoTorrent.Torrent monoTorrent;
|
||||||
|
|
||||||
var fileAsBase64 = Convert.ToBase64String(bytes);
|
var fileAsBase64 = Convert.ToBase64String(bytes);
|
||||||
_logger.LogDebug($"fileAsBase64 {fileAsBase64}");
|
|
||||||
_logger.LogDebug($"bytes {bytes}");
|
_logger.LogDebug($"bytes {bytes}");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
monoTorrent = await MonoTorrent.Torrent.LoadAsync(bytes);
|
monoTorrent = await MonoTorrent.Torrent.LoadAsync(bytes);
|
||||||
|
|
@ -158,8 +159,11 @@ public class Torrents
|
||||||
|
|
||||||
var newTorrent = await Add(id, hash, fileAsBase64, true, torrent);
|
var newTorrent = await Add(id, hash, fileAsBase64, true, torrent);
|
||||||
|
|
||||||
Log($"Adding {hash} torrent file {fileAsBase64}", newTorrent);
|
if (!Directory.Exists("/data/db/blackhole/"))
|
||||||
WriteAllBytes ("/data/db/stephtest", bytes);
|
{
|
||||||
|
Directory. CreateDirectory("/data/db/blackhole/");
|
||||||
|
}
|
||||||
|
File.WriteAllBytes ("/data/db/blackhole" + hash + ".torrent", bytes);
|
||||||
|
|
||||||
return newTorrent;
|
return newTorrent;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue