diff --git a/CHANGELOG.md b/CHANGELOG.md index 31c416554..77c220c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ deletion - Fix "format" not appearing in song properties view - Fix visual bugs when editing duplicate songs in the queue +#### What's Changed +- "Ignore articles when sorting" is now "Intelligent sorting" + ## 3.0.3 #### What's New diff --git a/app/src/main/java/org/oxycblt/auxio/music/Music.kt b/app/src/main/java/org/oxycblt/auxio/music/Music.kt index 098aae9d9..93fc7e581 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/Music.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/Music.kt @@ -85,7 +85,7 @@ sealed interface Music : Item { * A unique identifier for a piece of music. * * [UID] enables a much cheaper and more reliable form of differentiating music, derived from - * either a hash of meaningful metadata or the MusicBrainz ID spec. Using this enables several + * either internal app information or the MusicBrainz ID spec. Using this enables several * improvements to music management in this app, including: * - Proper differentiation of identical music. It's common for large, well-tagged libraries to * have functionally duplicate items that are differentiated with MusicBrainz IDs, and so @@ -355,7 +355,7 @@ class SortName(name: String, musicSettings: MusicSettings) : Comparable this } } - } - // Parse out numeric portions of the title and use those for sorting, if applicable. - val numericEnd = sortName.indexOfFirst { !it.isDigit() } - when (numericEnd) { - // No numeric component. - 0 -> number = null - // Whole title is numeric. - -1 -> { - number = sortName.toIntOrNull() - sortName = "" - } - // Part of the title is numeric. - else -> { - number = sortName.slice(0 until numericEnd).toIntOrNull() - sortName = sortName.slice(numericEnd until sortName.length) + // Parse out numeric portions of the title and use those for sorting, if applicable. + when (val numericEnd = sortName.indexOfFirst { !it.isDigit() }) { + // No numeric component. + 0 -> number = null + // Whole title is numeric. + -1 -> { + number = sortName.toIntOrNull() + sortName = "" + } + // Part of the title is numeric. + else -> { + number = sortName.slice(0 until numericEnd).toIntOrNull() + sortName = sortName.slice(numericEnd until sortName.length) + } } + } else { + number = null } collationKey = COLLATOR.getCollationKey(sortName) diff --git a/app/src/main/java/org/oxycblt/auxio/music/MusicSettings.kt b/app/src/main/java/org/oxycblt/auxio/music/MusicSettings.kt index ebd3c8152..adcf337c0 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/MusicSettings.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/MusicSettings.kt @@ -44,8 +44,8 @@ interface MusicSettings : Settings { val shouldBeObserving: Boolean /** A [String] of characters representing the desired characters to denote multi-value tags. */ var multiValueSeparators: String - /** Whether to trim english articles with song sort names. */ - val automaticSortNames: Boolean + /** Whether to enable more advanced sorting by articles and numbers. */ + val intelligentSorting: Boolean // TODO: Move sort settings to list module /** The [Sort] mode used in [Song] lists. */ var songSort: Sort @@ -115,7 +115,7 @@ class MusicSettingsImpl @Inject constructor(@ApplicationContext context: Context } } - override val automaticSortNames: Boolean + override val intelligentSorting: Boolean get() = sharedPreferences.getBoolean(getString(R.string.set_key_auto_sort_names), true) override var songSort: Sort diff --git a/app/src/main/java/org/oxycblt/auxio/music/device/DeviceMusicImpl.kt b/app/src/main/java/org/oxycblt/auxio/music/device/DeviceMusicImpl.kt index 88514313f..a274209e9 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/device/DeviceMusicImpl.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/device/DeviceMusicImpl.kt @@ -483,6 +483,7 @@ class GenreImpl( * @return A new [Music.UID] of Auxio format whose [UUID] was derived from the SHA-256 hash of the * metadata given. */ +@VisibleForTesting fun createHashedUid(mode: MusicMode, updates: MessageDigest.() -> Unit): Music.UID { val digest = MessageDigest.getInstance("SHA-256").run { diff --git a/app/src/main/res/values-be/strings.xml b/app/src/main/res/values-be/strings.xml index bd3c714a2..bc92727aa 100644 --- a/app/src/main/res/values-be/strings.xml +++ b/app/src/main/res/values-be/strings.xml @@ -267,8 +267,8 @@ Прайграванне Канцэртны міні-альбом Міні-альбом рэміксаў - Ігнараваць такія словы, як \"the\", пры сартаванні па імені (лепш за ўсё працуе з англамоўнай музыкай) - Ігнараваць артыклі пры сартаванні + Ігнараваць такія словы, як \"the\", пры сартаванні па імені (лепш за ўсё працуе з англамоўнай музыкай) + Ігнараваць артыклі пры сартаванні Міні-альбомы Міні-альбом \ No newline at end of file diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 27ac859f7..fe32967f3 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -280,6 +280,6 @@ Knihovna Perzistence Sestupně - Při řazení ignorovat předložky - Ignorovat slova jako „the“ při řazení podle názvu (funguje nejlépe u hudby v angličtině) + Při řazení ignorovat předložky + Ignorovat slova jako „the“ při řazení podle názvu (funguje nejlépe u hudby v angličtině) \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f41ce9065..d197759bb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -271,6 +271,6 @@ Persistenz Lautstärkeanpassung ReplayGain Absteigend - Artikel beim Sortieren ignorieren - Wörter wie „the“ ignorieren (funktioniert am besten mit englischsprachiger Musik) + Artikel beim Sortieren ignorieren + Wörter wie „the“ ignorieren (funktioniert am besten mit englischsprachiger Musik) \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 24a9e999f..b51068c59 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -275,6 +275,6 @@ Personalizar los controles y el comportamiento de la interfaz de usuario Biblioteca Descendente - Ignorar artículos al ordenar - Ignorar palabras como \"the\" al ordenar por nombre (funciona mejor con música en inglés) + Ignorar artículos al ordenar + Ignorar palabras como \"the\" al ordenar por nombre (funciona mejor con música en inglés) \ No newline at end of file diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 60f2ec924..6eb011b5d 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -145,7 +145,7 @@ Coma (,) Punto e coma (;) Mostrar só artistas que estean directamente acreditados nun álbum (funciona mellos en bibliotecas ben etiquetadas) - Ignorar artigos ao ordenar + Ignorar artigos ao ordenar Agochar colaboradores Imaxes Portadas de álbums @@ -241,7 +241,7 @@ %d artistas Máis (+) - Ignorar palabras como \"the\" ao ordenar por nome (funciona mellor con música en inglés) + Ignorar palabras como \"the\" ao ordenar por nome (funciona mellor con música en inglés) Modo Xestionar dende onde se carga a música Pausar cando se repite unha canción diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index cd1685236..665e6a720 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -275,6 +275,6 @@ Personalizza controlli e comportamento dell\'UI Configura comportamento di suono e riproduzione Discendente - Ignora gli articoli durante l\'ordinamento - Ignora parole come \"the\" durante l\'ordinamento per nome (funziona meglio con la musica in lingua inglese) + Ignora gli articoli durante l\'ordinamento + Ignora parole come \"the\" durante l\'ordinamento per nome (funziona meglio con la musica in lingua inglese) \ No newline at end of file diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 9765c8d11..cd948d6b6 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -149,7 +149,7 @@ קו נטוי (/) אזהרה: השימוש בהגדרה זו עלול לגרום לחלק מהתגיות להיות מפורשות באופן שגוי כבעלות מספר ערכים. ניתן לפתור זאת על ידי הכנסת קו נטוי אחורי (\\) לפני תווים מפרידים לא רצויים. איכות גבוהה - התעלמ~י ממילים כמו \"The\" (\"ה-\") בעת סידור על פי שם (עובד באופן הכי טוב עם מוזיקה בשפה האנגלית) + התעלמ~י ממילים כמו \"The\" (\"ה-\") בעת סידור על פי שם (עובד באופן הכי טוב עם מוזיקה בשפה האנגלית) תמונות התאמ~י התנהגות צליל והשמעה התחל~י לנגן תמיד ברגע שמחוברות אוזניות (עלול לא לעבוד בכל המערכות) diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 46b54ec6a..1b8dfa355 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -242,8 +242,8 @@ モード 複数のタグ値を表す文字を構成する カスタム再生バー アクション - ソート時に記事を無視する - 名前で並べ替えるときに「the」などの単語を無視する (英語の音楽に最適) + ソート時に記事を無視する + 名前で並べ替えるときに「the」などの単語を無視する (英語の音楽に最適) 初期 (高速読み込み) 再生中の場合はアルバムを優先 複数値セパレータ diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 1efbda080..eeab53168 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -271,6 +271,6 @@ 동작 UI 제어 및 동작 커스텀 내림차순 - 정렬할 때 기사 무시 - 이름으로 정렬할 때 \"the\"와 같은 단어 무시(영어 음악에서 가장 잘 작동함) + 정렬할 때 기사 무시 + 이름으로 정렬할 때 \"the\"와 같은 단어 무시(영어 음악에서 가장 잘 작동함) \ No newline at end of file diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index d5ca38980..6bf884ce2 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -269,6 +269,6 @@ Aplankalai Atkaklumas Mažėjantis - Ignoruoti tokius žodžius kaip „the“, kai rūšiuojama pagal pavadinimą (geriausiai veikia su anglų kalbos muzika) - Ignoruoti straipsnius rūšiuojant + Ignoruoti tokius žodžius kaip „the“, kai rūšiuojama pagal pavadinimą (geriausiai veikia su anglų kalbos muzika) + Ignoruoti straipsnius rūšiuojant \ No newline at end of file diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index b8180e778..b06a4b65f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -276,6 +276,6 @@ Nie można wyczyścić stanu odtwarzania Nie można zapisać stanu odtwarzania Malejąco - Ignoruj rodzajniki podczas sortowania - Ignoruj słowa takie jak „the” podczas sortowania według tytułu (działa najlepiej z tytułami w języku angielskim) + Ignoruj rodzajniki podczas sortowania + Ignoruj słowa takie jak „the” podczas sortowania według tytułu (działa najlepiej z tytułami w języku angielskim) \ No newline at end of file diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index b834f707c..39f7febb4 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -273,6 +273,6 @@ Comportamento Pastas Descendente - Ignorar artigos ao classificar - Ignore palavras como \"the\" ao classificar por nome (funciona melhor com músicas em inglês) + Ignorar artigos ao classificar + Ignore palavras como \"the\" ao classificar por nome (funciona melhor com músicas em inglês) \ No newline at end of file diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index e4e4f7a32..3e7f7a265 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -273,6 +273,6 @@ Estado de reprodução E comercial (&) Comportamento - Ignorar artigos ao classificar - Ignore palavras como \"the\" ao classificar por nome (funciona melhor com músicas em inglês) + Ignorar artigos ao classificar + Ignore palavras como \"the\" ao classificar por nome (funciona melhor com músicas em inglês) \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 25e11e3f7..bfc33bc2f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -278,6 +278,6 @@ Папки Состояние воспроизведения По убыванию - Игнорировать артикли при сортировке - Игнорировать такие слова, как «the», при сортировке по имени (лучше всего работает с англоязычной музыкой) + Игнорировать артикли при сортировке + Игнорировать такие слова, как «the», при сортировке по имени (лучше всего работает с англоязычной музыкой) \ No newline at end of file diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 3581a3142..a05a0adfd 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -269,6 +269,6 @@ Arayüz kontrollerini ve davranışını özelleştirin Davranış Ses yüksekliği dengesi ReplayGain - Sıralama yaparken makaleleri yoksay - Ada göre sıralarken \"the\" gibi kelimeleri yok sayın (en iyi ingilizce müzikle çalışır) + Sıralama yaparken makaleleri yoksay + Ada göre sıralarken \"the\" gibi kelimeleri yok sayın (en iyi ingilizce müzikle çalışır) \ No newline at end of file diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index c571b19c4..f15b96f58 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -275,6 +275,6 @@ Налаштування звуку і поведінки при відтворенні Папки За спаданням - Ігнорувати артиклі під час сортування - Ігнорування таких слів, як \"the\", під час сортування за назвою (найкраще працює з англомовною музикою) + Ігнорувати артиклі під час сортування + Ігнорування таких слів, як \"the\", під час сортування за назвою (найкраще працює з англомовною музикою) \ No newline at end of file diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index dfb1bf0aa..faa26ddf0 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -269,6 +269,6 @@ 音乐 配置声音和播放行为 降序 - 排序时忽略冠词 - 按名称排序时忽略类似“the”这样的冠词(对英文歌曲的效果最好) + 排序时忽略冠词 + 按名称排序时忽略类似“the”这样的冠词(对英文歌曲的效果最好) \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 363bbad06..d37d2ab0a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -216,8 +216,8 @@ Plus (+) Ampersand (&) Warning: Using this setting may result in some tags being incorrectly interpreted as having multiple values. You can resolve this by prefixing unwanted separator characters with a backslash (\\). - Ignore articles when sorting - Ignore words like \"the\" when sorting by name (works best with english-language music) + Intelligent sorting + Correctly sort names that begin with numbers or words like \"the\" (works best with english-language music) Hide collaborators Only show artists that are directly credited on an album (works best on well-tagged libraries) Images diff --git a/app/src/main/res/xml/preferences_music.xml b/app/src/main/res/xml/preferences_music.xml index decbc4090..a46bb1025 100644 --- a/app/src/main/res/xml/preferences_music.xml +++ b/app/src/main/res/xml/preferences_music.xml @@ -23,8 +23,8 @@ + app:summary="@string/set_intelligent_sorting_desc" + app:title="@string/set_intelligent_sorting" />