Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (program.watch === true || program.suites === true || program.tests === true) {
process.stderr.write(chalk.red("Error: This feature is not currently implemented"));
return;
}
process.stdout.write(summaryStr);
// console.log(program);
var done = function() {
process.stdout.write("\n### DONE ###");
};
var outPath = program.out ? program.out : "/dev/stdout";
if (program.out) resultStr = resultStr.replace(/\[\d+m/g, "");
if (program.json === true) {
rw.writeFileSync(outPath, JSON.stringify(results), "utf-8");
done();
return;
}
if (program.jsonPretty === true) {
rw.writeFileSync(outPath, JSON.stringify(results, null, 2), "utf-8");
done();
return;
}
if (program.summary !== true) {
rw.writeFileSync(outPath, resultStr, "utf-8");
done();
return;
}
} else {
process.stderr.write(
chalk.red("Error: Must use a supported filetype. Currently supported filetypes: " + allowFileExtensions.join(", "), "utf-8")
.then(function(data) {
console.log('Writing to', OUTPUT_FILE);
rw.writeFileSync(OUTPUT_FILE, JSON.stringify(data, undefined, 2), 'utf8')
console.log('Writing to', OUTPUT_4WHOSAMPLED_FILE);
rw.writeFileSync(OUTPUT_4WHOSAMPLED_FILE, csv4Whosampled(data), 'utf8')
})
.catch(function(err) {
.then(function(data) {
console.log('Writing to', OUTPUT_FILE);
rw.writeFileSync(OUTPUT_FILE, JSON.stringify(data, undefined, 2), 'utf8')
console.log('Writing to', OUTPUT_4WHOSAMPLED_FILE);
rw.writeFileSync(OUTPUT_4WHOSAMPLED_FILE, csv4Whosampled(data), 'utf8')
})
.catch(function(err) {
.then(function(data) {
console.log('Writing to', OUTPUT_FILE);
genreStats(data);
spotifyStats(data);
rw.writeFileSync(OUTPUT_FILE, JSON.stringify(data, undefined, 2), 'utf8')
})
.catch(function(err) {
var id = trackDatum.spotify.id;
if (!existingIds[id]) {
existingIds[id] = trackDatum;
vMemo.push(trackDatum);
} else {
console.log("Warning: two versions with the same spotify id. Keeping the version dated:", existingIds[id].date, "instead of the one dated:", trackDatum.date);
}
} else {
vMemo.push(trackDatum);
}
return vMemo;
}, []);
});
console.log('Writing to', OUTPUT_FILE);
rw.writeFileSync(OUTPUT_FILE, JSON.stringify(data, undefined, 2), 'utf8')
});
var songMM = _.first(utils.getIn(musixmatchData, ['response', 'songs']));
if (songMM) {
var track = _.first(utils.getIn(songMM, ['tracks']));
var matchesMM = utils.getIn(track, ['foreign_id']).match(/^musixmatch-WW:track:(\d*)/);
if (matchesMM) {
var musixmatch = matchesMM[1];
_.extend(echonest, {musixmatch: musixmatch});
}
}
if (analysisData) {
//_.extend(echonest, { analysis: analysisData.segments });
var fname = ANALYSIS_OUT + '/' + version.spotify.id + '.json';
console.log('Writing to', fname);
rw.writeFileSync(fname, JSON.stringify(analysisData), 'utf8')
}
_.extend(version, { echonest: echonest });
callback(null, version);
})
.catch(callback);
q.awaitAll(function(error, samplesData) {
if (error) {
console.log("error: ", error);
} else {
rw.writeFileSync(OUTPUT_FILE, JSON.stringify(samplesData, undefined, 2), 'utf8');
}
})
files.forEach((file) => {
if (file.match(/.min.json/i) !== null) return;
rw.writeFileSync(file.replace(/.json/i, '.min.json'),
JSON.stringify(JSON.parse(rw.readFileSync(file)), replacer, 0)
);
});
var outPath = program.out ? program.out : "/dev/stdout";
if (program.out) resultStr = resultStr.replace(/\[\d+m/g, "");
if (program.json === true) {
rw.writeFileSync(outPath, JSON.stringify(results), "utf-8");
done();
return;
}
if (program.jsonPretty === true) {
rw.writeFileSync(outPath, JSON.stringify(results, null, 2), "utf-8");
done();
return;
}
if (program.summary !== true) {
rw.writeFileSync(outPath, resultStr, "utf-8");
done();
return;
}
} else {
process.stderr.write(
chalk.red("Error: Must use a supported filetype. Currently supported filetypes: " + allowFileExtensions.join(", "), "utf-8")
);
}
}
.then(function(d) {
rw.writeFileSync(fname, d, 'utf8');
resolve(d);
})
.catch(function(err) {