From 13e690dd63af0102cf682af79cdceb782da82abf Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2019 22:43:58 +0200 Subject: add quality selection --- ui/src/app/app.component.html | 11 +++++++---- ui/src/app/app.component.sass | 3 +++ ui/src/app/app.component.ts | 9 ++++++++- ui/src/app/downloads.service.ts | 4 ++-- 4 files changed, 20 insertions(+), 7 deletions(-) (limited to 'ui/src') diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index e0c67cd..e1f29d6 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -19,11 +19,14 @@
- +
+
diff --git a/ui/src/app/app.component.sass b/ui/src/app/app.component.sass index 71b07f8..99e1a37 100644 --- a/ui/src/app/app.component.sass +++ b/ui/src/app/app.component.sass @@ -2,6 +2,9 @@ max-width: 720px margin: 4rem auto +button.add-url + min-width: 7rem + $metube-section-color-bg: rgba(0,0,0,.07) .metube-section-header diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index e0961ce..7bb8181 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -11,6 +11,13 @@ import { MasterCheckboxComponent } from './master-checkbox.component'; }) export class AppComponent implements AfterViewInit { addUrl: string; + qualities: Array = [ + {id: "best", text: "Best"}, + {id: "1080p", text: "1080p"}, + {id: "720p", text: "720p"}, + {id: "480p", text: "480p"} + ]; + quality: string = "best"; addInProgress = false; @ViewChild('queueMasterCheckbox', {static: false}) queueMasterCheckbox: MasterCheckboxComponent; @@ -61,7 +68,7 @@ export class AppComponent implements AfterViewInit { addDownload() { this.addInProgress = true; - this.downloads.add(this.addUrl).subscribe((status: Status) => { + this.downloads.add(this.addUrl, this.quality).subscribe((status: Status) => { if (status.status === 'error') { alert(`Error adding URL: ${status.msg}`); } else { diff --git a/ui/src/app/downloads.service.ts b/ui/src/app/downloads.service.ts index 935feba..4da30fe 100644 --- a/ui/src/app/downloads.service.ts +++ b/ui/src/app/downloads.service.ts @@ -79,8 +79,8 @@ export class DownloadsService { return of({status: 'error', msg: msg}) } - public add(url: string) { - return this.http.post('add', {url: url}).pipe( + public add(url: string, quality: string) { + return this.http.post('add', {url: url, quality: quality}).pipe( catchError(this.handleHTTPError) ); } -- cgit