From e6344a704d04547a3da6a893d2cb95e6dd21b374 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 19 May 2025 09:38:06 +0200 Subject: [PATCH] music title cleaning: only clean brackets at start --- .../modules/common/functions/string_utils.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.config/quickshell/modules/common/functions/string_utils.js b/.config/quickshell/modules/common/functions/string_utils.js index 117b68f8e..6becbc265 100644 --- a/.config/quickshell/modules/common/functions/string_utils.js +++ b/.config/quickshell/modules/common/functions/string_utils.js @@ -113,14 +113,14 @@ function wordWrap(str, maxLen) { function cleanMusicTitle(title) { if (!title) return ""; // Brackets - title = title.replace(/ *\([^)]*\) */g, " "); // Round brackets - title = title.replace(/ *\[[^\]]*\] */g, " "); // Square brackets - title = title.replace(/ *\{[^\}]*\} */g, " "); // Curly brackets + title = title.replace(/^ *\([^)]*\) */g, " "); // Round brackets + title = title.replace(/^ *\[[^\]]*\] */g, " "); // Square brackets + title = title.replace(/^ *\{[^\}]*\} */g, " "); // Curly brackets // Japenis brackets - title = title.replace(/【[^】]*】/, "") // Touhou - title = title.replace(/《[^》]*》/, "") // ?? - title = title.replace(/「[^」]*」/, "") // OP/ED - title = title.replace(/『[^』]*』/, "") // OP/ED + title = title.replace(/^ *【[^】]*】/, "") // Touhou + title = title.replace(/^ *《[^》]*》/, "") // ?? + title = title.replace(/^ *「[^」]*」/, "") // OP/ED + title = title.replace(/^ *『[^』]*』/, "") // OP/ED return title; }