Fix empty torrents (#11)
* fixed unwanted deletion of torrents in downloading metadata state * refactored jobs code * updated arr test data * updated gitignore * updated test configuration and removed dispensable files
This commit is contained in:
@@ -49,7 +49,8 @@ public sealed class DelugeService : IDownloadService
|
||||
_logger.LogDebug(exception, "failed to find torrent {hash} in the download client", hash);
|
||||
}
|
||||
|
||||
if (contents is null)
|
||||
// if no files found, torrent might be stuck in Downloading metadata
|
||||
if (contents?.Contents?.Count is null or 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,18 +53,14 @@ public sealed class QBitService : IDownloadService
|
||||
|
||||
IReadOnlyList<TorrentContent>? files = await _client.GetTorrentContentsAsync(hash);
|
||||
|
||||
if (files is null)
|
||||
// if no files found, torrent might be stuck in Downloading metadata
|
||||
if (files?.Count is null or 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if all files are marked as skip
|
||||
if (files.All(x => x.Priority is TorrentContentPriority.Skip))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
// if all files are marked as skip
|
||||
return files.All(x => x.Priority is TorrentContentPriority.Skip);
|
||||
}
|
||||
|
||||
public async Task BlockUnwantedFilesAsync(string hash)
|
||||
|
||||
@@ -41,7 +41,8 @@ public sealed class TransmissionService : IDownloadService
|
||||
{
|
||||
TorrentInfo? torrent = await GetTorrentAsync(hash);
|
||||
|
||||
if (torrent is null)
|
||||
// if no files found, torrent might be stuck in Downloading metadata
|
||||
if (torrent?.FileStats?.Length is null or 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user