Include source name in backup restore error logs (closes #4230)

(cherry picked from commit 3bb2102eb46af2ae2c03e505ade2512666b5cc91)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/data/backup/legacy/LegacyBackupRestore.kt
This commit is contained in:
arkon 2021-01-01 16:43:32 -05:00 committed by Jobobby04
parent 7a6a33d5fe
commit 8a8d8f7189
2 changed files with 10 additions and 8 deletions

View File

@ -99,16 +99,17 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier, private val
manga = EXHMigrations.migrateBackupEntry(manga)
// SY <--
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, mergedMangaReferences, flatMetadata, 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

View File

@ -118,16 +118,17 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
manga = EXHMigrations.migrateBackupEntry(manga)
// <-- EXH
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