mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-19 19:21:02 +03:00
Download manager is now per user
Replaced multi download mode with autoplay checkbox
This commit is contained in:
@@ -46,7 +46,7 @@ export class MainComponent implements OnInit {
|
||||
determinateProgress = false;
|
||||
downloadingfile = false;
|
||||
audioOnly: boolean;
|
||||
multiDownloadMode = false;
|
||||
autoplay = false;
|
||||
customArgsEnabled = false;
|
||||
customArgs = null;
|
||||
customOutputEnabled = false;
|
||||
@@ -68,7 +68,7 @@ export class MainComponent implements OnInit {
|
||||
fileManagerEnabled = false;
|
||||
allowQualitySelect = false;
|
||||
downloadOnlyMode = false;
|
||||
allowMultiDownloadMode = false;
|
||||
allowAutoplay = false;
|
||||
audioFolderPath;
|
||||
videoFolderPath;
|
||||
use_youtubedl_archive = false;
|
||||
@@ -232,7 +232,7 @@ export class MainComponent implements OnInit {
|
||||
this.fileManagerEnabled = this.postsService.config['Extra']['file_manager_enabled']
|
||||
&& this.postsService.hasPermission('filemanager');
|
||||
this.downloadOnlyMode = this.postsService.config['Extra']['download_only_mode'];
|
||||
this.allowMultiDownloadMode = this.postsService.config['Extra']['allow_multi_download_mode'];
|
||||
this.allowAutoplay = this.postsService.config['Extra']['allow_autoplay'];
|
||||
this.audioFolderPath = this.postsService.config['Downloader']['path-audio'];
|
||||
this.videoFolderPath = this.postsService.config['Downloader']['path-video'];
|
||||
this.use_youtubedl_archive = this.postsService.config['Downloader']['use_youtubedl_archive'];
|
||||
@@ -314,8 +314,8 @@ export class MainComponent implements OnInit {
|
||||
this.audioOnly = localStorage.getItem('audioOnly') === 'true';
|
||||
}
|
||||
|
||||
if (localStorage.getItem('multiDownloadMode') !== null) {
|
||||
this.multiDownloadMode = localStorage.getItem('multiDownloadMode') === 'true';
|
||||
if (localStorage.getItem('autoplay') !== null) {
|
||||
this.autoplay = localStorage.getItem('autoplay') === 'true';
|
||||
}
|
||||
|
||||
// check if params exist
|
||||
@@ -374,10 +374,9 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
|
||||
// download helpers
|
||||
|
||||
downloadHelper(container, type, is_playlist = false, force_view = false, navigate_mode = false) {
|
||||
this.downloadingfile = false;
|
||||
if (this.multiDownloadMode && !this.downloadOnlyMode && !navigate_mode) {
|
||||
if (!this.autoplay && !this.downloadOnlyMode && !navigate_mode) {
|
||||
// do nothing
|
||||
this.reloadRecentVideos();
|
||||
} else {
|
||||
@@ -398,9 +397,6 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// // remove download from current downloads
|
||||
// this.removeDownloadFromCurrentDownloads(new_download);
|
||||
}
|
||||
|
||||
// download click handler
|
||||
@@ -432,8 +428,6 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
|
||||
const type = this.audioOnly ? 'audio' : 'video';
|
||||
// this.downloads.push(new_download);
|
||||
// if (!this.current_download && !this.multiDownloadMode) { this.current_download = new_download };
|
||||
this.downloadingfile = true;
|
||||
|
||||
const customQualityConfiguration = type === 'audio' ? this.getSelectedAudioFormat() : this.getSelectedVideoFormat();
|
||||
@@ -449,22 +443,17 @@ export class MainComponent implements OnInit {
|
||||
|
||||
this.postsService.downloadFile(this.url, type, (this.selectedQuality === '' ? null : this.selectedQuality),
|
||||
customQualityConfiguration, customArgs, customOutput, youtubeUsername, youtubePassword, cropFileSettings).subscribe(res => {
|
||||
console.log(res);
|
||||
this.current_download = res['download'];
|
||||
this.downloadingfile = true;
|
||||
}, error => { // can't access server
|
||||
this.downloadingfile = false;
|
||||
this.current_download = null;
|
||||
// new_download['downloading'] = false;
|
||||
// // removes download from list of downloads
|
||||
// const downloads_index = this.downloads.indexOf(new_download);
|
||||
// if (downloads_index !== -1) {
|
||||
// this.downloads.splice(downloads_index)
|
||||
// }
|
||||
this.openSnackBar('Download failed!', 'OK.');
|
||||
});
|
||||
|
||||
if (this.multiDownloadMode) {
|
||||
if (!this.autoplay) {
|
||||
const download_queued_message = $localize`Download for ${this.url}:url has been queued!`;
|
||||
this.postsService.openSnackBar(download_queued_message);
|
||||
this.url = '';
|
||||
this.downloadingfile = false;
|
||||
}
|
||||
@@ -755,8 +744,8 @@ export class MainComponent implements OnInit {
|
||||
localStorage.setItem('audioOnly', new_val.checked.toString());
|
||||
}
|
||||
|
||||
multiDownloadModeChanged(new_val) {
|
||||
localStorage.setItem('multiDownloadMode', new_val.checked.toString());
|
||||
autoplayChanged(new_val) {
|
||||
localStorage.setItem('autoplay', new_val.checked.toString());
|
||||
}
|
||||
|
||||
customArgsEnabledChanged(new_val) {
|
||||
|
||||
Reference in New Issue
Block a user