More guards against edited data

This commit is contained in:
Jobobby04 2025-05-24 20:43:57 -04:00
parent 80e585fa91
commit 95dc82594f
4 changed files with 36 additions and 28 deletions

View File

@ -23,7 +23,7 @@ class GetPagePreviews(
return try { return try {
val pagePreviews = try { val pagePreviews = try {
pagePreviewCache.getPageListFromCache(manga, chapterIds, page) pagePreviewCache.getPageListFromCache(manga, chapterIds, page)
} catch (e: Exception) { } catch (_: Exception) {
source.getPagePreviewList(manga.toSManga(), chapters.map { it.toSChapter() }, page).also { source.getPagePreviewList(manga.toSManga(), chapters.map { it.toSChapter() }, page).also {
pagePreviewCache.putPageListToCache(manga, chapterIds, it) pagePreviewCache.putPageListToCache(manga, chapterIds, it)
} }

View File

@ -38,12 +38,14 @@ fun Manga.chaptersFiltered(): Boolean {
fun Manga.toSManga(): SManga = SManga.create().also { fun Manga.toSManga(): SManga = SManga.create().also {
it.url = url it.url = url
it.title = title // SY -->
it.artist = artist it.title = ogTitle
it.author = author it.artist = ogArtist
it.description = description it.author = ogAuthor
it.genre = genre.orEmpty().joinToString() it.description = ogDescription
it.status = status.toInt() it.genre = ogGenre.orEmpty().joinToString()
it.status = ogStatus.toInt()
//SY <--
it.thumbnail_url = thumbnailUrl it.thumbnail_url = thumbnailUrl
it.initialized = initialized it.initialized = initialized
} }

View File

@ -118,13 +118,15 @@ class MangaBackupCreator(
private fun Manga.toBackupManga(/* SY --> */customMangaInfo: CustomMangaInfo?/* SY <-- */) = private fun Manga.toBackupManga(/* SY --> */customMangaInfo: CustomMangaInfo?/* SY <-- */) =
BackupManga( BackupManga(
url = this.url, url = this.url,
title = this.title, // SY -->
artist = this.artist, title = this.ogTitle,
author = this.author, artist = this.ogArtist,
description = this.description, author = this.ogAuthor,
genre = this.genre.orEmpty(), description = this.ogDescription,
status = this.status.toInt(), genre = this.ogGenre.orEmpty(),
thumbnailUrl = this.thumbnailUrl, status = this.ogStatus.toInt(),
thumbnailUrl = this.ogThumbnailUrl,
// SY <--
favorite = this.favorite, favorite = this.favorite,
source = this.source, source = this.source,
dateAdded = this.dateAdded, dateAdded = this.dateAdded,

View File

@ -139,13 +139,15 @@ class MangaRestorer(
mangasQueries.update( mangasQueries.update(
source = manga.source, source = manga.source,
url = manga.url, url = manga.url,
artist = manga.artist, // SY -->
author = manga.author, artist = manga.ogArtist,
description = manga.description, author = manga.ogAuthor,
genre = manga.genre?.joinToString(separator = ", "), description = manga.ogDescription,
title = manga.title, genre = manga.ogGenre?.joinToString(separator = ", "),
status = manga.status, title = manga.ogTitle,
thumbnailUrl = manga.thumbnailUrl, status = manga.ogStatus,
thumbnailUrl = manga.ogThumbnailUrl,
// SY <--
favorite = manga.favorite, favorite = manga.favorite,
lastUpdate = manga.lastUpdate, lastUpdate = manga.lastUpdate,
nextUpdate = null, nextUpdate = null,
@ -275,13 +277,15 @@ class MangaRestorer(
mangasQueries.insert( mangasQueries.insert(
source = manga.source, source = manga.source,
url = manga.url, url = manga.url,
artist = manga.artist, // SY -->
author = manga.author, artist = manga.ogArtist,
description = manga.description, author = manga.ogAuthor,
genre = manga.genre, description = manga.ogDescription,
title = manga.title, genre = manga.ogGenre,
status = manga.status, title = manga.ogTitle,
thumbnailUrl = manga.thumbnailUrl, status = manga.ogStatus,
thumbnailUrl = manga.ogThumbnailUrl,
// SY <--
favorite = manga.favorite, favorite = manga.favorite,
lastUpdate = manga.lastUpdate, lastUpdate = manga.lastUpdate,
nextUpdate = 0L, nextUpdate = 0L,