mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
web/save: add support for audio bitrate functionality
This commit is contained in:
parent
91fd26e880
commit
49184a235d
5 changed files with 27 additions and 4 deletions
|
@ -49,15 +49,19 @@
|
|||
"audio.format.ogg": "ogg",
|
||||
"audio.format.wav": "wav",
|
||||
"audio.format.opus": "opus",
|
||||
"audio.format.description": "every format but \"best\" is converted, meaning that they're lossy. if preferred format matches best available audio, it won't be converted.",
|
||||
"audio.format.description": "all formats but \"best\" are converted, meaning that there'll be some quality loss. if preferred format matches best available audio, it won't be converted.",
|
||||
|
||||
"audio.bitrate": "audio bitrate",
|
||||
"audio.bitrate.kbps": "kb/s",
|
||||
"audio.bitrate.description": "preferred bitrate to use when converting audio. final perceived quality may differ based on the format.",
|
||||
|
||||
"audio.youtube.dub": "youtube",
|
||||
"audio.youtube.dub.title": "use browser language for dubbed videos",
|
||||
"audio.youtube.dub.description": "works even if cobalt isn't translated to your language.",
|
||||
|
||||
"audio.tiktok.original": "tiktok",
|
||||
"audio.tiktok.original.title": "use original sound",
|
||||
"audio.tiktok.original.description": "downloads original sound used in the post without any additional changes by the post's author.",
|
||||
"audio.tiktok.original.title": "download original sound",
|
||||
"audio.tiktok.original.description": "if enabled, cobalt will download the sound from the post without any changes by the post's author.",
|
||||
|
||||
"metadata.filename": "filename style",
|
||||
"metadata.filename.classic": "classic",
|
||||
|
|
|
@ -16,6 +16,7 @@ const request = async (url: string) => {
|
|||
|
||||
downloadMode: saveSettings.downloadMode,
|
||||
|
||||
audioBitrate: saveSettings.audioBitrate,
|
||||
audioFormat: saveSettings.audioFormat,
|
||||
tiktokFullAudio: saveSettings.tiktokFullAudio,
|
||||
youtubeDubBrowserLang: saveSettings.youtubeDubBrowserLang,
|
||||
|
|
|
@ -15,6 +15,7 @@ const defaultSettings: CobaltSettings = {
|
|||
reduceTransparency: false,
|
||||
},
|
||||
save: {
|
||||
audioBitrate: "256",
|
||||
audioFormat: "mp3",
|
||||
disableMetadata: false,
|
||||
downloadMode: "auto",
|
||||
|
|
|
@ -2,6 +2,7 @@ import languages from '$i18n/languages.json';
|
|||
import type { RecursivePartial } from './generic';
|
||||
|
||||
export const themeOptions = ["auto", "light", "dark"] as const;
|
||||
export const audioBitrateOptions = ["320", "256", "128", "96", "64"] as const;
|
||||
export const audioFormatOptions = ["best", "mp3", "ogg", "wav", "opus"] as const;
|
||||
export const downloadModeOptions = ["auto", "audio", "mute"] as const;
|
||||
export const filenameStyleOptions = ["classic", "basic", "pretty", "nerdy"] as const;
|
||||
|
@ -32,6 +33,7 @@ type CobaltSettingsProcessing = {
|
|||
|
||||
type CobaltSettingsSave = {
|
||||
audioFormat: typeof audioFormatOptions[number],
|
||||
audioBitrate: typeof audioBitrateOptions[number],
|
||||
disableMetadata: boolean,
|
||||
downloadMode: typeof downloadModeOptions[number],
|
||||
filenameStyle: typeof filenameStyleOptions[number],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { t } from "$lib/i18n/translations";
|
||||
|
||||
import { audioFormatOptions } from "$lib/types/settings";
|
||||
import { audioFormatOptions, audioBitrateOptions } from "$lib/types/settings";
|
||||
|
||||
import SettingsCategory from "$components/settings/SettingsCategory.svelte";
|
||||
import Switcher from "$components/buttons/Switcher.svelte";
|
||||
|
@ -23,6 +23,21 @@
|
|||
</Switcher>
|
||||
</SettingsCategory>
|
||||
|
||||
|
||||
<SettingsCategory sectionId="audio-bitrate" title={$t("settings.audio.bitrate")}>
|
||||
<Switcher big={true} description={$t("settings.audio.bitrate.description")}>
|
||||
{#each audioBitrateOptions as value}
|
||||
<SettingsButton
|
||||
settingContext="save"
|
||||
settingId="audioBitrate"
|
||||
settingValue={value}
|
||||
>
|
||||
{value}{$t("settings.audio.bitrate.kbps")}
|
||||
</SettingsButton>
|
||||
{/each}
|
||||
</Switcher>
|
||||
</SettingsCategory>
|
||||
|
||||
<SettingsCategory sectionId="youtube" title={$t("settings.audio.youtube.dub")}>
|
||||
<SettingsToggle
|
||||
settingContext="save"
|
||||
|
|
Loading…
Reference in a new issue