Fix: duplicate album name in collections

This commit is contained in:
Lynn Smeria 2020-04-18 13:14:40 +03:00
parent d133ea8844
commit 81d4076ec6
1 changed files with 6 additions and 5 deletions

View File

@ -21,7 +21,10 @@ const collect = (tracks, callback) => {
* Returns the first defined metadata at the specified path.
*/
const find = (tracks, path) =>
_.get(tracks.find(track => !_.isNil(_.get(track, path))), path);
_.get(
tracks.find(track => !_.isNil(_.get(track, path))),
path
);
/**
* Parses a date and returns it in the form of `year-month-day`.
@ -96,9 +99,7 @@ module.exports = {
const albumCollectionRoot = path.resolve(root, '_albums');
await fs.ensureDir(albumCollectionRoot);
debug(
`generating release info for album '${baseName}' with ${
tracks.length
} track(s)`
`generating release info for album '${baseName}' with ${tracks.length} track(s)`
);
const albumInfo = getAlbumInfo(albumRoot, tracks);
const releaseInfo = `---\n${toYaml(albumInfo)}---\n`;
@ -114,7 +115,7 @@ module.exports = {
const trackInfoPath = path.resolve(
trackCollectionRoot,
baseName,
`${track.slug}.md`
`${track.trackSlug}.md`
);
await fs.ensureFile(trackInfoPath);
await fs.writeFile(trackInfoPath, `---\n${toYaml(track)}---\n`);