From e4a1dc055e3e2fb3c1dd2c4e06e72220961cc8d4 Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 3 Mar 2016 22:21:56 +0100 Subject: [PATCH] filter collections in example script --- resources/scripts/renamefiles/example1.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/resources/scripts/renamefiles/example1.js b/resources/scripts/renamefiles/example1.js index 6c91860..9a663ea 100644 --- a/resources/scripts/renamefiles/example1.js +++ b/resources/scripts/renamefiles/example1.js @@ -20,6 +20,8 @@ var includeTitle = true; var distDir = false; // string used for "miscellaneous" category var misc = "misc"; +// directory used to store collections +var collectionsDir = "collections"; // define some helper functions @@ -99,8 +101,9 @@ if(tageditor.isFile) { var fields = []; // get the artist and remove invalid characters var artist = validFileName(tag.artist); - // add artist to the fields array (if configured and present) - if(includeArtist) { + // add artist to the fields array + // (if configured and present and if it is no collection) + if(includeArtist && tag.comment !== "collection") { if(notEmpty(artist)) { fields.push(artist); } @@ -169,10 +172,14 @@ if(tageditor.isFile) { if(distDir) { var path = [distDir]; var artist = validDirectoryName(tag.artist); - if(notEmpty(artist)) { - path.push(artist); + if(tag.comment === "collection") { + path.push(collectionsDir); } else { - path.push(misc); + if(notEmpty(artist)) { + path.push(artist); + } else { + path.push(misc); + } } var album = validDirectoryName(tag.album); if(notEmpty(album)) {