From 7ba2b1bb410e49c4bb91866a99fe490429c532df Mon Sep 17 00:00:00 2001 From: Alexander Capehart Date: Fri, 12 May 2023 07:01:04 -0600 Subject: [PATCH] music: strip articles from extremely short names Strip articles from names that are longer than 2-4 characters, compared the prior limit of 3-5. Resolves #440. --- app/src/main/java/org/oxycblt/auxio/music/info/Name.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/oxycblt/auxio/music/info/Name.kt b/app/src/main/java/org/oxycblt/auxio/music/info/Name.kt index 3e61cdf6c..3b7c3bfc7 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/info/Name.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/info/Name.kt @@ -183,9 +183,9 @@ private data class IntelligentKnownName(override val raw: String, override val s // Strip any english articles like "the" or "an" from the start, as music // sorting should ignore such when possible. when { - length > 5 && startsWith("the ", ignoreCase = true) -> substring(4) - length > 4 && startsWith("an ", ignoreCase = true) -> substring(3) - length > 3 && startsWith("a ", ignoreCase = true) -> substring(2) + length > 4 && startsWith("the ", ignoreCase = true) -> substring(4) + length > 3 && startsWith("an ", ignoreCase = true) -> substring(3) + length > 2 && startsWith("a ", ignoreCase = true) -> substring(2) else -> this } }