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 702fdb054a0a30f4bbd9e43c211d978d297871e9)
This commit is contained in:
parent
9a577e1c69
commit
71db4eebea
@ -34,11 +34,6 @@ interface Manga : SManga {
|
|||||||
return chapter_flags and CHAPTER_SORT_MASK == CHAPTER_SORT_DESC
|
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 -->
|
// SY -->
|
||||||
fun getOriginalGenres(): List<String>? {
|
fun getOriginalGenres(): List<String>? {
|
||||||
return originalGenre?.split(", ")?.map { it.trim() }
|
return originalGenre?.split(", ")?.map { it.trim() }
|
||||||
|
@ -28,6 +28,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
|
||||||
@ -104,7 +109,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