Skip to content

Commit

Permalink
Merge pull request #386 from vkartk/feature/add-retry-button
Browse files Browse the repository at this point in the history
[feature] Implement "Retry all failed downloads" (#327)
  • Loading branch information
alexta69 authored Jan 26, 2024
2 parents 99ffa60 + e7cfbb5 commit 0da0589
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ui/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
<button type="button" class="btn btn-link text-decoration-none px-0 me-4" disabled #doneDelSelected (click)="delSelectedDownloads('done')"><fa-icon [icon]="faTrashAlt"></fa-icon>&nbsp; Clear selected</button>
<button type="button" class="btn btn-link text-decoration-none px-0 me-4" disabled #doneClearCompleted (click)="clearCompletedDownloads()"><fa-icon [icon]="faCheckCircle"></fa-icon>&nbsp; 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>&nbsp; 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>&nbsp; Retry failed</button>
</th>
<th scope="col" >File Size</th>
<th scope="col" style="width: 2rem;"></th>
Expand Down Expand Up @@ -179,6 +180,7 @@
</td>
<td>
<span *ngIf="download.value.size">{{ download.value.size | fileSize }}</span>
</td>
<td>
<button *ngIf="download.value.status == 'error'" type="button" class="btn btn-link" (click)="retryDownload(download.key, download.value)"><fa-icon [icon]="faRedoAlt"></fa-icon></button>
</td>
Expand Down
11 changes: 11 additions & 0 deletions ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export class AppComponent implements AfterViewInit {
@ViewChild('doneDelSelected') doneDelSelected: ElementRef;
@ViewChild('doneClearCompleted') doneClearCompleted: ElementRef;
@ViewChild('doneClearFailed') doneClearFailed: ElementRef;
@ViewChild('doneRetryFailed') doneRetryFailed: ElementRef;


faTrashAlt = faTrashAlt;
faCheckCircle = faCheckCircle;
Expand Down Expand Up @@ -83,6 +85,7 @@ export class AppComponent implements AfterViewInit {
});
this.doneClearCompleted.nativeElement.disabled = completed === 0;
this.doneClearFailed.nativeElement.disabled = failed === 0;
this.doneRetryFailed.nativeElement.disabled = failed === 0;
});
}

Expand Down Expand Up @@ -221,6 +224,14 @@ export class AppComponent implements AfterViewInit {
this.downloads.delByFilter('done', dl => dl.status === 'error').subscribe();
}

retryFailedDownloads() {
this.downloads.done.forEach((dl, key) => {
if (dl.status === 'error') {
this.retryDownload(key, dl);
}
});
}

buildDownloadLink(download: Download) {
let baseDir = 'download/';
if (download.quality == 'audio' || download.filename.endsWith('.mp3')) {
Expand Down

0 comments on commit 0da0589

Please sign in to comment.