fix structure
This commit is contained in:
@@ -31,6 +31,12 @@ import { Palette } from "../../styles";
|
||||
import { FONT_FAMILY } from "../../styles/Fonts";
|
||||
import Style, { gutters, size } from "../../styles/Style";
|
||||
import { getArtistDisplayName } from "../../utils/artistName";
|
||||
import {
|
||||
formatStructureLabel,
|
||||
getPromptLabelForStructure,
|
||||
getSegmentMeta,
|
||||
normalizeStructureType,
|
||||
} from "../../utils/songStructure";
|
||||
|
||||
// 20 secondes
|
||||
const timeBeforeIncrement = 20000;
|
||||
@@ -363,6 +369,14 @@ const MusicDetails = ({ route }) => {
|
||||
let type = "section";
|
||||
if (lower.includes("refrain") || lower.includes("chorus")) type = "refrain";
|
||||
else if (lower.includes("couplet") || lower.includes("verse")) type = "couplet";
|
||||
else if (
|
||||
lower.includes("pré") ||
|
||||
lower.includes("prechorus") ||
|
||||
lower.includes("pre-chorus") ||
|
||||
lower.includes("pre chorus") ||
|
||||
lower.includes("pre-refrain")
|
||||
)
|
||||
type = "pre_refrain_instrumental";
|
||||
else if (lower.includes("pont") || lower.includes("bridge")) type = "pont";
|
||||
else if (lower.includes("intro")) type = "intro";
|
||||
const indexMatch = label.match(/(\d+)/);
|
||||
@@ -371,10 +385,14 @@ const MusicDetails = ({ route }) => {
|
||||
};
|
||||
const formatSectionLabel = (type, index, fallback) => {
|
||||
if (fallback) return fallback;
|
||||
if (type === "refrain") return index > 1 ? `Refrain ${index}` : "Refrain";
|
||||
if (type === "couplet") return index > 1 ? `Couplet ${index}` : "Couplet";
|
||||
if (type === "pont") return index > 1 ? `Pont ${index}` : "Pont";
|
||||
if (type === "intro") return "Intro";
|
||||
const normalized = normalizeStructureType(type);
|
||||
const meta = getSegmentMeta(normalized);
|
||||
if (meta) {
|
||||
const label = formatStructureLabel(normalized, index);
|
||||
if (label) return label;
|
||||
}
|
||||
const prompt = getPromptLabelForStructure(normalized);
|
||||
if (prompt) return prompt;
|
||||
return index > 1 ? `Section ${index}` : "Section";
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user