feat(en/seez): Add status, next episode air date and languages (#2833)
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'Seez'
|
extName = 'Seez'
|
||||||
extClass = '.Seez'
|
extClass = '.Seez'
|
||||||
extVersionCode = 7
|
extVersionCode = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -30,6 +30,7 @@ import uy.kohesive.injekt.api.get
|
|||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
import javax.crypto.spec.SecretKeySpec
|
import javax.crypto.spec.SecretKeySpec
|
||||||
@ -89,11 +90,11 @@ class Seez : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
SAnime.create().apply {
|
SAnime.create().apply {
|
||||||
title = name
|
title = name
|
||||||
url = LinkData(ani.id, "movie").toJsonString()
|
url = LinkData(ani.id, "movie").toJsonString()
|
||||||
thumbnail_url = ani.poster_path?.let { IMG_URL + it } ?: FALLBACK_IMG
|
thumbnail_url = ani.posterPath?.let { IMG_URL + it } ?: FALLBACK_IMG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnimesPage(animeList, data.page < data.total_pages)
|
return AnimesPage(animeList, data.page < data.totalPages)
|
||||||
}
|
}
|
||||||
|
|
||||||
// =============================== Latest ===============================
|
// =============================== Latest ===============================
|
||||||
@ -140,12 +141,13 @@ class Seez : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
SAnime.create().apply {
|
SAnime.create().apply {
|
||||||
title = name
|
title = name
|
||||||
url = LinkData(ani.id, ani.media_type).toJsonString()
|
url = LinkData(ani.id, ani.mediaType).toJsonString()
|
||||||
thumbnail_url = ani.poster_path?.let { IMG_URL + it } ?: FALLBACK_IMG
|
thumbnail_url = ani.posterPath?.let { IMG_URL + it } ?: FALLBACK_IMG
|
||||||
|
status = if (ani.mediaType == "movie") SAnime.COMPLETED else SAnime.UNKNOWN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnimesPage(animeList, data.page < data.total_pages)
|
return AnimesPage(animeList, data.page < data.totalPages)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================== Filters ===============================
|
// ============================== Filters ===============================
|
||||||
@ -197,9 +199,8 @@ class Seez : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
val data = json.decodeFromString<LinkData>(anime.url)
|
val data = json.decodeFromString<LinkData>(anime.url)
|
||||||
|
|
||||||
val url = TMDB_URL.newBuilder().apply {
|
val url = TMDB_URL.newBuilder().apply {
|
||||||
addPathSegment(data.media_type)
|
addPathSegment(data.mediaType)
|
||||||
addPathSegment(data.id.toString())
|
addPathSegment(data.id.toString())
|
||||||
addQueryParameter("append_to_response", "videos,credits,recommendations")
|
|
||||||
}.buildAPIUrl()
|
}.buildAPIUrl()
|
||||||
|
|
||||||
return GET(url, headers = apiHeaders)
|
return GET(url, headers = apiHeaders)
|
||||||
@ -209,15 +210,34 @@ class Seez : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
val data = response.parseAs<TmdbDetailsResponse>()
|
val data = response.parseAs<TmdbDetailsResponse>()
|
||||||
|
|
||||||
return SAnime.create().apply {
|
return SAnime.create().apply {
|
||||||
genre = data.genres?.joinToString(", ") { it.name }
|
author = data.productions?.joinToString { it.name }
|
||||||
description = buildString {
|
genre = data.genres?.joinToString { it.name }
|
||||||
if (data.overview != null) {
|
status = when (data.status) {
|
||||||
append(data.overview)
|
"Ended", "Released" -> SAnime.COMPLETED
|
||||||
append("\n\n")
|
"In Production" -> SAnime.LICENSED
|
||||||
|
"Canceled" -> SAnime.CANCELLED
|
||||||
|
"Returning Series" -> {
|
||||||
|
data.nextEpisode?.let { SAnime.ONGOING } ?: SAnime.ON_HIATUS
|
||||||
|
}
|
||||||
|
else -> SAnime.UNKNOWN
|
||||||
|
}
|
||||||
|
description = buildString {
|
||||||
|
data.overview?.let {
|
||||||
|
appendLine(it)
|
||||||
|
appendLine()
|
||||||
|
}
|
||||||
|
data.nextEpisode?.let {
|
||||||
|
appendLine("Next: Ep ${it.epNumber} - ${it.name}")
|
||||||
|
appendLine("Air Date: ${it.airDate}")
|
||||||
|
appendLine()
|
||||||
|
}
|
||||||
|
data.releaseDate?.let { appendLine("Release date: $it") }
|
||||||
|
data.firstAirDate?.let { appendLine("First air date: $it") }
|
||||||
|
data.lastAirDate?.let { appendLine("Last air date: $it") }
|
||||||
|
data.languages?.let { langs ->
|
||||||
|
append("Languages: ")
|
||||||
|
appendLine(langs.joinToString { "${it.engName} (${it.name})" })
|
||||||
}
|
}
|
||||||
if (data.release_date != null) append("Release date: ${data.release_date}")
|
|
||||||
if (data.first_air_date != null) append("\nFirst air date: ${data.first_air_date}")
|
|
||||||
if (data.last_air_date != null) append("\nLast air date: ${data.last_air_date}")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,31 +254,35 @@ class Seez : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
episodeList.add(
|
episodeList.add(
|
||||||
SEpisode.create().apply {
|
SEpisode.create().apply {
|
||||||
name = "Movie"
|
name = "Movie"
|
||||||
date_upload = parseDate(data.release_date!!)
|
date_upload = parseDate(data.releaseDate!!)
|
||||||
episode_number = 1F
|
episode_number = 1F
|
||||||
url = "/movie/${data.id}"
|
url = "/movie/${data.id}"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
data.seasons.filter { t -> t.season_number != 0 }.forEach { season ->
|
data.seasons.filter { t -> t.seasonNumber != 0 }.forEach { season ->
|
||||||
val seasonUrl = TMDB_URL.newBuilder().apply {
|
val seasonUrl = TMDB_URL.newBuilder().apply {
|
||||||
addPathSegment("tv")
|
addPathSegment("tv")
|
||||||
addPathSegment(data.id.toString())
|
addPathSegment(data.id.toString())
|
||||||
addPathSegment("season")
|
addPathSegment("season")
|
||||||
addPathSegment(season.season_number.toString())
|
addPathSegment(season.seasonNumber.toString())
|
||||||
}.buildAPIUrl()
|
}.buildAPIUrl()
|
||||||
|
|
||||||
val seasonData = client.newCall(
|
val seasonData = client.newCall(
|
||||||
GET(seasonUrl, headers = apiHeaders),
|
GET(seasonUrl, headers = apiHeaders),
|
||||||
).execute().parseAs<TmdbSeasonResponse>()
|
).execute().parseAs<TmdbSeasonResponse>()
|
||||||
|
|
||||||
seasonData.episodes.forEach { ep ->
|
seasonData.episodes.filter { ep ->
|
||||||
|
ep.airDate?.let {
|
||||||
|
DATE_FORMATTER.parse(it)!! <= DATE_FORMATTER.parse(DATE_FORMATTER.format(Date()))
|
||||||
|
} ?: false
|
||||||
|
}.forEach { ep ->
|
||||||
episodeList.add(
|
episodeList.add(
|
||||||
SEpisode.create().apply {
|
SEpisode.create().apply {
|
||||||
name = "Season ${season.season_number} Ep. ${ep.episode_number} - ${ep.name}"
|
name = "Season ${season.seasonNumber} Ep. ${ep.epNumber} - ${ep.name}"
|
||||||
date_upload = ep.air_date?.let(::parseDate) ?: 0L
|
date_upload = ep.airDate?.let(::parseDate) ?: 0L
|
||||||
episode_number = ep.episode_number.toFloat()
|
episode_number = ep.epNumber.toFloat()
|
||||||
url = "/tv/${data.id}/${season.season_number}/${ep.episode_number}"
|
url = "/tv/${data.id}/${season.seasonNumber}/${ep.epNumber}"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,22 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.en.seez
|
package eu.kanade.tachiyomi.animeextension.en.seez
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class TmdbResponse(
|
data class TmdbResponse(
|
||||||
val page: Int,
|
val page: Int,
|
||||||
val total_pages: Int,
|
@SerialName("total_pages")
|
||||||
|
val totalPages: Int,
|
||||||
val results: List<TmdbResult>,
|
val results: List<TmdbResult>,
|
||||||
) {
|
) {
|
||||||
@Serializable
|
@Serializable
|
||||||
data class TmdbResult(
|
data class TmdbResult(
|
||||||
val id: Int,
|
val id: Int,
|
||||||
val media_type: String = "tv",
|
@SerialName("media_type")
|
||||||
val poster_path: String? = null,
|
val mediaType: String = "tv",
|
||||||
|
@SerialName("poster_path")
|
||||||
|
val posterPath: String? = null,
|
||||||
val title: String? = null,
|
val title: String? = null,
|
||||||
val name: String? = null,
|
val name: String? = null,
|
||||||
)
|
)
|
||||||
@ -23,12 +27,22 @@ data class TmdbDetailsResponse(
|
|||||||
val id: Int,
|
val id: Int,
|
||||||
val overview: String? = null,
|
val overview: String? = null,
|
||||||
val genres: List<GenreObject>? = null,
|
val genres: List<GenreObject>? = null,
|
||||||
val release_date: String? = null,
|
@SerialName("release_date")
|
||||||
val first_air_date: String? = null,
|
val releaseDate: String? = null,
|
||||||
val last_air_date: String? = null,
|
@SerialName("first_air_date")
|
||||||
|
val firstAirDate: String? = null,
|
||||||
|
@SerialName("last_air_date")
|
||||||
|
val lastAirDate: String? = null,
|
||||||
val name: String? = null,
|
val name: String? = null,
|
||||||
val title: String? = null,
|
val title: String? = null,
|
||||||
val seasons: List<SeasonObject> = emptyList(),
|
val seasons: List<SeasonObject> = emptyList(),
|
||||||
|
val status: String,
|
||||||
|
@SerialName("next_episode_to_air")
|
||||||
|
val nextEpisode: NextEpisode? = null,
|
||||||
|
@SerialName("production_companies")
|
||||||
|
val productions: List<Company>? = null,
|
||||||
|
@SerialName("spoken_languages")
|
||||||
|
val languages: List<Language>? = null,
|
||||||
) {
|
) {
|
||||||
@Serializable
|
@Serializable
|
||||||
data class GenreObject(
|
data class GenreObject(
|
||||||
@ -37,9 +51,31 @@ data class TmdbDetailsResponse(
|
|||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SeasonObject(
|
data class SeasonObject(
|
||||||
val season_number: Int,
|
@SerialName("season_number")
|
||||||
// id 787
|
val seasonNumber: Int,
|
||||||
// name "Book Two: Earth"
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class NextEpisode(
|
||||||
|
val name: String? = "",
|
||||||
|
@SerialName("episode_number")
|
||||||
|
val epNumber: Int,
|
||||||
|
@SerialName("air_date")
|
||||||
|
val airDate: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Company(
|
||||||
|
val name: String,
|
||||||
|
@SerialName("origin_country")
|
||||||
|
val originCountry: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Language(
|
||||||
|
val name: String,
|
||||||
|
@SerialName("english_name")
|
||||||
|
val engName: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,16 +85,19 @@ data class TmdbSeasonResponse(
|
|||||||
) {
|
) {
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EpisodeObject(
|
data class EpisodeObject(
|
||||||
val episode_number: Int,
|
@SerialName("episode_number")
|
||||||
|
val epNumber: Int,
|
||||||
val name: String,
|
val name: String,
|
||||||
val air_date: String? = null,
|
@SerialName("air_date")
|
||||||
|
val airDate: String? = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class LinkData(
|
data class LinkData(
|
||||||
val id: Int,
|
val id: Int,
|
||||||
val media_type: String,
|
@SerialName("media_type")
|
||||||
|
val mediaType: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
Reference in New Issue
Block a user