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:
@@ -339,7 +339,14 @@ export function SettingsPage() {
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Label htmlFor="use-album-artist" className="cursor-pointer text-sm">Use Album Artist</Label>
|
||||||
|
<Switch
|
||||||
|
id="use-album-artist"
|
||||||
|
checked={tempSettings.useAlbumArtist}
|
||||||
|
onCheckedChange={(checked) => setTempSettings(prev => ({ ...prev, useAlbumArtist: checked }))}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className="border-t" />
|
<div className="border-t" />
|
||||||
|
|
||||||
{/* Filename Format */}
|
{/* Filename Format */}
|
||||||
|
|||||||
@@ -50,8 +50,13 @@ export function useDownload() {
|
|||||||
// Replace forward slashes in template data values to prevent them from being interpreted as path separators
|
// Replace forward slashes in template data values to prevent them from being interpreted as path separators
|
||||||
const placeholder = "__SLASH_PLACEHOLDER__";
|
const placeholder = "__SLASH_PLACEHOLDER__";
|
||||||
// Build template data for folder path
|
// 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 = {
|
const templateData: TemplateData = {
|
||||||
artist: artistName?.replace(/\//g, placeholder),
|
artist: artistFolderName?.replace(/\//g, placeholder),
|
||||||
album: albumName?.replace(/\//g, placeholder),
|
album: albumName?.replace(/\//g, placeholder),
|
||||||
title: trackName?.replace(/\//g, placeholder),
|
title: trackName?.replace(/\//g, placeholder),
|
||||||
track: position,
|
track: position,
|
||||||
@@ -296,11 +301,15 @@ export function useDownload() {
|
|||||||
|
|
||||||
let outputDir = settings.downloadPath;
|
let outputDir = settings.downloadPath;
|
||||||
let useAlbumTrackNumber = false;
|
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
|
// Replace forward slashes in template data values to prevent them from being interpreted as path separators
|
||||||
const placeholder = "__SLASH_PLACEHOLDER__";
|
const placeholder = "__SLASH_PLACEHOLDER__";
|
||||||
const templateData: TemplateData = {
|
const templateData: TemplateData = {
|
||||||
artist: artistName?.replace(/\//g, placeholder),
|
artist: artistFolderName?.replace(/\//g, placeholder),
|
||||||
album: albumName?.replace(/\//g, placeholder),
|
album: albumName?.replace(/\//g, placeholder),
|
||||||
title: trackName?.replace(/\//g, placeholder),
|
title: trackName?.replace(/\//g, placeholder),
|
||||||
track: position,
|
track: position,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export interface Settings {
|
|||||||
filenameTemplate: string;
|
filenameTemplate: string;
|
||||||
// Legacy settings (kept for migration)
|
// Legacy settings (kept for migration)
|
||||||
filenameFormat?: "title-artist" | "artist-title" | "title";
|
filenameFormat?: "title-artist" | "artist-title" | "title";
|
||||||
|
useAlbumArtist?: boolean;
|
||||||
artistSubfolder?: boolean;
|
artistSubfolder?: boolean;
|
||||||
albumSubfolder?: boolean;
|
albumSubfolder?: boolean;
|
||||||
trackNumber: boolean;
|
trackNumber: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user