Ignore the "Only download available files on debrid provider" for real-debrid and disable the instant availability completely for Real Debrid.
This commit is contained in:
parent
d932089b90
commit
116ca29131
3 changed files with 10 additions and 97 deletions
|
|
@ -71,24 +71,6 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<label class="label">Post Torrent Download Action</label>
|
|
||||||
<div class="control select is-fullwidth">
|
|
||||||
<select
|
|
||||||
[(ngModel)]="downloadAction"
|
|
||||||
[disabled]="provider === 'AllDebrid' || provider === 'Premiumize' || provider === 'TorBox'"
|
|
||||||
>
|
|
||||||
<option [ngValue]="0">Download all files</option>
|
|
||||||
<option [ngValue]="1">Download all available files</option>
|
|
||||||
<option [ngValue]="2">Manually pick files</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<p class="help">When a torrent is fully downloaded on the provider, perform this action.</p>
|
|
||||||
<p class="help" *ngIf="provider === 'AllDebrid'">
|
|
||||||
This option is only available for RealDebrid. AllDebrid, Premiumize, and Torbox will always download the full torrent.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="notification is-success is-light"
|
class="notification is-success is-light"
|
||||||
*ngIf="provider === 'AllDebrid' && availableFiles && availableFiles.length > 0"
|
*ngIf="provider === 'AllDebrid' && availableFiles && availableFiles.length > 0"
|
||||||
|
|
@ -223,39 +205,6 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex *ngIf="provider === 'RealDebrid'">
|
|
||||||
<div class="field">
|
|
||||||
<label class="label">Available files</label>
|
|
||||||
<p class="help">
|
|
||||||
These files are available for immediate download from your debrid provider. <br />
|
|
||||||
It is possible that there are more files in the torrent, which are not shown here.<br />
|
|
||||||
</p>
|
|
||||||
<div class="scroll-container">
|
|
||||||
<div class="field" *ngIf="downloadAction === 2">
|
|
||||||
<label class="checkbox is-fullwidth-label">
|
|
||||||
<input type="checkbox" [checked]="allSelected" (change)="downloadFileCheckedAll()" />
|
|
||||||
Select all
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="field" *ngIf="downloadAction === 2 && availableFiles !== null">
|
|
||||||
<label class="checkbox is-fullwidth-label" *ngFor="let file of availableFiles">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
[checked]="downloadFiles[file.filename]"
|
|
||||||
(change)="downloadFileChecked(file.filename)"
|
|
||||||
/>
|
|
||||||
{{ file.filename }} ({{ file.filesize | filesize }})
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="field" *ngIf="downloadAction !== 2 && availableFiles !== null">
|
|
||||||
<label class="is-fullwidth-label is-block" *ngFor="let file of availableFiles">
|
|
||||||
<span [ngClass]="{ 'strike-through': isRegexExcluded(file) }">{{ file.filename }}</span>
|
|
||||||
<span *ngIf="file.filesize > 0">({{ file.filesize | filesize }})</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,7 @@ public class PremiumizeTorrentClient(ILogger<PremiumizeTorrentClient> logger, IH
|
||||||
|
|
||||||
public Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
|
public Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
|
||||||
{
|
{
|
||||||
var result = new List<TorrentClientAvailableFile>();
|
return Task.FromResult<IList<TorrentClientAvailableFile>>([]);
|
||||||
return Task.FromResult<IList<TorrentClientAvailableFile>>(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task SelectFiles(Torrent torrent)
|
public Task SelectFiles(Torrent torrent)
|
||||||
|
|
|
||||||
|
|
@ -137,62 +137,27 @@ public class RealDebridTorrentClient(ILogger<RealDebridTorrentClient> logger, IH
|
||||||
return result.Id;
|
return result.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
|
public Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
|
||||||
{
|
{
|
||||||
try
|
return Task.FromResult<IList<TorrentClientAvailableFile>>([]);
|
||||||
{
|
|
||||||
var result = await GetClient().Torrents.GetAvailableFiles(hash);
|
|
||||||
|
|
||||||
var files = result.SelectMany(m => m.Value).SelectMany(m => m.Value).SelectMany(m => m.Values);
|
|
||||||
|
|
||||||
var groups = files.Where(m => m.Filename != null).GroupBy(m => $"{m.Filename}-{m.Filesize}");
|
|
||||||
|
|
||||||
var torrentClientAvailableFiles = groups.Select(m => new TorrentClientAvailableFile
|
|
||||||
{
|
|
||||||
Filename = m.First().Filename!,
|
|
||||||
Filesize = m.First().Filesize
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return torrentClientAvailableFiles;
|
|
||||||
}
|
|
||||||
catch (RealDebridException exception)
|
|
||||||
{
|
|
||||||
if (exception.ErrorCode == 36)
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SelectFiles(Data.Models.Data.Torrent torrent)
|
public async Task SelectFiles(Data.Models.Data.Torrent torrent)
|
||||||
{
|
{
|
||||||
var files = torrent.Files;
|
IList<TorrentClientFile> files;
|
||||||
|
|
||||||
Log("Seleting files", torrent);
|
Log("Seleting files", torrent);
|
||||||
|
|
||||||
if (torrent.DownloadAction == TorrentDownloadAction.DownloadAvailableFiles)
|
if (torrent.DownloadAction == TorrentDownloadAction.DownloadManual)
|
||||||
{
|
|
||||||
Log($"Determining which files are already available on RealDebrid", torrent);
|
|
||||||
|
|
||||||
var availableFiles = await GetAvailableFiles(torrent.Hash);
|
|
||||||
|
|
||||||
Log($"Found {files.Count}/{torrent.Files.Count} available files on RealDebrid", torrent);
|
|
||||||
|
|
||||||
files = torrent.Files.Where(m => availableFiles.Any(f => m.Path.EndsWith(f.Filename))).ToList();
|
|
||||||
}
|
|
||||||
else if (torrent.DownloadAction == TorrentDownloadAction.DownloadAll)
|
|
||||||
{
|
|
||||||
Log("Selecting all files", torrent);
|
|
||||||
files = [.. torrent.Files];
|
|
||||||
}
|
|
||||||
else if (torrent.DownloadAction == TorrentDownloadAction.DownloadManual)
|
|
||||||
{
|
{
|
||||||
Log("Selecting manual selected files", torrent);
|
Log("Selecting manual selected files", torrent);
|
||||||
files = torrent.Files.Where(m => torrent.ManualFiles.Any(f => m.Path.EndsWith(f))).ToList();
|
files = torrent.Files.Where(m => torrent.ManualFiles.Any(f => m.Path.EndsWith(f))).ToList();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log("Selecting all files", torrent);
|
||||||
|
files = [.. torrent.Files];
|
||||||
|
}
|
||||||
|
|
||||||
Log($"Selecting {files.Count}/{torrent.Files.Count} files", torrent);
|
Log($"Selecting {files.Count}/{torrent.Files.Count} files", torrent);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue