From 3bb2102eb46af2ae2c03e505ade2512666b5cc91 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 1 Jan 2021 16:43:32 -0500 Subject: [PATCH] Include source name in backup restore error logs (closes #4230) --- .../tachiyomi/data/backup/full/FullBackupRestore.kt | 9 +++++---- .../tachiyomi/data/backup/legacy/LegacyBackupRestore.kt | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupRestore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupRestore.kt index 405d8b233..3e6ad2077 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupRestore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupRestore.kt @@ -67,16 +67,17 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier, private val val history = backupManga.history val tracks = backupManga.getTrackingImpl() + val source = backupManager.sourceManager.get(manga.source) + val sourceName = sourceMapping[manga.source] ?: manga.source.toString() + try { - val source = backupManager.sourceManager.get(manga.source) if (source != null || !online) { restoreMangaData(manga, source, chapters, categories, history, tracks, backupCategories, online) } else { - val sourceName = sourceMapping[manga.source] ?: manga.source.toString() - errors.add(Date() to "${manga.title} - ${context.getString(R.string.source_not_found_name, sourceName)}") + errors.add(Date() to "${manga.title} [$sourceName]: ${context.getString(R.string.source_not_found_name, sourceName)}") } } catch (e: Exception) { - errors.add(Date() to "${manga.title} - ${e.message}") + errors.add(Date() to "${manga.title} [$sourceName]: ${e.message}") } restoreProgress += 1 diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/legacy/LegacyBackupRestore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/legacy/LegacyBackupRestore.kt index 8ba6e83c3..e0e448f6f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/legacy/LegacyBackupRestore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/legacy/LegacyBackupRestore.kt @@ -86,16 +86,17 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract ?: JsonArray() ) + val source = backupManager.sourceManager.get(manga.source) + val sourceName = sourceMapping[manga.source] ?: manga.source.toString() + try { - val source = backupManager.sourceManager.get(manga.source) if (source != null) { restoreMangaData(manga, source, chapters, categories, history, tracks) } else { - val sourceName = sourceMapping[manga.source] ?: manga.source.toString() - errors.add(Date() to "${manga.title} - ${context.getString(R.string.source_not_found_name, sourceName)}") + errors.add(Date() to "${manga.title} [$sourceName]: ${context.getString(R.string.source_not_found_name, sourceName)}") } } catch (e: Exception) { - errors.add(Date() to "${manga.title} - ${e.message}") + errors.add(Date() to "${manga.title} [$sourceName]: ${e.message}") } restoreProgress += 1