feat: apply rollup 🚀 (#20)

Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
JellyBrick
2023-10-04 17:51:39 +09:00
committed by GitHub
parent 2c337953eb
commit 40745d3946
42 changed files with 1752 additions and 1339 deletions

View File

@ -24,6 +24,8 @@ import { cropMaxWidth, getFolder, presets, sendFeedback as sendFeedback_, setBad
import config from './config';
import style from './style.css';
import { fetchFromGenius } from '../lyrics-genius/back';
import { isEnabled } from '../../config/plugins';
import { cleanupName, getImage, SongInfo } from '../../providers/song-info';
@ -32,6 +34,7 @@ import { cache } from '../../providers/decorators';
import type { GetPlayerResponse } from '../../types/get-player-response';
type CustomSongInfo = SongInfo & { trackId?: string };
const ffmpeg = createFFmpeg({
@ -68,7 +71,7 @@ const sendError = (error: Error, source?: string) => {
export default async (win_: BrowserWindow) => {
win = win_;
injectCSS(win.webContents, join(__dirname, 'style.css'));
injectCSS(win.webContents, style);
const cookie = (await win.webContents.session.cookies.get({ url: 'https://music.youtube.com' })).map((it) =>
it.name + '=' + it.value + ';'
@ -104,6 +107,7 @@ export async function downloadSong(
increasePlaylistProgress,
);
} catch (error: unknown) {
console.log('maybe?????', error);
sendError(error as Error, resolvedName || url);
}
}
@ -316,6 +320,7 @@ async function iterableStreamToMP3(
ffmpeg.FS('unlink', `${safeVideoName}.mp3`);
}
} catch (error: unknown) {
console.log('maybe?', error);
sendError(error as Error, safeVideoName);
} finally {
releaseFFmpegMutex();
@ -368,6 +373,7 @@ async function writeID3(buffer: Buffer, metadata: CustomSongInfo, sendFeedback:
return NodeID3.write(tags, buffer);
} catch (error: unknown) {
console.log('fallback', error);
sendError(error as Error, `${metadata.artist} - ${metadata.title}`);
return null;
}
@ -482,6 +488,7 @@ export async function downloadPlaylist(givenUrl?: string | URL) {
counter++;
}
} catch (error: unknown) {
console.log('also?', error);
sendError(error as Error);
} finally {
win.setProgressBar(-1); // Close progress bar
@ -507,6 +514,7 @@ async function ffmpegWriteTags(filePath: string, metadata: CustomSongInfo, prese
filePath,
);
} catch (error: unknown) {
console.log('ffmpeg?', error);
sendError(error as Error);
} finally {
releaseFFmpegMutex();