mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-20 19:50:58 +03:00
Audio downloads now work with progress bar, but it requires file conversion at the end. It ends up being around the same speed as the regular method
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
</h4>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div *ngFor="let download of session_downloads.value | keyvalue; let i = index;" class="col-12 my-1">
|
||||
<div *ngFor="let download of session_downloads.value | keyvalue: sort_downloads; let i = index;" class="col-12 my-1">
|
||||
<mat-card *ngIf="download.value" class="mat-elevation-z3">
|
||||
<app-download-item [download]="download.value" [queueNumber]="i+1" (cancelDownload)="clearDownload(session_downloads.key, download.value.uid)"></app-download-item>
|
||||
</mat-card>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, ViewChildren, QueryList, ElementRef } from '@angular/core';
|
||||
import { Component, OnInit, ViewChildren, QueryList, ElementRef, OnDestroy } from '@angular/core';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
import { trigger, transition, animateChild, stagger, query, style, animate } from '@angular/animations';
|
||||
import { Router } from '@angular/router';
|
||||
@@ -32,20 +32,26 @@ import { Router } from '@angular/router';
|
||||
])
|
||||
],
|
||||
})
|
||||
export class DownloadsComponent implements OnInit {
|
||||
export class DownloadsComponent implements OnInit, OnDestroy {
|
||||
|
||||
downloads_check_interval = 500;
|
||||
downloads_check_interval = 1000;
|
||||
downloads = {};
|
||||
interval_id = null;
|
||||
|
||||
keys = Object.keys;
|
||||
|
||||
valid_sessions_length = 0;
|
||||
|
||||
sort_downloads = (a, b) => {
|
||||
const result = a.value.timestamp_start < b.value.timestamp_start;
|
||||
return result;
|
||||
}
|
||||
|
||||
constructor(public postsService: PostsService, private router: Router) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getCurrentDownloads();
|
||||
setInterval(() => {
|
||||
this.interval_id = setInterval(() => {
|
||||
this.getCurrentDownloads();
|
||||
}, this.downloads_check_interval);
|
||||
|
||||
@@ -58,6 +64,10 @@ export class DownloadsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.interval_id) { clearInterval(this.interval_id) }
|
||||
}
|
||||
|
||||
getCurrentDownloads() {
|
||||
this.postsService.getCurrentDownloads().subscribe(res => {
|
||||
if (res['downloads']) {
|
||||
|
||||
Reference in New Issue
Block a user