filter collections in example script

This commit is contained in:
Martchus 2016-03-03 22:21:56 +01:00
parent 95993ebfc9
commit e4a1dc055e
1 changed files with 12 additions and 5 deletions

View File

@ -20,6 +20,8 @@ var includeTitle = true;
var distDir = false; var distDir = false;
// string used for "miscellaneous" category // string used for "miscellaneous" category
var misc = "misc"; var misc = "misc";
// directory used to store collections
var collectionsDir = "collections";
// define some helper functions // define some helper functions
@ -99,8 +101,9 @@ if(tageditor.isFile) {
var fields = []; var fields = [];
// get the artist and remove invalid characters // get the artist and remove invalid characters
var artist = validFileName(tag.artist); var artist = validFileName(tag.artist);
// add artist to the fields array (if configured and present) // add artist to the fields array
if(includeArtist) { // (if configured and present and if it is no collection)
if(includeArtist && tag.comment !== "collection") {
if(notEmpty(artist)) { if(notEmpty(artist)) {
fields.push(artist); fields.push(artist);
} }
@ -169,10 +172,14 @@ if(tageditor.isFile) {
if(distDir) { if(distDir) {
var path = [distDir]; var path = [distDir];
var artist = validDirectoryName(tag.artist); var artist = validDirectoryName(tag.artist);
if(notEmpty(artist)) { if(tag.comment === "collection") {
path.push(artist); path.push(collectionsDir);
} else { } else {
path.push(misc); if(notEmpty(artist)) {
path.push(artist);
} else {
path.push(misc);
}
} }
var album = validDirectoryName(tag.album); var album = validDirectoryName(tag.album);
if(notEmpty(album)) { if(notEmpty(album)) {