aboutsummaryrefslogtreecommitdiff
path: root/ui/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/app')
-rw-r--r--ui/src/app/app.component.ts6
-rw-r--r--ui/src/app/formats.ts45
2 files changed, 23 insertions, 28 deletions
diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts
index dd0b7f1..0bab9d1 100644
--- a/ui/src/app/app.component.ts
+++ b/ui/src/app/app.component.ts
@@ -5,7 +5,7 @@ import { CookieService } from 'ngx-cookie-service';
import { DownloadsService, Status } from './downloads.service';
import { MasterCheckboxComponent } from './master-checkbox.component';
-import { Formats, Format, Quality, fillQualities, getQualityById } from './formats';
+import { Formats, Format, Quality, getQualityById } from './formats';
@Component({
selector: 'app-root',
@@ -14,7 +14,7 @@ import { Formats, Format, Quality, fillQualities, getQualityById } from './forma
})
export class AppComponent implements AfterViewInit {
addUrl: string;
- formats: Format[] = fillQualities(Formats);
+ formats: Format[] = Formats;
qualities: Quality[];
quality: Quality;
format: string;
@@ -91,7 +91,7 @@ export class AppComponent implements AfterViewInit {
addDownload(url?: string, quality?: string, format?: string) {
url = url ?? this.addUrl
quality = quality ?? this.quality.value
- format = format ?? this.quality.fmt
+ format = format ?? this.format
this.addInProgress = true;
this.downloads.add(url, quality, format).subscribe((status: Status) => {
diff --git a/ui/src/app/formats.ts b/ui/src/app/formats.ts
index 4f8dd0c..f24b210 100644
--- a/ui/src/app/formats.ts
+++ b/ui/src/app/formats.ts
@@ -8,51 +8,46 @@ export interface Quality {
id: string;
text: string;
value: string;
- fmt?: string;
}
export const Formats: Format[] = [
{
id: 'any',
text: 'Any',
- qualities: [],
+ qualities: [
+ { id: '0', value: 'best', text: 'Best' },
+ { id: '1', value: '1440', text: '1440p' },
+ { id: '2', value: '1080', text: '1080p' },
+ { id: '3', value: '720', text: '720p' },
+ { id: '4', value: '480', text: '480p' },
+ { id: '5', value: 'audio', text: 'Audio Only' },
+ ],
},
{
id: 'mp4',
text: 'MP4',
qualities: [
- { id: "1", value: 'best', text: 'Best MP4' },
- { id: "2", value: '1440', text: '1440p' },
- { id: "3", value: '1080', text: '1080p' },
- { id: "4", value: '720', text: '720p' },
- { id: "5", value: '480', text: '480p' },
+ { id: '6', value: 'best', text: 'Best' },
+ { id: '7', value: '1440', text: '1440p' },
+ { id: '8', value: '1080', text: '1080p' },
+ { id: '9', value: '720', text: '720p' },
+ { id: '10', value: '480', text: '480p' },
],
},
{
id: 'mp3',
text: 'MP3',
qualities: [
- { id: "6", value: 'best', text: 'Best MP3' },
- { id: "7", value: '128', text: '128 kbps' },
- { id: "8", value: '192', text: '192 kbps' },
- { id: "9", value: '320', text: '320 kbps' },
+ { id: '11', value: 'best', text: 'Best' },
+ { id: '12', value: '128', text: '128 kbps' },
+ { id: '13', value: '192', text: '192 kbps' },
+ { id: '14', value: '320', text: '320 kbps' },
],
},
];
-export const fillQualities = (formats: Format[]): Format[] => {
- let allQualities: Quality[] = [];
- formats.forEach((fmt) => {
- fmt.qualities = fmt.qualities.map((ql) => ({ ...ql, fmt: fmt.id }));
- allQualities = allQualities.concat(fmt.qualities);
- });
-
- formats.find((format) => format.id === 'any').qualities = allQualities;
- return formats;
-};
-
export const getQualityById = (formats: Format[], id: string): Quality => {
return formats
- .find(ql => ql.qualities.find(el => el.id === id)).qualities
- .find(el => el.id === id)
-}
+ .find((ql) => ql.qualities.find((el) => el.id === id))
+ .qualities.find((el) => el.id === id);
+};
bgstack15