.redownlaod with suffix, isrc variable
This commit is contained in:
@@ -36,6 +36,7 @@ export interface Settings {
|
||||
useFirstArtistOnly: boolean;
|
||||
useSingleGenre: boolean;
|
||||
embedGenre: boolean;
|
||||
redownloadWithSuffix: boolean;
|
||||
separator: "comma" | "semicolon";
|
||||
}
|
||||
export const FOLDER_PRESETS: Record<FolderPreset, {
|
||||
@@ -85,6 +86,7 @@ export const TEMPLATE_VARIABLES = [
|
||||
{ key: "{disc}", description: "Disc number", example: "1" },
|
||||
{ key: "{year}", description: "Release year", example: "2014" },
|
||||
{ key: "{date}", description: "Release date (YYYY-MM-DD)", example: "2014-10-27" },
|
||||
{ key: "{isrc}", description: "Track ISRC", example: "USUM71412345" },
|
||||
];
|
||||
function detectOS(): "Windows" | "linux/MacOS" {
|
||||
const platform = window.navigator.platform.toLowerCase();
|
||||
@@ -124,6 +126,7 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
useFirstArtistOnly: false,
|
||||
useSingleGenre: false,
|
||||
embedGenre: true,
|
||||
redownloadWithSuffix: false,
|
||||
separator: "semicolon"
|
||||
};
|
||||
export const FONT_OPTIONS: {
|
||||
@@ -243,6 +246,9 @@ function getSettingsFromLocalStorage(): Settings {
|
||||
if (!('separator' in parsed)) {
|
||||
parsed.separator = "semicolon";
|
||||
}
|
||||
if (!('redownloadWithSuffix' in parsed)) {
|
||||
parsed.redownloadWithSuffix = false;
|
||||
}
|
||||
return { ...DEFAULT_SETTINGS, ...parsed };
|
||||
}
|
||||
}
|
||||
@@ -346,6 +352,9 @@ export async function loadSettings(): Promise<Settings> {
|
||||
if (!('separator' in parsed)) {
|
||||
parsed.separator = "semicolon";
|
||||
}
|
||||
if (!('redownloadWithSuffix' in parsed)) {
|
||||
parsed.redownloadWithSuffix = false;
|
||||
}
|
||||
cachedSettings = { ...DEFAULT_SETTINGS, ...parsed };
|
||||
return cachedSettings!;
|
||||
}
|
||||
@@ -368,6 +377,7 @@ export interface TemplateData {
|
||||
album?: string;
|
||||
album_artist?: string;
|
||||
title?: string;
|
||||
isrc?: string;
|
||||
track?: number;
|
||||
disc?: number;
|
||||
year?: string;
|
||||
@@ -382,6 +392,7 @@ export function parseTemplate(template: string, data: TemplateData): string {
|
||||
result = result.replace(/\{artist\}/g, data.artist || "Unknown Artist");
|
||||
result = result.replace(/\{album\}/g, data.album || "Unknown Album");
|
||||
result = result.replace(/\{album_artist\}/g, data.album_artist || data.artist || "Unknown Artist");
|
||||
result = result.replace(/\{isrc\}/g, data.isrc || "");
|
||||
result = result.replace(/\{track\}/g, data.track ? String(data.track).padStart(2, "0") : "00");
|
||||
result = result.replace(/\{disc\}/g, data.disc ? String(data.disc) : "1");
|
||||
result = result.replace(/\{year\}/g, data.year || "0000");
|
||||
|
||||
Reference in New Issue
Block a user