Added ability to select any supported custom downloader

This commit is contained in:
Isaac Grynsztein
2020-03-15 20:59:21 -04:00
parent 4ceec26a0e
commit da399601e1
2 changed files with 25 additions and 11 deletions

View File

@@ -58,7 +58,13 @@ let debugMode = process.env.YTDL_MODE === 'debug';
if (debugMode) console.log('YTDL-Material in debug mode!'); if (debugMode) console.log('YTDL-Material in debug mode!');
var validDownloadingAgents = [ var validDownloadingAgents = [
'aria2c' 'aria2c',
'avconv',
'axel',
'curl',
'ffmpeg',
'httpie',
'wget'
] ]
// don't overwrite config if it already happened.. NOT // don't overwrite config if it already happened.. NOT
@@ -143,6 +149,8 @@ async function loadConfig() {
if (!useDefaultDownloadingAgent && validDownloadingAgents.indexOf(customDownloadingAgent) !== -1 ) { if (!useDefaultDownloadingAgent && validDownloadingAgents.indexOf(customDownloadingAgent) !== -1 ) {
console.log(`INFO: Using non-default downloading agent \'${customDownloadingAgent}\'`) console.log(`INFO: Using non-default downloading agent \'${customDownloadingAgent}\'`)
} else {
customDownloadingAgent = null;
} }
if (usingEncryption) if (usingEncryption)
@@ -659,8 +667,8 @@ app.post('/api/tomp3', async function(req, res) {
downloadConfig.splice(3, 0, qualityPath); downloadConfig.splice(3, 0, qualityPath);
} }
if (!useDefaultDownloadingAgent && customDownloadingAgent === 'aria2c') { if (!useDefaultDownloadingAgent && customDownloadingAgent) {
downloadConfig.splice(0, 0, '--external-downloader', 'aria2c'); downloadConfig.splice(0, 0, '--external-downloader', customDownloadingAgent);
} }
if (useYoutubeDLArchive) { if (useYoutubeDLArchive) {
@@ -783,8 +791,8 @@ app.post('/api/tomp4', async function(req, res) {
downloadConfig.push('--username', youtubeUsername, '--password', youtubePassword); downloadConfig.push('--username', youtubeUsername, '--password', youtubePassword);
} }
if (!useDefaultDownloadingAgent && customDownloadingAgent === 'aria2c') { if (!useDefaultDownloadingAgent && customDownloadingAgent) {
downloadConfig.splice(0, 0, '--external-downloader', 'aria2c'); downloadConfig.splice(0, 0, '--external-downloader', customDownloadingAgent);
} }
if (useYoutubeDLArchive) { if (useYoutubeDLArchive) {

View File

@@ -223,13 +223,19 @@
<div class="col-12"> <div class="col-12">
<mat-checkbox color="accent" [(ngModel)]="new_config['Advanced']['use_default_downloading_agent']"><ng-container i18n="Use default downloading agent setting">Use default downloading agent</ng-container></mat-checkbox> <mat-checkbox color="accent" [(ngModel)]="new_config['Advanced']['use_default_downloading_agent']"><ng-container i18n="Use default downloading agent setting">Use default downloading agent</ng-container></mat-checkbox>
</div> </div>
<div class="col-12"> <div class="col-12 my-2">
<mat-form-field color="accent"> <mat-select [disabled]="new_config['Advanced']['use_default_downloading_agent']" color="accent" style="width: 200px" [(ngModel)]="new_config['Advanced']['custom_downloading_agent']">
<input [disabled]="new_config['Advanced']['use_default_downloading_agent']" [(ngModel)]="new_config['Advanced']['custom_downloading_agent']" matInput placeholder="Custom agent" i18n-placeholder="Custom agent setting placeholder" required> <mat-option value="">Select a downloader</mat-option>
<mat-hint></mat-hint> <mat-option value="aria2c">aria2c</mat-option>
</mat-form-field> <mat-option value="avconv">avconv</mat-option>
<mat-option value="axel">axel</mat-option>
<mat-option value="curl">curl</mat-option>
<mat-option value="ffmpeg">ffmpeg</mat-option>
<mat-option value="httpie">httpie</mat-option>
<mat-option value="wget">wget</mat-option>
</mat-select>
</div> </div>
<div class="col-12"> <div class="col-12 mt-2">
<mat-checkbox color="accent" [(ngModel)]="new_config['Advanced']['allow_advanced_download']"><ng-container i18n="Allow advanced downloading setting">Allow advanced download</ng-container></mat-checkbox> <mat-checkbox color="accent" [(ngModel)]="new_config['Advanced']['allow_advanced_download']"><ng-container i18n="Allow advanced downloading setting">Allow advanced download</ng-container></mat-checkbox>
</div> </div>
</div> </div>