|
|
|
@ -37,6 +37,10 @@ import kotlin.math.absoluteValue
|
|
|
|
|
**/
|
|
|
|
|
const val AllLanguagesName = "universal"
|
|
|
|
|
|
|
|
|
|
//val baseHeader = mapOf("User-Agent" to USER_AGENT)
|
|
|
|
|
val mapper = JsonMapper.builder().addModule(kotlinModule())
|
|
|
|
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).build()!!
|
|
|
|
|
|
|
|
|
|
object APIHolder {
|
|
|
|
|
val unixTime: Long
|
|
|
|
|
get() = System.currentTimeMillis() / 1000L
|
|
|
|
@ -114,7 +118,8 @@ object APIHolder {
|
|
|
|
|
|
|
|
|
|
fun LoadResponse.getId(): Int {
|
|
|
|
|
// this fixes an issue with outdated api as getLoadResponseIdFromUrl might be fucked
|
|
|
|
|
return (if (this is ResultViewModel2.LoadResponseFromSearch) this.id else null) ?: getLoadResponseIdFromUrl(url, apiName)
|
|
|
|
|
return (if (this is ResultViewModel2.LoadResponseFromSearch) this.id else null)
|
|
|
|
|
?: getLoadResponseIdFromUrl(url, apiName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -218,7 +223,12 @@ object APIHolder {
|
|
|
|
|
if (lessAccurate) matchingTitles || matchingTypes && matchingYears else matchingTitles && matchingTypes && matchingYears
|
|
|
|
|
} ?: return null
|
|
|
|
|
|
|
|
|
|
Tracker(res.idMal, res.id.toString(), res.coverImage?.extraLarge ?: res.coverImage?.large, res.bannerImage)
|
|
|
|
|
Tracker(
|
|
|
|
|
res.idMal,
|
|
|
|
|
res.id.toString(),
|
|
|
|
|
res.coverImage?.extraLarge ?: res.coverImage?.large,
|
|
|
|
|
res.bannerImage
|
|
|
|
|
)
|
|
|
|
|
} catch (t: Throwable) {
|
|
|
|
|
logError(t)
|
|
|
|
|
null
|
|
|
|
@ -859,6 +869,7 @@ enum class TvType(value: Int?) {
|
|
|
|
|
Others(12),
|
|
|
|
|
Music(13),
|
|
|
|
|
AudioBook(14),
|
|
|
|
|
|
|
|
|
|
/** Wont load the built in player, make your own interaction */
|
|
|
|
|
CustomMedia(15),
|
|
|
|
|
}
|
|
|
|
@ -1246,13 +1257,15 @@ interface LoadResponse {
|
|
|
|
|
|
|
|
|
|
fun LoadResponse.getImdbId(): String? {
|
|
|
|
|
return normalSafeApiCall {
|
|
|
|
|
SimklApi.readIdFromString(this.syncData[simklIdPrefix])?.get(SimklApi.Companion.SyncServices.Imdb)
|
|
|
|
|
SimklApi.readIdFromString(this.syncData[simklIdPrefix])
|
|
|
|
|
?.get(SimklApi.Companion.SyncServices.Imdb)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun LoadResponse.getTMDbId(): String? {
|
|
|
|
|
return normalSafeApiCall {
|
|
|
|
|
SimklApi.readIdFromString(this.syncData[simklIdPrefix])?.get(SimklApi.Companion.SyncServices.Tmdb)
|
|
|
|
|
SimklApi.readIdFromString(this.syncData[simklIdPrefix])
|
|
|
|
|
?.get(SimklApi.Companion.SyncServices.Tmdb)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1536,8 +1549,26 @@ data class TorrentLoadResponse(
|
|
|
|
|
posterHeaders: Map<String, String>? = null,
|
|
|
|
|
backgroundPosterUrl: String? = null,
|
|
|
|
|
) : this(
|
|
|
|
|
name, url, apiName, magnet, torrent, plot, type, posterUrl, year, rating, tags, duration, trailers,
|
|
|
|
|
recommendations, actors, comingSoon, syncData, posterHeaders, backgroundPosterUrl, null
|
|
|
|
|
name,
|
|
|
|
|
url,
|
|
|
|
|
apiName,
|
|
|
|
|
magnet,
|
|
|
|
|
torrent,
|
|
|
|
|
plot,
|
|
|
|
|
type,
|
|
|
|
|
posterUrl,
|
|
|
|
|
year,
|
|
|
|
|
rating,
|
|
|
|
|
tags,
|
|
|
|
|
duration,
|
|
|
|
|
trailers,
|
|
|
|
|
recommendations,
|
|
|
|
|
actors,
|
|
|
|
|
comingSoon,
|
|
|
|
|
syncData,
|
|
|
|
|
posterHeaders,
|
|
|
|
|
backgroundPosterUrl,
|
|
|
|
|
null
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1589,7 +1620,8 @@ data class AnimeLoadResponse(
|
|
|
|
|
return this.episodes.maxOf { (_, episodes) ->
|
|
|
|
|
episodes.count { episodeData ->
|
|
|
|
|
// Prioritize display season as actual season may be something random to fit multiple seasons into one.
|
|
|
|
|
val episodeSeason = displayMap[episodeData.season] ?: episodeData.season ?: Int.MIN_VALUE
|
|
|
|
|
val episodeSeason =
|
|
|
|
|
displayMap[episodeData.season] ?: episodeData.season ?: Int.MIN_VALUE
|
|
|
|
|
// Count all episodes from season 1 to below the current season.
|
|
|
|
|
episodeSeason in 1..<season
|
|
|
|
|
}
|
|
|
|
@ -1626,9 +1658,31 @@ data class AnimeLoadResponse(
|
|
|
|
|
seasonNames: List<SeasonData>? = null,
|
|
|
|
|
backgroundPosterUrl: String? = null,
|
|
|
|
|
) : this(
|
|
|
|
|
engName, japName, name, url, apiName, type, posterUrl, year, episodes, showStatus, plot, tags,
|
|
|
|
|
synonyms, rating, duration, trailers, recommendations, actors, comingSoon, syncData, posterHeaders,
|
|
|
|
|
nextAiring, seasonNames, backgroundPosterUrl, null
|
|
|
|
|
engName,
|
|
|
|
|
japName,
|
|
|
|
|
name,
|
|
|
|
|
url,
|
|
|
|
|
apiName,
|
|
|
|
|
type,
|
|
|
|
|
posterUrl,
|
|
|
|
|
year,
|
|
|
|
|
episodes,
|
|
|
|
|
showStatus,
|
|
|
|
|
plot,
|
|
|
|
|
tags,
|
|
|
|
|
synonyms,
|
|
|
|
|
rating,
|
|
|
|
|
duration,
|
|
|
|
|
trailers,
|
|
|
|
|
recommendations,
|
|
|
|
|
actors,
|
|
|
|
|
comingSoon,
|
|
|
|
|
syncData,
|
|
|
|
|
posterHeaders,
|
|
|
|
|
nextAiring,
|
|
|
|
|
seasonNames,
|
|
|
|
|
backgroundPosterUrl,
|
|
|
|
|
null
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1903,7 +1957,8 @@ data class TvSeriesLoadResponse(
|
|
|
|
|
|
|
|
|
|
return episodes.count { episodeData ->
|
|
|
|
|
// Prioritize display season as actual season may be something random to fit multiple seasons into one.
|
|
|
|
|
val episodeSeason = displayMap[episodeData.season] ?: episodeData.season ?: Int.MIN_VALUE
|
|
|
|
|
val episodeSeason =
|
|
|
|
|
displayMap[episodeData.season] ?: episodeData.season ?: Int.MIN_VALUE
|
|
|
|
|
// Count all episodes from season 1 to below the current season.
|
|
|
|
|
episodeSeason in 1..<season
|
|
|
|
|
} + episode
|
|
|
|
@ -1936,9 +1991,28 @@ data class TvSeriesLoadResponse(
|
|
|
|
|
seasonNames: List<SeasonData>? = null,
|
|
|
|
|
backgroundPosterUrl: String? = null,
|
|
|
|
|
) : this(
|
|
|
|
|
name, url, apiName, type, episodes, posterUrl, year, plot, showStatus, rating, tags, duration,
|
|
|
|
|
trailers, recommendations, actors, comingSoon, syncData, posterHeaders, nextAiring, seasonNames,
|
|
|
|
|
backgroundPosterUrl, null
|
|
|
|
|
name,
|
|
|
|
|
url,
|
|
|
|
|
apiName,
|
|
|
|
|
type,
|
|
|
|
|
episodes,
|
|
|
|
|
posterUrl,
|
|
|
|
|
year,
|
|
|
|
|
plot,
|
|
|
|
|
showStatus,
|
|
|
|
|
rating,
|
|
|
|
|
tags,
|
|
|
|
|
duration,
|
|
|
|
|
trailers,
|
|
|
|
|
recommendations,
|
|
|
|
|
actors,
|
|
|
|
|
comingSoon,
|
|
|
|
|
syncData,
|
|
|
|
|
posterHeaders,
|
|
|
|
|
nextAiring,
|
|
|
|
|
seasonNames,
|
|
|
|
|
backgroundPosterUrl,
|
|
|
|
|
null
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2002,6 +2076,7 @@ data class AniSearch(
|
|
|
|
|
@JsonProperty("extraLarge") var extraLarge: String? = null,
|
|
|
|
|
@JsonProperty("large") var large: String? = null,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
data class Title(
|
|
|
|
|
@JsonProperty("romaji") var romaji: String? = null,
|
|
|
|
|
@JsonProperty("english") var english: String? = null,
|
|
|
|
|