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
This commit is contained in:
parent
4b87831bdd
commit
702fdb054a
@ -32,11 +32,6 @@ interface Manga : SManga {
|
|||||||
return chapter_flags and DomainManga.CHAPTER_SORT_DIR_MASK.toInt() == DomainManga.CHAPTER_SORT_DESC.toInt()
|
return chapter_flags and DomainManga.CHAPTER_SORT_DIR_MASK.toInt() == DomainManga.CHAPTER_SORT_DESC.toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getGenres(): List<String>? {
|
|
||||||
if (genre.isNullOrBlank()) return null
|
|
||||||
return genre?.split(", ")?.map { it.trim() }?.filterNot { it.isBlank() }?.distinct()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
fun getOriginalGenres(): List<String>? {
|
fun getOriginalGenres(): List<String>? {
|
||||||
return originalGenre?.split(", ")?.map { it.trim() }
|
return originalGenre?.split(", ")?.map { it.trim() }
|
||||||
|
@ -29,6 +29,11 @@ interface SManga : Serializable {
|
|||||||
|
|
||||||
var initialized: Boolean
|
var initialized: Boolean
|
||||||
|
|
||||||
|
fun getGenres(): List<String>? {
|
||||||
|
if (genre.isNullOrBlank()) return null
|
||||||
|
return genre?.split(", ")?.map { it.trim() }?.filterNot { it.isBlank() }?.distinct()
|
||||||
|
}
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
val originalTitle: String
|
val originalTitle: String
|
||||||
get() = (this as? MangaImpl)?.ogTitle ?: title
|
get() = (this as? MangaImpl)?.ogTitle ?: title
|
||||||
@ -144,7 +149,7 @@ fun SManga.toMangaInfo(): MangaInfo {
|
|||||||
artist = this.artist ?: "",
|
artist = this.artist ?: "",
|
||||||
author = this.author ?: "",
|
author = this.author ?: "",
|
||||||
description = this.description ?: "",
|
description = this.description ?: "",
|
||||||
genres = this.genre?.split(", ") ?: emptyList(),
|
genres = this.getGenres() ?: emptyList(),
|
||||||
status = this.status,
|
status = this.status,
|
||||||
cover = this.thumbnail_url ?: "",
|
cover = this.thumbnail_url ?: "",
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user