From 96fcf425b04a990195e5592fca3d2708c451b777 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sun, 21 May 2023 20:44:33 -0500 Subject: [PATCH] fix: Sanitization doesn't squash single hyphens --- src/structs.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/structs.rs b/src/structs.rs index 4766936..4ec4af5 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -49,10 +49,14 @@ impl MovieEntry { } else { format = format.replace("{director}", ""); } + + // Try to clean extra spaces and such + format = format.trim_matches(|c| "- ".contains(c)).to_string(); + while format.contains("- -") { + format = format.replace("- -", "-"); + } + format - .trim_matches(|c| "- ".contains(c)) - .replace("--", "-") - .replace("- ", "") } }