From 8bd965267ce3adfadd201cc4ea24e84a9f92e590 Mon Sep 17 00:00:00 2001 From: FlaminSarge Date: Tue, 20 Jul 2021 14:36:24 -0700 Subject: [PATCH] For library update error log, group errors by error string, and then sort the resulting list by source (#5586) Format is ``` ! Error # Source - Manga ``` --- .../data/library/LibraryUpdateService.kt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index a6f9c410c..2e4f19f23 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -511,9 +511,19 @@ class LibraryUpdateService( if (errors.isNotEmpty()) { val file = createFileInCacheDir("tachiyomi_update_errors.txt") file.bufferedWriter().use { out -> - errors.forEach { (manga, error) -> - val source = sourceManager.getOrStub(manga.source) - out.write("${manga.title} ($source): $error\n") + // Error file format: + // ! Error + // # Source + // - Manga + errors.groupBy({ it.second }, { it.first }).forEach { (error, mangas) -> + out.write("! ${error}\n") + mangas.groupBy { it.source }.forEach { (srcId, mangas) -> + val source = sourceManager.getOrStub(srcId) + out.write(" # $source\n") + mangas.forEach { + out.write(" - ${it.title}\n") + } + } } } return file