Update non-library manga data when browsing (#1967)

This commit is contained in:
AntsyLich
2025-04-07 12:10:12 +06:00
committed by GitHub
parent 2259164fde
commit a594ad392d
4 changed files with 16 additions and 3 deletions

View File

@ -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))

View File

@ -141,6 +141,9 @@ class MangaRepositoryImpl(
dateAdded = it.dateAdded, dateAdded = it.dateAdded,
updateStrategy = it.updateStrategy, updateStrategy = it.updateStrategy,
version = it.version, version = it.version,
updateTitle = it.title.isNotBlank(),
updateCover = !it.thumbnailUrl.isNullOrBlank(),
updateDetails = it.initialized,
mapper = MangaMapper::mapManga, mapper = MangaMapper::mapManga,
) )
.executeAsOne() .executeAsOne()

View File

@ -196,9 +196,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;

View File

@ -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> {