mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
For library update error log, group errors by error string, and then sort the resulting list by source (#5586)
Format is ``` ! Error # Source - Manga ```
This commit is contained in:
parent
ef41c8d90e
commit
f3f906ebf0
1 changed files with 17 additions and 6 deletions
|
@ -39,6 +39,7 @@ import eu.kanade.tachiyomi.util.chapter.syncChaptersWithTrackServiceTwoWay
|
|||
import eu.kanade.tachiyomi.util.manga.MangaShortcutManager
|
||||
import eu.kanade.tachiyomi.util.shouldDownloadNewChapters
|
||||
import eu.kanade.tachiyomi.util.storage.getUriCompat
|
||||
import eu.kanade.tachiyomi.util.system.createFileInCacheDir
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -532,14 +533,24 @@ class LibraryUpdateService(
|
|||
private fun writeErrorFile(errors: Map<Manga, String?>): File {
|
||||
try {
|
||||
if (errors.isNotEmpty()) {
|
||||
val destFile = File(externalCacheDir, "tachiyomi_update_errors.txt")
|
||||
|
||||
destFile.bufferedWriter().use { out ->
|
||||
errors.forEach { (manga, error) ->
|
||||
out.write("${manga.title}: $error\n")
|
||||
val file = createFileInCacheDir("tachiyomi_update_errors.txt")
|
||||
file.bufferedWriter().use { out ->
|
||||
// Error file format:
|
||||
// ! Error
|
||||
// # Source
|
||||
// - Manga
|
||||
errors.toList().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 destFile
|
||||
return file
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// Empty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue