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
|
#!/usr/bin/env node
|
||||||
import ytdl from 'ytdl-core';
|
import ytdl from 'ytdl-core';
|
||||||
import getArtistTitle from 'get-artist-title';
|
import fs from 'fs';
|
||||||
import { generate } from './src/cue.js';
|
import { generate } from './src/cue.js';
|
||||||
import minimist from 'minimist';
|
import minimist from 'minimist';
|
||||||
import exit from 'process';
|
|
||||||
import updateNotifier from 'update-notifier';
|
import updateNotifier from 'update-notifier';
|
||||||
import pkg from './src/package.js';
|
import pkg from './src/package.js';
|
||||||
import { processFile, processYoutube } from './src/process.js';
|
import { processFile, processYoutube } from './src/process.js';
|
||||||
|
@ -59,12 +58,21 @@ if (argv.version) {
|
||||||
"output.cue" saved`);
|
"output.cue" saved`);
|
||||||
} else {
|
} else {
|
||||||
let urlOrFile = argv._[0];
|
let urlOrFile = argv._[0];
|
||||||
|
let r;
|
||||||
|
|
||||||
if (fs.existsSync(urlOrFile)) {
|
if (fs.existsSync(urlOrFile)) {
|
||||||
let r = processFile(urlOrFile, argv);
|
r = processFile(urlOrFile, argv);
|
||||||
} else {
|
} else {
|
||||||
let r = processYoutube(urlOrFile, argv);
|
r = await processYoutube(urlOrFile, argv);
|
||||||
}
|
}
|
||||||
generate({ r.tracks, r.artist, r.audioFile, r.album }, r.outputFile);
|
generate(
|
||||||
console.log(`"${outputFile}" saved`);
|
{
|
||||||
|
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 fs from 'fs';
|
||||||
import { parse } from './parser.js';
|
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_AUDIO_FILE = 'audio.m4a';
|
||||||
const DEFAULT_ARTIST = 'Unknown Artist';
|
const DEFAULT_ARTIST = 'Unknown Artist';
|
||||||
|
|
Loading…
Reference in New Issue