Fixed bug where original filename wasn't handled properly.

This commit is contained in:
Roger Far 2021-06-05 10:50:56 -06:00
parent fe3b7d8867
commit 5bdf224e1b

View file

@ -101,9 +101,7 @@ namespace RdtClient.Service.Services
if (torrent != null)
{
var rdTorrent = await GetRdNetClient().GetTorrentInfoAsync(torrent.RdId);
await Update(torrent, rdTorrent);
await Update(torrent);
}
return torrent;
@ -115,9 +113,7 @@ namespace RdtClient.Service.Services
if (torrent != null)
{
var rdTorrent = await GetRdNetClient().GetTorrentInfoAsync(torrent.RdId);
await Update(torrent, rdTorrent);
await Update(torrent);
}
return torrent;
@ -336,9 +332,7 @@ namespace RdtClient.Service.Services
var newTorrent = await _torrentData.Add(rdTorrentId, infoHash, category, autoDelete, fileOrMagnetContents, isFile);
var rdTorrent = await GetRdNetClient().GetTorrentInfoAsync(rdTorrentId);
await Update(newTorrent, rdTorrent);
await Update(newTorrent);
}
finally
{
@ -369,15 +363,8 @@ namespace RdtClient.Service.Services
{
continue;
}
if (rdTorrent.Files == null)
{
var rdTorrentInfo = await GetRdNetClient().GetTorrentInfoAsync(rdTorrent.Id);
await Update(torrent, rdTorrentInfo);
}
else
{
await Update(torrent, rdTorrent);
}
await Update(torrent);
}
foreach (var torrent in torrents)
@ -451,13 +438,20 @@ namespace RdtClient.Service.Services
return settingDownloadPath;
}
private async Task Update(Torrent torrent, RDNET.Torrent rdTorrent)
private async Task Update(Torrent torrent)
{
var rdTorrent = await GetRdNetClient().GetTorrentInfoAsync(torrent.RdId);
if (!String.IsNullOrWhiteSpace(rdTorrent.Filename))
{
torrent.RdName = rdTorrent.Filename;
}
if (!String.IsNullOrWhiteSpace(rdTorrent.OriginalFilename))
{
torrent.RdName = rdTorrent.Filename;
}
if (rdTorrent.Bytes > 0)
{
torrent.RdSize = rdTorrent.Bytes;