Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #196 from Z-Jais/master
Browse files Browse the repository at this point in the history
Update dependency and fix ADN
  • Loading branch information
Ziedelth authored Jan 10, 2024
2 parents 9207282 + 59e5558 commit 91cd972
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<kotlin.compiler.languageVersion>2.0</kotlin.compiler.languageVersion>
<mainClass>fr.jais.scraper.ScraperKt</mainClass>
<junit-jupiter.version>5.10.1</junit-jupiter.version>
<apache.maven.plugins.version>3.2.3</apache.maven.plugins.version>
<apache.maven.plugins.version>3.2.5</apache.maven.plugins.version>
</properties>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,24 @@ class AnimationDigitalNetworkConverter(private val platform: AnimationDigitalNet
val genres = showJson.getAsJsonArray("genres")?.mapNotNull { it.asString() } ?: emptyList()
Logger.config("Genres: ${genres.joinToString(", ")}")

val contains = whitelistAnimes.contains(name)

if ((!genres.any { it.startsWith("Animation ", true) }) && !contains) throw NotJapaneseAnimeException("Show is not an anime")

// ----- SIMULCAST -----
Logger.info("Checking if anime is simulcasted...")
val simulcasted =
showJson["simulcast"]?.asBoolean == true || showJson["firstReleaseYear"]?.asString == calendar.getYear()
var simulcasted =
showJson["simulcast"]?.asBoolean == true || showJson["firstReleaseYear"]?.asString == calendar.getYear() || contains
Logger.config("Simulcasted: $simulcasted")

val descriptionLowercase = description?.lowercase()
val isAlternativeSimulcast =
(whitelistAnimes.contains(name) || genres.any { it.startsWith("Animation ", true) }) ||
(descriptionLowercase?.startsWith("(Premier épisode ".lowercase()) == true ||
descriptionLowercase?.startsWith("(Diffusion des ".lowercase()) == true ||
descriptionLowercase?.startsWith("(Diffusion du premier épisode".lowercase()) == true ||
descriptionLowercase?.startsWith("(Diffusion de l'épisode 1 le".lowercase()) == true)
val descriptionLowercase = description?.lowercase() ?: ""

simulcasted = simulcasted || descriptionLowercase.startsWith("(premier épisode ") ||
descriptionLowercase.startsWith("(diffusion des ") ||
descriptionLowercase.startsWith("(diffusion du premier épisode") ||
descriptionLowercase.startsWith("(diffusion de l'épisode 1 le")

if (!simulcasted && !isAlternativeSimulcast) throw NotSimulcastAnimeException("Anime is not simulcasted")
if (!simulcasted) throw NotSimulcastAnimeException("Anime is not simulcasted")

return Anime(checkedCountry.getCountry(), name, image, description, genres)
}
Expand Down

0 comments on commit 91cd972

Please sign in to comment.