diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index 12a7f91..dc5e3bb 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -172,6 +172,7 @@ +
diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index 024d287..dd7319b 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -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')) {