Release fixes

This commit is contained in:
Roger Far 2021-01-13 11:16:39 -07:00
parent 0a8793e4f9
commit 337ecdecd8
4 changed files with 58 additions and 56 deletions

View file

@ -63,7 +63,7 @@ namespace RdtClient.Data.Data
#if DEBUG #if DEBUG
Value = @"C:\Temp\rdtclient" Value = @"C:\Temp\rdtclient"
#else #else
Value = "D:\Downloads" Value = @"C:\Downloads"
#endif #endif
}, },
new Setting new Setting

View file

@ -113,7 +113,7 @@ namespace RdtClient.Service.Services
while (fileStream.Length < response.ContentLength) while (fileStream.Length < response.ContentLength)
{ {
var read = await stream.ReadAsync(buffer, 0, buffer.Length); var read = await stream.ReadAsync(buffer.AsMemory(0, buffer.Length));
if (read > 0) if (read > 0)
{ {

View file

@ -235,56 +235,57 @@ namespace RdtClient.Service.Services
{ {
var downloadPath = savePath; var downloadPath = savePath;
if (!String.IsNullOrWhiteSpace(torrent?.Category)) if (!String.IsNullOrWhiteSpace(torrent.Category))
{ {
downloadPath = Path.Combine(downloadPath, torrent.Category); downloadPath = Path.Combine(downloadPath, torrent.Category);
} }
var result = new TorrentInfo(); var result = new TorrentInfo
result.AddedOn = torrent.RdAdded.ToUnixTimeSeconds(); {
result.AmountLeft = (Int64) (torrent.RdSize * (100.0 - torrent.RdProgress) / 100.0); AddedOn = torrent.RdAdded.ToUnixTimeSeconds(),
result.AutoTmm = false; AmountLeft = (Int64) (torrent.RdSize * (100.0 - torrent.RdProgress) / 100.0),
result.Availability = 2; AutoTmm = false,
result.Category = torrent.Category ?? ""; Availability = 2,
result.Completed = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)); Category = torrent.Category ?? "",
result.CompletionOn = torrent.RdEnded?.ToUnixTimeSeconds(); Completed = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)),
result.DlLimit = -1; CompletionOn = torrent.RdEnded?.ToUnixTimeSeconds(),
result.Dlspeed = torrent.RdSpeed ?? 0; DlLimit = -1,
result.Downloaded = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)); Dlspeed = torrent.RdSpeed ?? 0,
result.DownloadedSession = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)); Downloaded = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)),
result.Eta = 0; DownloadedSession = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)),
result.FlPiecePrio = false; Eta = 0,
result.ForceStart = false; FlPiecePrio = false,
result.Hash = torrent.Hash; ForceStart = false,
result.LastActivity = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); Hash = torrent.Hash,
result.MagnetUri = ""; LastActivity = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
result.MaxRatio = -1; MagnetUri = "",
result.MaxSeedingTime = -1; MaxRatio = -1,
result.Name = torrent.RdName; MaxSeedingTime = -1,
result.NumComplete = 10; Name = torrent.RdName,
result.NumIncomplete = 0; NumComplete = 10,
result.NumLeechs = 100; NumIncomplete = 0,
result.NumSeeds = 100; NumLeechs = 100,
result.Priority = ++prio; NumSeeds = 100,
result.Progress = (Int64) (torrent.RdProgress / 100.0); Priority = ++prio,
result.Ratio = 1; Progress = (Int64) (torrent.RdProgress / 100.0),
result.RatioLimit = 1; Ratio = 1,
result.ContentPath = downloadPath; RatioLimit = 1,
result.SavePath = downloadPath; ContentPath = downloadPath,
result.SeedingTimeLimit = 1; SavePath = downloadPath,
result.SeenComplete = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); SeedingTimeLimit = 1,
result.SeqDl = false; SeenComplete = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
result.Size = torrent.RdSize; SeqDl = false,
result.SuperSeeding = false; Size = torrent.RdSize,
result.Tags = ""; SuperSeeding = false,
result.TimeActive = (Int64) (torrent.RdAdded - DateTimeOffset.UtcNow).TotalMinutes; Tags = "",
result.TotalSize = torrent.RdSize; TimeActive = (Int64) (torrent.RdAdded - DateTimeOffset.UtcNow).TotalMinutes,
result.Tracker = "udp://tracker.opentrackr.org:1337"; TotalSize = torrent.RdSize,
result.UpLimit = -1; Tracker = "udp://tracker.opentrackr.org:1337",
result.Uploaded = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)); UpLimit = -1,
result.UploadedSession = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)); Uploaded = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)),
result.Upspeed = torrent.RdSpeed ?? 0; UploadedSession = (Int64) (torrent.RdSize * (torrent.RdProgress / 100.0)),
result.State = torrent.RdStatus switch Upspeed = torrent.RdSpeed ?? 0,
State = torrent.RdStatus switch
{ {
RealDebridStatus.Processing => "downloading", RealDebridStatus.Processing => "downloading",
RealDebridStatus.WaitingForFileSelection => "downloading", RealDebridStatus.WaitingForFileSelection => "downloading",
@ -292,6 +293,7 @@ namespace RdtClient.Service.Services
RealDebridStatus.Finished => "pausedUP", RealDebridStatus.Finished => "pausedUP",
RealDebridStatus.Error => "error", RealDebridStatus.Error => "error",
_ => throw new ArgumentOutOfRangeException() _ => throw new ArgumentOutOfRangeException()
}
}; };
results.Add(result); results.Add(result);

View file

@ -341,7 +341,7 @@ namespace RdtClient.Web.Controllers
[Route("torrents/setForcestart")] [Route("torrents/setForcestart")]
[HttpGet] [HttpGet]
[HttpPost] [HttpPost]
public ActionResult TorrentsSetForceStart([FromQuery] QBTorrentsHashRequest request) public ActionResult TorrentsSetForceStart()
{ {
return Ok(); return Ok();
} }