Fix TorBox GetAvailability
Won't display anything in the UI though as its set to only show available files for RD
This commit is contained in:
parent
754588091d
commit
183798db2d
2 changed files with 26 additions and 6 deletions
|
|
@ -22,7 +22,7 @@
|
|||
<PackageReference Include="Serilog" Version="4.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.37.2" />
|
||||
<PackageReference Include="TorBox.NET" Version="1.0.0.20" />
|
||||
<PackageReference Include="TorBox.NET" Version="1.0.0.23" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -135,10 +135,30 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
return result.Data?.Hash?.ToString()!;
|
||||
}
|
||||
|
||||
public Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
|
||||
public async Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
|
||||
{
|
||||
var result = new List<TorrentClientAvailableFile>();
|
||||
return Task.FromResult<IList<TorrentClientAvailableFile>>(result);
|
||||
var availability = await GetClient().Torrents.GetAvailabilityAsync(hash, listFiles: true);
|
||||
|
||||
if (availability.Data != null)
|
||||
{
|
||||
var availableFiles = new List<TorrentClientAvailableFile>();
|
||||
foreach (var file in availability.Data[0]?.Files!)
|
||||
{
|
||||
availableFiles.Add(
|
||||
new TorrentClientAvailableFile
|
||||
{
|
||||
Filename = file!.Name,
|
||||
Filesize = file.Size
|
||||
});
|
||||
}
|
||||
return availableFiles;
|
||||
}
|
||||
else
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Task SelectFiles(Data.Models.Data.Torrent torrent)
|
||||
|
|
@ -213,7 +233,7 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
if (rdTorrent.Host == "True")
|
||||
{
|
||||
torrent.RdStatus = TorrentStatus.Finished;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
torrent.RdStatus = rdTorrent.Status switch
|
||||
|
|
@ -233,7 +253,7 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
_ => TorrentStatus.Error
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue