mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-15 04:11:47 +00:00
Merge pull request #118 from th-ch/dl-custom-audio-format
Downloader plugin - custom audio format
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "youtube-music",
|
"name": "youtube-music",
|
||||||
"productName": "YouTube Music",
|
"productName": "YouTube Music",
|
||||||
"version": "1.8.0",
|
"version": "1.8.1",
|
||||||
"description": "YouTube Music Desktop App - including custom plugins",
|
"description": "YouTube Music Desktop App - including custom plugins",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "th-ch/youtube-music",
|
"repository": "th-ch/youtube-music",
|
||||||
|
|||||||
@ -73,6 +73,7 @@ const toMP3 = async (
|
|||||||
options
|
options
|
||||||
) => {
|
) => {
|
||||||
const safeVideoName = randomBytes(32).toString("hex");
|
const safeVideoName = randomBytes(32).toString("hex");
|
||||||
|
const extension = options.extension || "mp3";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!ffmpeg.isLoaded()) {
|
if (!ffmpeg.isLoaded()) {
|
||||||
@ -87,15 +88,17 @@ const toMP3 = async (
|
|||||||
await ffmpeg.run(
|
await ffmpeg.run(
|
||||||
"-i",
|
"-i",
|
||||||
safeVideoName,
|
safeVideoName,
|
||||||
...options.ffmpegArgs,
|
...(options.ffmpegArgs || []),
|
||||||
safeVideoName + ".mp3"
|
safeVideoName + "." + extension
|
||||||
);
|
);
|
||||||
|
|
||||||
const folder = options.downloadFolder || downloadsFolder();
|
const folder = options.downloadFolder || downloadsFolder();
|
||||||
const filename = filenamify(videoName + ".mp3", { replacement: "_" });
|
const filename = filenamify(videoName + "." + extension, {
|
||||||
|
replacement: "_",
|
||||||
|
});
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
join(folder, filename),
|
join(folder, filename),
|
||||||
ffmpeg.FS("readFile", safeVideoName + ".mp3")
|
ffmpeg.FS("readFile", safeVideoName + "." + extension)
|
||||||
);
|
);
|
||||||
|
|
||||||
reinit();
|
reinit();
|
||||||
|
|||||||
Reference in New Issue
Block a user