Added a toggle to choose between using Artist property or AlbumArtist property for folder name (#169)

* Corrected function call to correctly download albums vs playlists

* Added setting to prefer AlbumArtist as folder name.
  - In practice, this prevents albums with multiple artists, featured artists, collaborations, or collections like soundtracks, from being split up
  - This is occasionally desirable behavior, so I added it as a toggle rather than a default behavior
This commit is contained in:
TheLittleDoctor
2025-12-18 20:39:03 -05:00
committed by GitHub
parent 965f044e0c
commit 99f3d59ff1
3 changed files with 21 additions and 4 deletions
+12 -3
View File
@@ -50,8 +50,13 @@ export function useDownload() {
// Replace forward slashes in template data values to prevent them from being interpreted as path separators
const placeholder = "__SLASH_PLACEHOLDER__";
// Build template data for folder path
let artistFolderName = artistName;
if(settings.useAlbumArtist) {
artistFolderName = albumArtist || artistName;
}
logger.info("Using artist folder name: " + artistFolderName);
const templateData: TemplateData = {
artist: artistName?.replace(/\//g, placeholder),
artist: artistFolderName?.replace(/\//g, placeholder),
album: albumName?.replace(/\//g, placeholder),
title: trackName?.replace(/\//g, placeholder),
track: position,
@@ -296,11 +301,15 @@ export function useDownload() {
let outputDir = settings.downloadPath;
let useAlbumTrackNumber = false;
let artistFolderName = artistName;
if(settings.useAlbumArtist) {
artistFolderName = albumArtist || artistName;
}
logger.info("Using artist folder name: " + artistFolderName);
// Replace forward slashes in template data values to prevent them from being interpreted as path separators
const placeholder = "__SLASH_PLACEHOLDER__";
const templateData: TemplateData = {
artist: artistName?.replace(/\//g, placeholder),
artist: artistFolderName?.replace(/\//g, placeholder),
album: albumName?.replace(/\//g, placeholder),
title: trackName?.replace(/\//g, placeholder),
track: position,