Filter out empty genres before saving manga to database (#7655)
(cherry picked from commit 4efb736e56dd1e9f6438502dac915467f5b64f03)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt
# app/src/main/java/eu/kanade/tachiyomi/source/model/SManga.kt
(cherry picked from commit 702fdb054a)
This commit is contained in:
parent
9a577e1c69
commit
71db4eebea
2 changed files with 6 additions and 6 deletions
|
|
@ -34,11 +34,6 @@ interface Manga : SManga {
|
|||
return chapter_flags and CHAPTER_SORT_MASK == CHAPTER_SORT_DESC
|
||||
}
|
||||
|
||||
fun getGenres(): List<String>? {
|
||||
if (genre.isNullOrBlank()) return null
|
||||
return genre?.split(", ")?.map { it.trim() }?.filterNot { it.isBlank() }?.distinct()
|
||||
}
|
||||
|
||||
// SY -->
|
||||
fun getOriginalGenres(): List<String>? {
|
||||
return originalGenre?.split(", ")?.map { it.trim() }
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ interface SManga : Serializable {
|
|||
|
||||
var initialized: Boolean
|
||||
|
||||
fun getGenres(): List<String>? {
|
||||
if (genre.isNullOrBlank()) return null
|
||||
return genre?.split(", ")?.map { it.trim() }?.filterNot { it.isBlank() }?.distinct()
|
||||
}
|
||||
|
||||
// SY -->
|
||||
val originalTitle: String
|
||||
get() = (this as? MangaImpl)?.ogTitle ?: title
|
||||
|
|
@ -104,7 +109,7 @@ fun SManga.toMangaInfo(): MangaInfo {
|
|||
artist = this.artist ?: "",
|
||||
author = this.author ?: "",
|
||||
description = this.description ?: "",
|
||||
genres = this.genre?.split(", ") ?: emptyList(),
|
||||
genres = this.getGenres() ?: emptyList(),
|
||||
status = this.status,
|
||||
cover = this.thumbnail_url ?: "",
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue