mirror of
https://github.com/alexta69/metube.git
synced 2025-04-02 20:07:36 +03:00
parent
d437d9529b
commit
4d145ba899
2 changed files with 17 additions and 0 deletions
|
@ -172,6 +172,7 @@
|
|||
<button type="button" class="btn btn-link text-decoration-none px-0 me-4" disabled #doneClearCompleted (click)="clearCompletedDownloads()"><fa-icon [icon]="faCheckCircle"></fa-icon> Clear completed</button>
|
||||
<button type="button" class="btn btn-link text-decoration-none px-0 me-4" disabled #doneClearFailed (click)="clearFailedDownloads()"><fa-icon [icon]="faTimesCircle"></fa-icon> Clear failed</button>
|
||||
<button type="button" class="btn btn-link text-decoration-none px-0 me-4" disabled #doneRetryFailed (click)="retryFailedDownloads()"><fa-icon [icon]="faRedoAlt"></fa-icon> Retry failed</button>
|
||||
<button type="button" class="btn btn-link text-decoration-none px-0 me-4" disabled #doneDownloadSelected (click)="downloadSelectedFiles()"><fa-icon [icon]="faDownload"></fa-icon> Download Selected</button>
|
||||
</div>
|
||||
<div class="overflow-auto">
|
||||
<table class="table">
|
||||
|
|
|
@ -39,6 +39,7 @@ export class AppComponent implements AfterViewInit {
|
|||
@ViewChild('doneClearCompleted') doneClearCompleted: ElementRef;
|
||||
@ViewChild('doneClearFailed') doneClearFailed: ElementRef;
|
||||
@ViewChild('doneRetryFailed') doneRetryFailed: ElementRef;
|
||||
@ViewChild('doneDownloadSelected') doneDownloadSelected: ElementRef;
|
||||
|
||||
faTrashAlt = faTrashAlt;
|
||||
faCheckCircle = faCheckCircle;
|
||||
|
@ -186,6 +187,7 @@ export class AppComponent implements AfterViewInit {
|
|||
|
||||
doneSelectionChanged(checked: number) {
|
||||
this.doneDelSelected.nativeElement.disabled = checked == 0;
|
||||
this.doneDownloadSelected.nativeElement.disabled = checked == 0;
|
||||
}
|
||||
|
||||
setQualities() {
|
||||
|
@ -254,6 +256,20 @@ export class AppComponent implements AfterViewInit {
|
|||
});
|
||||
}
|
||||
|
||||
downloadSelectedFiles() {
|
||||
this.downloads.done.forEach((dl, key) => {
|
||||
if (dl.status === 'finished' && dl.checked) {
|
||||
const link = document.createElement('a');
|
||||
link.href = this.buildDownloadLink(dl);
|
||||
link.setAttribute('download', dl.filename);
|
||||
link.setAttribute('target', '_self');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
buildDownloadLink(download: Download) {
|
||||
let baseDir = this.downloads.configuration["PUBLIC_HOST_URL"];
|
||||
if (download.quality == 'audio' || download.filename.endsWith('.mp3')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue