Filter out empty genres before saving manga to database (#7655)
(cherry picked from commit4efb736e56) # 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 commit702fdb054a)
This commit is contained in:
@@ -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 ?: "",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user