[shabakatycinemana] fixes (#705)
* add shabakaty cinemana extension * fix kinds default value retrieving from preferences * fix browse langauge without category * fix episodes order: reverse * fix: animePage hasNextPage for popular, search, and latest * remove debug prints * bump version to 2
This commit is contained in:
parent
00f3a58b42
commit
899c24780b
2 changed files with 11 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'ShabakatyCinemana'
|
extName = 'ShabakatyCinemana'
|
||||||
extClass = '.ShabakatyCinemana'
|
extClass = '.ShabakatyCinemana'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
isNsfw = false
|
isNsfw = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ class ShabakatyCinemana : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
|
|
||||||
override fun latestUpdatesParse(response: Response): AnimesPage {
|
override fun latestUpdatesParse(response: Response): AnimesPage {
|
||||||
val animeList = response.asModelList(SAnimeDeserializer)
|
val animeList = response.asModelList(SAnimeDeserializer)
|
||||||
return AnimesPage(animeList, animeList.size < LATEST_ITEMS_PER_PAGE)
|
return AnimesPage(animeList, animeList.size == LATEST_ITEMS_PER_PAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularAnimeRequest(page: Int): Request {
|
override fun popularAnimeRequest(page: Int): Request {
|
||||||
|
@ -233,13 +233,12 @@ class ShabakatyCinemana : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
val kind = KINDS_LIST.first { it.first == kindPref }.second
|
val kind = KINDS_LIST.first { it.first == kindPref }.second
|
||||||
|
|
||||||
val url = "$apiBaseUrl/video/V/2/itemsPerPage/$POPULAR_ITEMS_PER_PAGE/level/0/videoKind/$kind/sortParam/desc/pageNumber/${page - 1}"
|
val url = "$apiBaseUrl/video/V/2/itemsPerPage/$POPULAR_ITEMS_PER_PAGE/level/0/videoKind/$kind/sortParam/desc/pageNumber/${page - 1}"
|
||||||
println(url)
|
|
||||||
return GET(url, headers)
|
return GET(url, headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularAnimeParse(response: Response): AnimesPage {
|
override fun popularAnimeParse(response: Response): AnimesPage {
|
||||||
val animeList = response.asModelList(SAnimeDeserializer)
|
val animeList = response.asModelList(SAnimeDeserializer)
|
||||||
return AnimesPage(animeList, animeList.size < POPULAR_ITEMS_PER_PAGE)
|
return AnimesPage(animeList, animeList.size == POPULAR_ITEMS_PER_PAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getSearchAnime(
|
override suspend fun getSearchAnime(
|
||||||
|
@ -291,14 +290,14 @@ class ShabakatyCinemana : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
.addQueryParameter("orderby", browseResultSort)
|
.addQueryParameter("orderby", browseResultSort)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
println(url)
|
|
||||||
val resp = client.newCall(GET(url, headers)).execute()
|
val resp = client.newCall(GET(url, headers)).execute()
|
||||||
// Todo: remove SAnimeWithInfo data class if no longer needed
|
// Todo: remove SAnimeWithInfo data class if no longer needed
|
||||||
val animeListWithInfo = resp.asModel(SAnimeWithInfoDeserializer)
|
val animeListWithInfo = resp.asModel(SAnimeWithInfoDeserializer)
|
||||||
return AnimesPage(animeListWithInfo.animes, animeListWithInfo.animes.isNotEmpty())
|
return AnimesPage(animeListWithInfo.animes, animeListWithInfo.animes.size == POPULAR_ITEMS_PER_PAGE)
|
||||||
} else {
|
} else {
|
||||||
// star=8&year=1900,2025
|
// star=8&year=1900,2025
|
||||||
url = url.newBuilder()
|
url = url.newBuilder()
|
||||||
|
.addQueryParameter("level", "0")
|
||||||
.addPathSegment("AdvancedSearch")
|
.addPathSegment("AdvancedSearch")
|
||||||
.addQueryParameter("type", kindName)
|
.addQueryParameter("type", kindName)
|
||||||
.addQueryParameter("page", "${page - 1}")
|
.addQueryParameter("page", "${page - 1}")
|
||||||
|
@ -310,13 +309,15 @@ class ShabakatyCinemana : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.isNotBlank()) {
|
if (query.isNotBlank()) {
|
||||||
url = url.newBuilder().addQueryParameter("videoTitle", query).build()
|
url = url.newBuilder()
|
||||||
|
.addQueryParameter("videoTitle", query)
|
||||||
|
.addQueryParameter("staffTitle", query)
|
||||||
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
println(url)
|
|
||||||
val resp = client.newCall(GET(url, headers)).execute()
|
val resp = client.newCall(GET(url, headers)).execute()
|
||||||
val animeList = resp.asModelList(SAnimeDeserializer)
|
val animeList = resp.asModelList(SAnimeDeserializer)
|
||||||
return AnimesPage(animeList, animeList.size < SEARCH_ITEMS_PER_PAGE)
|
return AnimesPage(animeList, animeList.size == SEARCH_ITEMS_PER_PAGE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +336,7 @@ class ShabakatyCinemana : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
{ it.name.split(SEASON_EPISODE_DELIMITER).first().parseAs<Int>() },
|
{ it.name.split(SEASON_EPISODE_DELIMITER).first().parseAs<Int>() },
|
||||||
{ it.name.split(SEASON_EPISODE_DELIMITER).last().parseAs<Int>() },
|
{ it.name.split(SEASON_EPISODE_DELIMITER).last().parseAs<Int>() },
|
||||||
),
|
),
|
||||||
)
|
).reversed()
|
||||||
} else {
|
} else {
|
||||||
return listOf(
|
return listOf(
|
||||||
SEpisode.create().apply {
|
SEpisode.create().apply {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue