Skip to content

Commit

Permalink
fix: series genre is not imported from metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
gotson committed Aug 27, 2020
1 parent f4451bf commit d0815dd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data class SeriesMetadataPatch(
val publisher: String?,
val ageRating: Int?,
val language: String?,
val genres: Set<String>,
val genres: Set<String>?,

val collections: List<String>
)
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class MetadataLifecycle(
title = patches.mostFrequent { it.title },
titleSort = patches.mostFrequent { it.titleSort },
status = patches.mostFrequent { it.status },
genres = patches.flatMap { it.genres }.toSet(),
genres = patches.mapNotNull { it.genres }.flatten().toSet(),
language = patches.mostFrequent { it.language },
summary = null,
readingDirection = patches.mostFrequent { it.readingDirection },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ComicInfoProvider(
else -> null
}

val genres = comicInfo.genre?.split(',')?.map { it.trim() }?.toSet() ?: emptySet()
val genres = comicInfo.genre?.split(',')?.map { it.trim() }?.toSet()

return SeriesMetadataPatch(
title = comicInfo.series,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class EpubMetadataProvider(
publisher = publisher,
ageRating = null,
summary = null,
language = if(language != null && BCP47TagValidator.isValid(language)) language else null,
genres = if(genre != null) setOf(genre) else emptySet(),
language = if (language != null && BCP47TagValidator.isValid(language)) language else null,
genres = genre?.let { setOf(genre) },
collections = emptyList()
)
}
Expand Down

0 comments on commit d0815dd

Please sign in to comment.