animeon: Fix posters and movie(ashdi)

This commit is contained in:
CakesTwix 2024-07-28 22:20:46 +03:00
parent 3763ae41e0
commit 60910163db
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
2 changed files with 27 additions and 13 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 4 version = 5
dependencies{ dependencies{
implementation("com.google.code.gson:gson:2.9.0") implementation("com.google.code.gson:gson:2.9.0")

View file

@ -152,7 +152,6 @@ class AnimeONProvider : MainAPI() {
) )
) )
} }
return if (tvType == TvType.Anime || tvType == TvType.OVA) { return if (tvType == TvType.Anime || tvType == TvType.OVA) {
newAnimeLoadResponse( newAnimeLoadResponse(
animeJSON.titleUa, animeJSON.titleUa,
@ -167,20 +166,25 @@ class AnimeONProvider : MainAPI() {
this.showStatus = showStatus this.showStatus = showStatus
this.duration = extractIntFromString(animeJSON.episodeTime) this.duration = extractIntFromString(animeJSON.episodeTime)
this.year = animeJSON.releaseDate this.year = animeJSON.releaseDate
this.backgroundPosterUrl = posterApi.format(animeJSON.backgroundImage)
this.rating = animeJSON.rating.toString().toRatingInt() this.rating = animeJSON.rating.toString().toRatingInt()
addEpisodes(DubStatus.Dubbed, episodes) addEpisodes(DubStatus.Dubbed, episodes)
addMalId(animeJSON.malId) addMalId(animeJSON.malId)
} }
} else { } else {
newMovieLoadResponse(animeJSON.titleUa, "$mainUrl/anime/${animeJSON.id}", tvType, "${animeJSON.titleUa}, ${animeJSON.player[0].url}") { var backgroundImage = animeJSON.backgroundImage
if(backgroundImage.isNullOrBlank()){
backgroundImage = posterApi.format(animeJSON.poster)
} else {
backgroundImage = posterApi.format(animeJSON.backgroundImage)
}
newMovieLoadResponse(animeJSON.titleUa, "$mainUrl/anime/${animeJSON.id}", tvType, "${animeJSON.id}") {
this.posterUrl = posterApi.format(animeJSON.poster) this.posterUrl = posterApi.format(animeJSON.poster)
this.tags = animeJSON.genres.map { it.name } this.tags = animeJSON.genres.map { it.name }
this.plot = animeJSON.description this.plot = animeJSON.description
addTrailer(animeJSON.trailer) addTrailer(animeJSON.trailer)
this.duration = extractIntFromString(animeJSON.episodeTime) this.duration = extractIntFromString(animeJSON.episodeTime)
this.year = animeJSON.releaseDate this.year = animeJSON.releaseDate
this.backgroundPosterUrl = posterApi.format(animeJSON.backgroundImage) this.backgroundPosterUrl = backgroundImage
this.rating = animeJSON.rating.toString().toRatingInt() this.rating = animeJSON.rating.toString().toRatingInt()
addMalId(animeJSON.malId) addMalId(animeJSON.malId)
} }
@ -196,17 +200,27 @@ class AnimeONProvider : MainAPI() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
val dataList = data.split(", ") val dataList = data.split(", ")
val fundubs = Gson().fromJson<List<FundubModel>>(app.get("${apiUrl}/player/fundubs/${dataList[0]}").text, listFundub) val fundubs = Gson().fromJson<List<FundubModel>>(app.get("${apiUrl}/player/fundubs/${dataList[0]}").text, listFundub)
fundubs.map { dub -> if(dataList.size == 2){
Gson().fromJson<List<FundubEpisode>>(app.get("${apiUrl}/player/episodes/${dub.player[0].id}/${dub.fundub.id}").text, listFundubEpisodes).filter{ it.episode == dataList[1].toIntOrNull() }.map { epd -> // Episode fundubs.map { dub ->
M3u8Helper.generateM3u8( Gson().fromJson<List<FundubEpisode>>(app.get("${apiUrl}/player/episodes/${dub.player[0].id}/${dub.fundub.id}").text, listFundubEpisodes).filter{ it.episode == dataList[1].toIntOrNull() }.map { epd -> // Episode
source = "${dub.fundub.name} (${dub.player[0].name})", M3u8Helper.generateM3u8(
streamUrl = getM3U(app.get("${apiUrl}/player/episode/${epd.id}").parsedSafe<FundubVideoUrl>()!!.videoUrl), source = "${dub.fundub.name} (${dub.player[0].name})",
referer = "https://animeon.club" streamUrl = getM3U(app.get("${apiUrl}/player/episode/${epd.id}").parsedSafe<FundubVideoUrl>()!!.videoUrl),
).forEach(callback) referer = "https://animeon.club"
).forEach(callback)
}
} }
return true
}
fundubs.map { dub ->
M3u8Helper.generateM3u8(
source = "${dub.fundub.name} (${dub.player[0].name})",
streamUrl = getM3U(app.get("${apiUrl}/player/${dub.player[0].id}/${dub.fundub.id}").parsedSafe<FundubVideoUrl>()!!.videoUrl),
referer = "https://animeon.club"
).forEach(callback)
} }
return true return true