From 99f3d59ff13d2dcf0aa126122046f175bec2c813 Mon Sep 17 00:00:00 2001 From: TheLittleDoctor <36447611+TheLittleDoc@users.noreply.github.com> Date: Thu, 18 Dec 2025 20:39:03 -0500 Subject: [PATCH] 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 --- frontend/src/components/SettingsPage.tsx | 9 ++++++++- frontend/src/hooks/useDownload.ts | 15 ++++++++++++--- frontend/src/lib/settings.ts | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/SettingsPage.tsx b/frontend/src/components/SettingsPage.tsx index 4eca157..7105263 100644 --- a/frontend/src/components/SettingsPage.tsx +++ b/frontend/src/components/SettingsPage.tsx @@ -339,7 +339,14 @@ export function SettingsPage() {

)} - +
+ + setTempSettings(prev => ({ ...prev, useAlbumArtist: checked }))} + /> +
{/* Filename Format */} diff --git a/frontend/src/hooks/useDownload.ts b/frontend/src/hooks/useDownload.ts index b37c4bb..c05b9a5 100644 --- a/frontend/src/hooks/useDownload.ts +++ b/frontend/src/hooks/useDownload.ts @@ -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, diff --git a/frontend/src/lib/settings.ts b/frontend/src/lib/settings.ts index 02b3d5b..815b2c3 100644 --- a/frontend/src/lib/settings.ts +++ b/frontend/src/lib/settings.ts @@ -21,6 +21,7 @@ export interface Settings { filenameTemplate: string; // Legacy settings (kept for migration) filenameFormat?: "title-artist" | "artist-title" | "title"; + useAlbumArtist?: boolean; artistSubfolder?: boolean; albumSubfolder?: boolean; trackNumber: boolean;