|
|
|
|
@ -284,6 +284,13 @@ export class MainComponent implements OnInit {
|
|
|
|
|
if (youtubeUsername && youtubeUsername !== 'null') { this.youtubeUsername = youtubeUsername };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get downloads routine
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
if (this.current_download) {
|
|
|
|
|
this.getCurrentDownload();
|
|
|
|
|
}
|
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}, error => {
|
|
|
|
|
@ -587,7 +594,7 @@ export class MainComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.postsService.makeMP3(this.url, (this.selectedQuality === '' ? null : this.selectedQuality),
|
|
|
|
|
customQualityConfiguration, customArgs, customOutput, youtubeUsername, youtubePassword).subscribe(posts => {
|
|
|
|
|
customQualityConfiguration, customArgs, customOutput, youtubeUsername, youtubePassword, new_download.uid).subscribe(posts => {
|
|
|
|
|
// update download object
|
|
|
|
|
new_download.downloading = false;
|
|
|
|
|
new_download.percent_complete = 100;
|
|
|
|
|
@ -595,6 +602,8 @@ export class MainComponent implements OnInit {
|
|
|
|
|
const is_playlist = !!(posts['file_names']);
|
|
|
|
|
this.path = is_playlist ? posts['file_names'] : posts['audiopathEncoded'];
|
|
|
|
|
|
|
|
|
|
this.current_download = null;
|
|
|
|
|
|
|
|
|
|
if (this.path !== '-1') {
|
|
|
|
|
this.downloadHelperMp3(this.path, posts['uid'], is_playlist, false, new_download);
|
|
|
|
|
}
|
|
|
|
|
@ -627,7 +636,7 @@ export class MainComponent implements OnInit {
|
|
|
|
|
const customQualityConfiguration = this.getSelectedVideoFormat();
|
|
|
|
|
|
|
|
|
|
this.postsService.makeMP4(this.url, (this.selectedQuality === '' ? null : this.selectedQuality),
|
|
|
|
|
customQualityConfiguration, customArgs, customOutput, youtubeUsername, youtubePassword).subscribe(posts => {
|
|
|
|
|
customQualityConfiguration, customArgs, customOutput, youtubeUsername, youtubePassword, new_download.uid).subscribe(posts => {
|
|
|
|
|
// update download object
|
|
|
|
|
new_download.downloading = false;
|
|
|
|
|
new_download.percent_complete = 100;
|
|
|
|
|
@ -635,6 +644,8 @@ export class MainComponent implements OnInit {
|
|
|
|
|
const is_playlist = !!(posts['file_names']);
|
|
|
|
|
this.path = is_playlist ? posts['file_names'] : posts['videopathEncoded'];
|
|
|
|
|
|
|
|
|
|
this.current_download = null;
|
|
|
|
|
|
|
|
|
|
if (this.path !== '-1') {
|
|
|
|
|
this.downloadHelperMp4(this.path, posts['uid'], is_playlist, false, new_download);
|
|
|
|
|
}
|
|
|
|
|
@ -1124,4 +1135,21 @@ export class MainComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCurrentDownload() {
|
|
|
|
|
this.postsService.getCurrentDownload(this.postsService.session_id,
|
|
|
|
|
this.current_download['ui_uid'] ? this.current_download['ui_uid'] : this.current_download['uid']).subscribe(res => {
|
|
|
|
|
const ui_uid = this.current_download['ui_uid'] ? this.current_download['ui_uid'] : this.current_download['uid'];
|
|
|
|
|
if (res['download']) {
|
|
|
|
|
console.log('got new download');
|
|
|
|
|
if (ui_uid === res['download']['ui_uid']) {
|
|
|
|
|
this.current_download = res['download'];
|
|
|
|
|
this.percentDownloaded = this.current_download.percent_complete;
|
|
|
|
|
console.log(this.percentDownloaded);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.log('failed to get new download');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|