-
+
Use custom args
-
+
No need to include URL, just everything after.
-
diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts
index c71233c..228a579 100644
--- a/src/app/main/main.component.ts
+++ b/src/app/main/main.component.ts
@@ -51,6 +51,9 @@ export class MainComponent implements OnInit {
customArgs = null;
customOutputEnabled = false;
customOutput = null;
+ youtubeAuthEnabled = false;
+ youtubeUsername = null;
+ youtubePassword = null;
urlError = false;
path = '';
url = '';
@@ -240,6 +243,10 @@ export class MainComponent implements OnInit {
if (localStorage.getItem('customOutputEnabled') !== null) {
this.customOutputEnabled = localStorage.getItem('customOutputEnabled') === 'true';
}
+
+ if (localStorage.getItem('youtubeAuthEnabled') !== null) {
+ this.youtubeAuthEnabled = localStorage.getItem('youtubeAuthEnabled') === 'true';
+ }
}
if (this.autoStartDownload) {
@@ -485,6 +492,12 @@ export class MainComponent implements OnInit {
this.urlError = false;
this.path = '';
+ // get common args
+ const customArgs = (this.customArgsEnabled ? this.customArgs : null);
+ const customOutput = (this.customOutputEnabled ? this.customOutput : null);
+ const youtubeUsername = (this.youtubeAuthEnabled && this.youtubeUsername ? this.youtubeUsername : null);
+ const youtubePassword = (this.youtubeAuthEnabled && this.youtubePassword ? this.youtubePassword : null);
+
if (this.audioOnly) {
// create download object
const new_download: Download = {
@@ -508,11 +521,8 @@ export class MainComponent implements OnInit {
}
}
- const customArgs = (this.customArgsEnabled ? this.customArgs : null);
- const customOutput = (this.customOutputEnabled ? this.customOutput : null);
-
this.postsService.makeMP3(this.url, (this.selectedQuality === '' ? null : this.selectedQuality),
- customQualityConfiguration, customArgs, customOutput).subscribe(posts => {
+ customQualityConfiguration, customArgs, customOutput, youtubeUsername, youtubePassword).subscribe(posts => {
// update download object
new_download.downloading = false;
new_download.percent_complete = 100;
@@ -550,11 +560,8 @@ export class MainComponent implements OnInit {
}
}
- const customArgs = (this.customArgsEnabled ? this.customArgs : null);
- const customOutput = (this.customOutputEnabled ? this.customOutput : null);
-
this.postsService.makeMP4(this.url, (this.selectedQuality === '' ? null : this.selectedQuality),
- customQualityConfiguration, customArgs, customOutput).subscribe(posts => {
+ customQualityConfiguration, customArgs, customOutput, youtubeUsername, youtubePassword).subscribe(posts => {
// update download object
new_download.downloading = false;
new_download.percent_complete = 100;
@@ -785,6 +792,10 @@ export class MainComponent implements OnInit {
localStorage.setItem('customArgsEnabled', new_val.checked.toString());
if (new_val.checked === true && this.customOutputEnabled) {
this.customOutputEnabled = false;
+ localStorage.setItem('customOutputEnabled', 'false');
+
+ this.youtubeAuthEnabled = false;
+ localStorage.setItem('youtubeAuthEnabled', 'false');
}
}
@@ -792,6 +803,15 @@ export class MainComponent implements OnInit {
localStorage.setItem('customOutputEnabled', new_val.checked.toString());
if (new_val.checked === true && this.customArgsEnabled) {
this.customArgsEnabled = false;
+ localStorage.setItem('customArgsEnabled', 'false');
+ }
+ }
+
+ youtubeAuthEnabledChanged(new_val) {
+ localStorage.setItem('youtubeAuthEnabled', new_val.checked.toString());
+ if (new_val.checked === true && this.customArgsEnabled) {
+ this.customArgsEnabled = false;
+ localStorage.setItem('customArgsEnabled', 'false');
}
}
diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts
index 113e5ea..828576a 100644
--- a/src/app/posts.services.ts
+++ b/src/app/posts.services.ts
@@ -44,21 +44,25 @@ export class PostsService {
}
// tslint:disable-next-line: max-line-length
- makeMP3(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null) {
+ makeMP3(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null) {
return this.http.post(this.path + 'tomp3', {url: url,
maxBitrate: selectedQuality,
customQualityConfiguration: customQualityConfiguration,
customArgs: customArgs,
- customOutput: customOutput});
+ customOutput: customOutput,
+ youtubeUsername: youtubeUsername,
+ youtubePassword: youtubePassword});
}
// tslint:disable-next-line: max-line-length
- makeMP4(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null) {
+ makeMP4(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null) {
return this.http.post(this.path + 'tomp4', {url: url,
selectedHeight: selectedQuality,
customQualityConfiguration: customQualityConfiguration,
customArgs: customArgs,
- customOutput: customOutput});
+ customOutput: customOutput,
+ youtubeUsername: youtubeUsername,
+ youtubePassword: youtubePassword});
}
getFileStatusMp3(name: string) {