Update non-library manga data when browsing (mihonapp/mihon#1967)
(cherry picked from commit a594ad392d4793f3a5cb2b709d29b2feab6120d3)
This commit is contained in:
parent
fa7b18590e
commit
5da873cac1
4 changed files with 27 additions and 10 deletions
|
|
@ -21,6 +21,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
||||||
### Improved
|
### Improved
|
||||||
- Significantly improve browsing speed (near instantaneous) ([@AntsyLich](https://github.com/AntsyLich)) ([#1946](https://github.com/mihonapp/mihon/pull/1946))
|
- Significantly improve browsing speed (near instantaneous) ([@AntsyLich](https://github.com/AntsyLich)) ([#1946](https://github.com/mihonapp/mihon/pull/1946))
|
||||||
- Deduplicate entries when browsing ([@AntsyLich](https://github.com/AntsyLich)) ([#1957](https://github.com/mihonapp/mihon/pull/1957))
|
- Deduplicate entries when browsing ([@AntsyLich](https://github.com/AntsyLich)) ([#1957](https://github.com/mihonapp/mihon/pull/1957))
|
||||||
|
- Update non-library manga data when browsing ([@AntsyLich](https://github.com/AntsyLich)) ([#1967](https://github.com/mihonapp/mihon/pull/1967))
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Display all similarly named duplicates in duplicate manga dialogue ([@NarwhalHorns](https://github.com/NarwhalHorns), [@AntsyLich](https://github.com/AntsyLich)) ([#1861](https://github.com/mihonapp/mihon/pull/1861))
|
- Display all similarly named duplicates in duplicate manga dialogue ([@NarwhalHorns](https://github.com/NarwhalHorns), [@AntsyLich](https://github.com/AntsyLich)) ([#1861](https://github.com/mihonapp/mihon/pull/1861))
|
||||||
|
|
|
||||||
|
|
@ -123,13 +123,15 @@ class MangaRepositoryImpl(
|
||||||
mangasQueries.insertNetworkManga(
|
mangasQueries.insertNetworkManga(
|
||||||
source = it.source,
|
source = it.source,
|
||||||
url = it.url,
|
url = it.url,
|
||||||
artist = it.artist,
|
// SY -->
|
||||||
author = it.author,
|
title = it.ogTitle,
|
||||||
description = it.description,
|
artist = it.ogArtist,
|
||||||
genre = it.genre,
|
author = it.ogAuthor,
|
||||||
title = it.title,
|
thumbnailUrl = it.ogThumbnailUrl,
|
||||||
status = it.status,
|
description = it.ogDescription,
|
||||||
thumbnailUrl = it.thumbnailUrl,
|
genre = it.ogGenre,
|
||||||
|
status = it.ogStatus,
|
||||||
|
// SY <--
|
||||||
favorite = it.favorite,
|
favorite = it.favorite,
|
||||||
lastUpdate = it.lastUpdate,
|
lastUpdate = it.lastUpdate,
|
||||||
nextUpdate = it.nextUpdate,
|
nextUpdate = it.nextUpdate,
|
||||||
|
|
@ -141,6 +143,11 @@ class MangaRepositoryImpl(
|
||||||
dateAdded = it.dateAdded,
|
dateAdded = it.dateAdded,
|
||||||
updateStrategy = it.updateStrategy,
|
updateStrategy = it.updateStrategy,
|
||||||
version = it.version,
|
version = it.version,
|
||||||
|
// SY -->
|
||||||
|
updateTitle = it.ogTitle.isNotBlank(),
|
||||||
|
updateCover = !it.ogThumbnailUrl.isNullOrBlank(),
|
||||||
|
// SY <--
|
||||||
|
updateDetails = it.initialized,
|
||||||
mapper = MangaMapper::mapManga,
|
mapper = MangaMapper::mapManga,
|
||||||
)
|
)
|
||||||
.executeAsOne()
|
.executeAsOne()
|
||||||
|
|
|
||||||
|
|
@ -208,9 +208,18 @@ insertNetworkManga {
|
||||||
:updateStrategy, :calculateInterval, 0, :version
|
:updateStrategy, :calculateInterval, 0, :version
|
||||||
WHERE NOT EXISTS(SELECT 0 FROM mangas WHERE source = :source AND url = :url);
|
WHERE NOT EXISTS(SELECT 0 FROM mangas WHERE source = :source AND url = :url);
|
||||||
|
|
||||||
-- Update the title if it is not favorite
|
-- Update the relevant details if applicable and not favorite
|
||||||
UPDATE mangas
|
UPDATE mangas
|
||||||
SET title = :title
|
SET
|
||||||
|
title = CASE WHEN :updateTitle THEN :title ELSE title END,
|
||||||
|
thumbnail_url = CASE WHEN :updateCover THEN :thumbnailUrl ELSE thumbnail_url END,
|
||||||
|
author = CASE WHEN :updateDetails THEN :author ELSE author END,
|
||||||
|
artist = CASE WHEN :updateDetails THEN :artist ELSE artist END,
|
||||||
|
description = CASE WHEN :updateDetails THEN :description ELSE description END,
|
||||||
|
genre = CASE WHEN :updateDetails THEN :genre ELSE genre END,
|
||||||
|
status = CASE WHEN :updateDetails THEN :status ELSE status END,
|
||||||
|
update_strategy = CASE WHEN :updateDetails THEN :updateStrategy ELSE update_strategy END,
|
||||||
|
initialized = :updateDetails
|
||||||
WHERE source = :source
|
WHERE source = :source
|
||||||
AND url = :url
|
AND url = :url
|
||||||
AND favorite = 0;
|
AND favorite = 0;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class NetworkToLocalManga(
|
||||||
) {
|
) {
|
||||||
|
|
||||||
suspend operator fun invoke(manga: Manga): Manga {
|
suspend operator fun invoke(manga: Manga): Manga {
|
||||||
return mangaRepository.insertNetworkManga(listOf(manga)).single()
|
return invoke(listOf(manga)).single()
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend operator fun invoke(manga: List<Manga>): List<Manga> {
|
suspend operator fun invoke(manga: List<Manga>): List<Manga> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue