mirror of
https://github.com/captn3m0/youtube-cue.git
synced 2024-09-11 16:46:35 +00:00
Fix writing to output CUE file
This commit is contained in:
parent
085913ad69
commit
9afcccd9c3
20
index.js
20
index.js
@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
import ytdl from 'ytdl-core';
|
||||
import getArtistTitle from 'get-artist-title';
|
||||
import fs from 'fs';
|
||||
import { generate } from './src/cue.js';
|
||||
import minimist from 'minimist';
|
||||
import exit from 'process';
|
||||
import updateNotifier from 'update-notifier';
|
||||
import pkg from './src/package.js';
|
||||
import { processFile, processYoutube } from './src/process.js';
|
||||
@ -59,12 +58,21 @@ if (argv.version) {
|
||||
"output.cue" saved`);
|
||||
} else {
|
||||
let urlOrFile = argv._[0];
|
||||
let r;
|
||||
|
||||
if (fs.existsSync(urlOrFile)) {
|
||||
let r = processFile(urlOrFile, argv);
|
||||
r = processFile(urlOrFile, argv);
|
||||
} else {
|
||||
let r = processYoutube(urlOrFile, argv);
|
||||
r = await processYoutube(urlOrFile, argv);
|
||||
}
|
||||
generate({ r.tracks, r.artist, r.audioFile, r.album }, r.outputFile);
|
||||
console.log(`"${outputFile}" saved`);
|
||||
generate(
|
||||
{
|
||||
tracks: r.tracks,
|
||||
artist: r.artist,
|
||||
audioFile: r.audioFile,
|
||||
album: r.album,
|
||||
},
|
||||
r.outputFile
|
||||
);
|
||||
console.log(`"${r.outputFile}" saved`);
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
import fs from 'fs';
|
||||
import { parse } from './parser.js';
|
||||
import getArtistTitle from 'get-artist-title';
|
||||
import ytdl from 'ytdl-core';
|
||||
import exit from 'process';
|
||||
|
||||
const DEFAULT_AUDIO_FILE = 'audio.m4a';
|
||||
const DEFAULT_ARTIST = 'Unknown Artist';
|
||||
|
Loading…
Reference in New Issue
Block a user