Added download manager to home page if autoplay is disabled

Fixed bug where the UI attempted to generate a preview URL for placeholder file cards

Fixed bug where file renaming was always attempted even when not necessary
This commit is contained in:
Isaac Abadi
2021-09-13 22:42:37 -06:00
parent acad7cc057
commit 3241d6aaaf
7 changed files with 33 additions and 16 deletions

View File

@@ -170,7 +170,7 @@
</form>
</div>
<br/>
<div class="centered big" id="bar_div" *ngIf="current_download; else nofile">
<div class="centered big" id="bar_div" *ngIf="current_download && autoplay">
<div class="margined">
<div [ngClass]="(+percentDownloaded > 99)?'make-room-for-spinner':'equal-sizes'" style="display: inline-block; width: 100%; padding-left: 20px" *ngIf="current_download.percent_complete && current_download.percent_complete > 1;else indeterminateprogress">
<mat-progress-bar style="border-radius: 5px;" mode="determinate" value="{{percentDownloaded}}"></mat-progress-bar>
@@ -185,9 +185,10 @@
</div>
<br/>
</div>
<ng-template #nofile>
</ng-template>
<div style="display: flex; justify-content: center;" *ngIf="downloads && downloads.length > 0 && !autoplay">
<app-downloads style="width: 80%; margin-bottom: 10px" [uids]="download_uids"></app-downloads>
</div>
<ng-container *ngIf="cachedFileManagerEnabled || fileManagerEnabled">
<app-recent-videos #recentVideos></app-recent-videos>

View File

@@ -95,6 +95,7 @@ export class MainComponent implements OnInit {
playlist_thumbnails = {};
downloading_content = {'audio': {}, 'video': {}};
downloads: Download[] = [];
download_uids: string[] = [];
current_download: Download = null;
urlForm = new FormControl('', [Validators.required]);
@@ -430,7 +431,6 @@ export class MainComponent implements OnInit {
}
const type = this.audioOnly ? 'audio' : 'video';
this.downloadingfile = true;
const customQualityConfiguration = type === 'audio' ? this.getSelectedAudioFormat() : this.getSelectedVideoFormat();
@@ -443,10 +443,12 @@ export class MainComponent implements OnInit {
}
}
this.downloadingfile = true;
this.postsService.downloadFile(this.url, type, (this.selectedQuality === '' ? null : this.selectedQuality),
customQualityConfiguration, customArgs, customOutput, youtubeUsername, youtubePassword, cropFileSettings).subscribe(res => {
this.current_download = res['download'];
this.downloadingfile = true;
this.downloads.push(res['download']);
this.download_uids.push(res['download']['uid']);
}, error => { // can't access server
this.downloadingfile = false;
this.current_download = null;
@@ -454,7 +456,7 @@ export class MainComponent implements OnInit {
});
if (!this.autoplay) {
const download_queued_message = $localize`Download for ${this.url}:url has been queued!`;
const download_queued_message = $localize`Download for ${this.url}:url: has been queued!`;
this.postsService.openSnackBar(download_queued_message);
this.url = '';
this.downloadingfile = false;