mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 11:01:45 +00:00
feat: run prettier
This commit is contained in:
@ -44,9 +44,12 @@ export default createPlugin({
|
||||
{
|
||||
label: t('plugins.ambient-mode.menu.smoothness-transition.label'),
|
||||
submenu: interpolationTimeList.map((interpolationTime) => ({
|
||||
label: t('plugins.ambient-mode.menu.smoothness-transition.submenu.during', {
|
||||
interpolationTime: interpolationTime / 1000,
|
||||
}),
|
||||
label: t(
|
||||
'plugins.ambient-mode.menu.smoothness-transition.submenu.during',
|
||||
{
|
||||
interpolationTime: interpolationTime / 1000,
|
||||
},
|
||||
),
|
||||
type: 'radio',
|
||||
checked: config.interpolationTime === interpolationTime,
|
||||
click() {
|
||||
@ -57,7 +60,9 @@ export default createPlugin({
|
||||
{
|
||||
label: t('plugins.ambient-mode.menu.quality.label'),
|
||||
submenu: qualityList.map((quality) => ({
|
||||
label: t('plugins.ambient-mode.menu.quality.submenu.pixels', { quality }),
|
||||
label: t('plugins.ambient-mode.menu.quality.submenu.pixels', {
|
||||
quality,
|
||||
}),
|
||||
type: 'radio',
|
||||
checked: config.quality === quality,
|
||||
click() {
|
||||
@ -79,7 +84,9 @@ export default createPlugin({
|
||||
{
|
||||
label: t('plugins.ambient-mode.menu.buffer.label'),
|
||||
submenu: bufferList.map((buffer) => ({
|
||||
label: t('plugins.ambient-mode.menu.buffer.submenu.buffer', { buffer }),
|
||||
label: t('plugins.ambient-mode.menu.buffer.submenu.buffer', {
|
||||
buffer,
|
||||
}),
|
||||
type: 'radio',
|
||||
checked: config.buffer === buffer,
|
||||
click() {
|
||||
@ -90,7 +97,9 @@ export default createPlugin({
|
||||
{
|
||||
label: t('plugins.ambient-mode.menu.opacity.label'),
|
||||
submenu: opacityList.map((opacity) => ({
|
||||
label: t('plugins.ambient-mode.menu.opacity.submenu.percent', { opacity: opacity * 100 }),
|
||||
label: t('plugins.ambient-mode.menu.opacity.submenu.percent', {
|
||||
opacity: opacity * 100,
|
||||
}),
|
||||
type: 'radio',
|
||||
checked: config.opacity === opacity,
|
||||
click() {
|
||||
@ -101,7 +110,9 @@ export default createPlugin({
|
||||
{
|
||||
label: t('plugins.ambient-mode.menu.blur-amount.label'),
|
||||
submenu: blurAmountList.map((blur) => ({
|
||||
label: t('plugins.ambient-mode.menu.blur-amount.submenu.pixels', { blurAmount: blur }),
|
||||
label: t('plugins.ambient-mode.menu.blur-amount.submenu.pixels', {
|
||||
blurAmount: blur,
|
||||
}),
|
||||
type: 'radio',
|
||||
checked: config.blur === blur,
|
||||
click() {
|
||||
|
||||
@ -13,7 +13,9 @@ export default createBackend({
|
||||
{
|
||||
title: t('plugins.captions-selector.prompt.selector.title'),
|
||||
label: t('plugins.captions-selector.prompt.selector.label', {
|
||||
language: captionLabels[currentIndex] || t('plugins.captions-selector.prompt.selector.none'),
|
||||
language:
|
||||
captionLabels[currentIndex] ||
|
||||
t('plugins.captions-selector.prompt.selector.none'),
|
||||
}),
|
||||
type: 'select',
|
||||
value: currentIndex,
|
||||
|
||||
@ -10,9 +10,10 @@ import { getNetFetchAsFetch } from '@/plugins/utils/main';
|
||||
import { createPlugin } from '@/utils';
|
||||
import { VolumeFader } from './fader';
|
||||
|
||||
import type { RendererContext } from '@/types/contexts';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
import type { RendererContext } from '@/types/contexts';
|
||||
|
||||
export type CrossfadePluginConfig = {
|
||||
enabled: boolean;
|
||||
fadeInDuration: number;
|
||||
@ -72,7 +73,9 @@ export default createPlugin<
|
||||
type: 'multiInput',
|
||||
multiInputOptions: [
|
||||
{
|
||||
label: t('plugins.crossfade.prompt.options.multi-input.fade-in-duration'),
|
||||
label: t(
|
||||
'plugins.crossfade.prompt.options.multi-input.fade-in-duration',
|
||||
),
|
||||
value: options.fadeInDuration,
|
||||
inputAttrs: {
|
||||
type: 'number',
|
||||
@ -82,7 +85,9 @@ export default createPlugin<
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('plugins.crossfade.prompt.options.multi-input.fade-out-duration'),
|
||||
label: t(
|
||||
'plugins.crossfade.prompt.options.multi-input.fade-out-duration',
|
||||
),
|
||||
value: options.fadeOutDuration,
|
||||
inputAttrs: {
|
||||
type: 'number',
|
||||
@ -92,7 +97,9 @@ export default createPlugin<
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('plugins.crossfade.prompt.options.multi-input.seconds-before-end'),
|
||||
label: t(
|
||||
'plugins.crossfade.prompt.options.multi-input.seconds-before-end',
|
||||
),
|
||||
value: options.secondsBeforeEnd,
|
||||
inputAttrs: {
|
||||
type: 'number',
|
||||
@ -101,10 +108,16 @@ export default createPlugin<
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('plugins.crossfade.prompt.options.multi-input.fade-scaling.label'),
|
||||
label: t(
|
||||
'plugins.crossfade.prompt.options.multi-input.fade-scaling.label',
|
||||
),
|
||||
selectOptions: {
|
||||
linear: t('plugins.crossfade.prompt.options.multi-input.fade-scaling.linear'),
|
||||
logarithmic: t('plugins.crossfade.prompt.options.multi-input.fade-scaling.logarithmic'),
|
||||
linear: t(
|
||||
'plugins.crossfade.prompt.options.multi-input.fade-scaling.linear',
|
||||
),
|
||||
logarithmic: t(
|
||||
'plugins.crossfade.prompt.options.multi-input.fade-scaling.logarithmic',
|
||||
),
|
||||
},
|
||||
value: options.fadeScaling,
|
||||
},
|
||||
|
||||
@ -40,10 +40,7 @@ const resetInfo = () => {
|
||||
info.ready = false;
|
||||
clearTimeout(clearActivity);
|
||||
if (dev()) {
|
||||
console.log(
|
||||
LoggerPrefix,
|
||||
t('plugins.discord.backend.disconnected')
|
||||
);
|
||||
console.log(LoggerPrefix, t('plugins.discord.backend.disconnected'));
|
||||
}
|
||||
|
||||
for (const cb of refreshCallbacks) {
|
||||
@ -73,10 +70,7 @@ let window: Electron.BrowserWindow;
|
||||
export const connect = (showError = false) => {
|
||||
if (info.rpc.isConnected) {
|
||||
if (dev()) {
|
||||
console.log(
|
||||
LoggerPrefix,
|
||||
t('plugins.discord.backend.already-connected')
|
||||
);
|
||||
console.log(LoggerPrefix, t('plugins.discord.backend.already-connected'));
|
||||
}
|
||||
|
||||
return;
|
||||
@ -214,10 +208,7 @@ export const backend = createBackend<
|
||||
|
||||
info.rpc.on('connected', () => {
|
||||
if (dev()) {
|
||||
console.log(
|
||||
LoggerPrefix,
|
||||
t('plugins.discord.backend.connected')
|
||||
);
|
||||
console.log(LoggerPrefix, t('plugins.discord.backend.connected'));
|
||||
}
|
||||
|
||||
for (const cb of refreshCallbacks) {
|
||||
|
||||
@ -28,7 +28,9 @@ export const onMenu = async ({
|
||||
|
||||
return [
|
||||
{
|
||||
label: isConnected() ? t('plugins.discord.menu.connected') : t('plugins.discord.menu.disconnected'),
|
||||
label: isConnected()
|
||||
? t('plugins.discord.menu.connected')
|
||||
: t('plugins.discord.menu.disconnected'),
|
||||
enabled: !isConnected(),
|
||||
click: () => connect(),
|
||||
},
|
||||
|
||||
@ -181,19 +181,17 @@ async function downloadSongUnsafe(
|
||||
}
|
||||
};
|
||||
|
||||
sendFeedback(
|
||||
t('plugins.downloader.backend.feedback.downloading'),
|
||||
2,
|
||||
);
|
||||
sendFeedback(t('plugins.downloader.backend.feedback.downloading'), 2);
|
||||
|
||||
let id: string | null;
|
||||
if (isId) {
|
||||
id = idOrUrl;
|
||||
} else {
|
||||
id = getVideoId(idOrUrl);
|
||||
if (typeof id !== 'string') throw new Error(
|
||||
t('plugins.downloader.backend.feedback.video-id-not-found'),
|
||||
);
|
||||
if (typeof id !== 'string')
|
||||
throw new Error(
|
||||
t('plugins.downloader.backend.feedback.video-id-not-found'),
|
||||
);
|
||||
}
|
||||
|
||||
let info: TrackInfo | VideoInfo = await yt.music.getInfo(id);
|
||||
@ -325,9 +323,11 @@ async function downloadSongUnsafe(
|
||||
}
|
||||
|
||||
sendFeedback(null, -1);
|
||||
console.info(t('plugins.downloader.backend.feedback.done', {
|
||||
filePath,
|
||||
}));
|
||||
console.info(
|
||||
t('plugins.downloader.backend.feedback.done', {
|
||||
filePath,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function iterableStreamToTargetFile(
|
||||
@ -357,10 +357,7 @@ async function iterableStreamToTargetFile(
|
||||
increasePlaylistProgress(ratio * 0.15);
|
||||
}
|
||||
|
||||
sendFeedback(
|
||||
t('plugins.downloader.backend.feedback.loading'),
|
||||
2,
|
||||
); // Indefinite progress bar after download
|
||||
sendFeedback(t('plugins.downloader.backend.feedback.loading'), 2); // Indefinite progress bar after download
|
||||
|
||||
const buffer = Buffer.concat(chunks);
|
||||
const safeVideoName = randomBytes(32).toString('hex');
|
||||
@ -399,9 +396,7 @@ async function iterableStreamToTargetFile(
|
||||
ffmpeg.FS('unlink', safeVideoName);
|
||||
}
|
||||
|
||||
sendFeedback(
|
||||
t('plugins.downloader.backend.feedback.saving'),
|
||||
);
|
||||
sendFeedback(t('plugins.downloader.backend.feedback.saving'));
|
||||
|
||||
try {
|
||||
return ffmpeg.FS('readFile', safeVideoNameWithExtension);
|
||||
@ -427,9 +422,7 @@ async function writeID3(
|
||||
sendFeedback: (str: string, value?: number) => void,
|
||||
) {
|
||||
try {
|
||||
sendFeedback(
|
||||
t('plugins.downloader.backend.feedback.writing-id3'),
|
||||
);
|
||||
sendFeedback(t('plugins.downloader.backend.feedback.writing-id3'));
|
||||
const tags: NodeID3.Tags = {};
|
||||
|
||||
// Create the metadata tags
|
||||
@ -484,9 +477,9 @@ export async function downloadPlaylist(givenUrl?: string | URL) {
|
||||
getPlaylistID(givenUrl) || getPlaylistID(new URL(playingUrl));
|
||||
|
||||
if (!playlistId) {
|
||||
sendError(new Error(
|
||||
t('plugins.downloader.backend.feedback.playlist-id-not-found'),
|
||||
));
|
||||
sendError(
|
||||
new Error(t('plugins.downloader.backend.feedback.playlist-id-not-found')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -497,9 +490,7 @@ export async function downloadPlaylist(givenUrl?: string | URL) {
|
||||
playlistId,
|
||||
}),
|
||||
);
|
||||
sendFeedback(
|
||||
t('plugins.downloader.backend.feedback.getting-playlist-info'),
|
||||
);
|
||||
sendFeedback(t('plugins.downloader.backend.feedback.getting-playlist-info'));
|
||||
let playlist: Playlist;
|
||||
const items: YTNodes.MusicResponsiveListItem[] = [];
|
||||
try {
|
||||
@ -519,9 +510,9 @@ export async function downloadPlaylist(givenUrl?: string | URL) {
|
||||
}
|
||||
|
||||
if (!playlist || !playlist.items || playlist.items.length === 0) {
|
||||
sendError(new Error(
|
||||
t('plugins.downloader.backend.feedback.playlist-is-empty'),
|
||||
));
|
||||
sendError(
|
||||
new Error(t('plugins.downloader.backend.feedback.playlist-is-empty')),
|
||||
);
|
||||
}
|
||||
|
||||
const normalPlaylistTitle = playlist.header?.title?.text;
|
||||
@ -558,11 +549,13 @@ export async function downloadPlaylist(givenUrl?: string | URL) {
|
||||
const playlistFolder = join(folder, safePlaylistTitle);
|
||||
if (existsSync(playlistFolder)) {
|
||||
if (!config.skipExisting) {
|
||||
sendError(new Error(
|
||||
t('plugins.downloader.backend.feedback.folder-already-exists', {
|
||||
playlistFolder,
|
||||
})
|
||||
));
|
||||
sendError(
|
||||
new Error(
|
||||
t('plugins.downloader.backend.feedback.folder-already-exists', {
|
||||
playlistFolder,
|
||||
}),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -571,14 +564,22 @@ export async function downloadPlaylist(givenUrl?: string | URL) {
|
||||
|
||||
dialog.showMessageBox(win, {
|
||||
type: 'info',
|
||||
buttons: [t('plugins.downloader.backend.dialog.start-download-playlist.buttons.ok')],
|
||||
buttons: [
|
||||
t('plugins.downloader.backend.dialog.start-download-playlist.buttons.ok'),
|
||||
],
|
||||
title: t('plugins.downloader.backend.dialog.start-download-playlist.title'),
|
||||
message: t('plugins.downloader.backend.dialog.start-download-playlist.message', {
|
||||
playlistTitle,
|
||||
}),
|
||||
detail: t('plugins.downloader.backend.dialog.start-download-playlist.detail', {
|
||||
playlistSize: items.length,
|
||||
}),
|
||||
message: t(
|
||||
'plugins.downloader.backend.dialog.start-download-playlist.message',
|
||||
{
|
||||
playlistTitle,
|
||||
},
|
||||
),
|
||||
detail: t(
|
||||
'plugins.downloader.backend.dialog.start-download-playlist.detail',
|
||||
{
|
||||
playlistSize: items.length,
|
||||
},
|
||||
),
|
||||
});
|
||||
|
||||
if (is.dev()) {
|
||||
@ -611,7 +612,7 @@ export async function downloadPlaylist(givenUrl?: string | URL) {
|
||||
t('plugins.downloader.backend.feedback.downloading-counter', {
|
||||
current: counter,
|
||||
total: items.length,
|
||||
})
|
||||
}),
|
||||
);
|
||||
const trackId = isAlbum ? counter : undefined;
|
||||
await downloadSongFromId(
|
||||
|
||||
@ -4,11 +4,12 @@ import { downloadPlaylist } from './main';
|
||||
import { defaultMenuDownloadLabel, getFolder } from './main/utils';
|
||||
import { DefaultPresetList } from './types';
|
||||
|
||||
import { t } from '@/i18n';
|
||||
|
||||
import type { MenuContext } from '@/types/contexts';
|
||||
import type { MenuTemplate } from '@/menu';
|
||||
|
||||
import type { DownloaderPluginConfig } from './index';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export const onMenu = async ({
|
||||
getConfig,
|
||||
|
||||
@ -6,12 +6,13 @@ import { getSongInfo } from '@/providers/song-info-front';
|
||||
|
||||
import { LoggerPrefix } from '@/utils';
|
||||
|
||||
import { t } from '@/i18n';
|
||||
|
||||
import { ElementFromHtml } from '../utils/renderer';
|
||||
|
||||
import type { RendererContext } from '@/types/contexts';
|
||||
|
||||
import type { DownloaderPluginConfig } from './index';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
let menu: Element | null = null;
|
||||
let progress: Element | null = null;
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import { LoggerPrefix } from '@/utils';
|
||||
|
||||
import { t } from '@/i18n';
|
||||
|
||||
import type { SongInfo } from '@/providers/song-info';
|
||||
import type { RendererContext } from '@/types/contexts';
|
||||
import type { LyricsGeniusPluginConfig } from '@/plugins/lyrics-genius/index';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export const onRendererLoad = ({
|
||||
ipc: { invoke, on },
|
||||
|
||||
@ -59,21 +59,27 @@ export const onMenu = async ({
|
||||
label: t('plugins.notifications.menu.interactive-settings.label'),
|
||||
submenu: [
|
||||
{
|
||||
label: t('plugins.notifications.menu.interactive-settings.submenu.tray-controls'),
|
||||
label: t(
|
||||
'plugins.notifications.menu.interactive-settings.submenu.tray-controls',
|
||||
),
|
||||
type: 'checkbox',
|
||||
checked: config.trayControls,
|
||||
click: (item: MenuItem) =>
|
||||
setConfig({ trayControls: item.checked }),
|
||||
},
|
||||
{
|
||||
label: t('plugins.notifications.menu.interactive-settings.submenu.hide-button-text'),
|
||||
label: t(
|
||||
'plugins.notifications.menu.interactive-settings.submenu.hide-button-text',
|
||||
),
|
||||
type: 'checkbox',
|
||||
checked: config.hideButtonText,
|
||||
click: (item: MenuItem) =>
|
||||
setConfig({ hideButtonText: item.checked }),
|
||||
},
|
||||
{
|
||||
label: t('plugins.notifications.menu.interactive-settings.submenu.refresh-on-play-pause'),
|
||||
label: t(
|
||||
'plugins.notifications.menu.interactive-settings.submenu.refresh-on-play-pause',
|
||||
),
|
||||
type: 'checkbox',
|
||||
checked: config.refreshOnPlayPause,
|
||||
click: (item: MenuItem) =>
|
||||
|
||||
@ -55,7 +55,9 @@ export const onMenu = async ({
|
||||
keybindOptions: [
|
||||
{
|
||||
value: 'hotkey',
|
||||
label: t('plugins.picture-in-picture.menu.prompt.keybind-options.hotkey'),
|
||||
label: t(
|
||||
'plugins.picture-in-picture.menu.prompt.keybind-options.hotkey',
|
||||
),
|
||||
default: config.hotkey,
|
||||
},
|
||||
],
|
||||
|
||||
@ -44,7 +44,9 @@
|
||||
class="text style-scope ytmusic-menu-navigation-item-renderer"
|
||||
id="ytmcustom-pip"
|
||||
>
|
||||
<ytmd-trans key="plugins.picture-in-picture.templates.button"></ytmd-trans>
|
||||
<ytmd-trans
|
||||
key="plugins.picture-in-picture.templates.button"
|
||||
></ytmd-trans>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -83,7 +83,8 @@
|
||||
class="text style-scope ytmusic-menu-navigation-item-renderer"
|
||||
id="ytmcustom-playback-speed"
|
||||
>
|
||||
<ytmd-trans key="plugins.playback-speed.templates.button"></ytmd-trans> (<span id="playback-speed-value">1</span>)
|
||||
<ytmd-trans key="plugins.playback-speed.templates.button"></ytmd-trans>
|
||||
(<span id="playback-speed-value">1</span>)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -103,12 +103,16 @@ export default createPlugin({
|
||||
type: 'keybind',
|
||||
keybindOptions: [
|
||||
kb(
|
||||
t('plugins.precise-volume.prompt.global-shortcuts.keybind-options.increase'),
|
||||
t(
|
||||
'plugins.precise-volume.prompt.global-shortcuts.keybind-options.increase',
|
||||
),
|
||||
'volumeUp',
|
||||
options.globalShortcuts?.volumeUp,
|
||||
),
|
||||
kb(
|
||||
t('plugins.precise-volume.prompt.global-shortcuts.keybind-options.decrease'),
|
||||
t(
|
||||
'plugins.precise-volume.prompt.global-shortcuts.keybind-options.decrease',
|
||||
),
|
||||
'volumeDown',
|
||||
options.globalShortcuts?.volumeDown,
|
||||
),
|
||||
|
||||
@ -24,11 +24,18 @@ export default createPlugin({
|
||||
type: 'question',
|
||||
buttons: qualityLabels,
|
||||
defaultId: currentIndex,
|
||||
title: t('plugins.quality-changer.backend.dialog.quality-changer.title'),
|
||||
message: t('plugins.quality-changer.backend.dialog.quality-changer.message'),
|
||||
detail: t('plugins.quality-changer.backend.dialog.quality-changer.detail', {
|
||||
quality: qualityLabels[currentIndex],
|
||||
}),
|
||||
title: t(
|
||||
'plugins.quality-changer.backend.dialog.quality-changer.title',
|
||||
),
|
||||
message: t(
|
||||
'plugins.quality-changer.backend.dialog.quality-changer.message',
|
||||
),
|
||||
detail: t(
|
||||
'plugins.quality-changer.backend.dialog.quality-changer.detail',
|
||||
{
|
||||
quality: qualityLabels[currentIndex],
|
||||
},
|
||||
),
|
||||
cancelId: -1,
|
||||
}),
|
||||
);
|
||||
|
||||
@ -36,9 +36,21 @@ export const onMenu = async ({
|
||||
type: 'keybind',
|
||||
keybindOptions: [
|
||||
// If default=undefined then no default is used
|
||||
kb(t('plugins.shortcuts.prompt.keybind.keybind-options.previous'), 'previous', config.global?.previous),
|
||||
kb(t('plugins.shortcuts.prompt.keybind.keybind-options.play-pause'), 'playPause', config.global?.playPause),
|
||||
kb(t('plugins.shortcuts.prompt.keybind.keybind-options.next'), 'next', config.global?.next),
|
||||
kb(
|
||||
t('plugins.shortcuts.prompt.keybind.keybind-options.previous'),
|
||||
'previous',
|
||||
config.global?.previous,
|
||||
),
|
||||
kb(
|
||||
t('plugins.shortcuts.prompt.keybind.keybind-options.play-pause'),
|
||||
'playPause',
|
||||
config.global?.playPause,
|
||||
),
|
||||
kb(
|
||||
t('plugins.shortcuts.prompt.keybind.keybind-options.next'),
|
||||
'next',
|
||||
config.global?.next,
|
||||
),
|
||||
],
|
||||
height: 270,
|
||||
...promptOptions(),
|
||||
|
||||
Reference in New Issue
Block a user