Add chapter view count back to TaoSect. (#9432)
This commit is contained in:
parent
258da29ffc
commit
c60e0e7831
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'Tao Sect'
|
extName = 'Tao Sect'
|
||||||
pkgNameSuffix = 'pt.taosect'
|
pkgNameSuffix = 'pt.taosect'
|
||||||
extClass = '.TaoSect'
|
extClass = '.TaoSect'
|
||||||
extVersionCode = 12
|
extVersionCode = 13
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ class TaoSect : HttpSource() {
|
|||||||
val apiUrl = "$baseUrl/$API_BASE_PATH/capitulos/".toHttpUrl().newBuilder()
|
val apiUrl = "$baseUrl/$API_BASE_PATH/capitulos/".toHttpUrl().newBuilder()
|
||||||
.addPathSegment(projectSlug)
|
.addPathSegment(projectSlug)
|
||||||
.addPathSegment(chapterSlug)
|
.addPathSegment(chapterSlug)
|
||||||
.addQueryParameter("_fields", "paginas")
|
.addQueryParameter("_fields", "id_capitulo,paginas,post_id")
|
||||||
.toString()
|
.toString()
|
||||||
|
|
||||||
return GET(apiUrl, apiHeaders)
|
return GET(apiUrl, apiHeaders)
|
||||||
@ -342,6 +342,10 @@ class TaoSect : HttpSource() {
|
|||||||
Page(i, chapterUrl, pageUrl)
|
Page(i, chapterUrl, pageUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Count the project and chapter views, requested by the scanlator.
|
||||||
|
val countViewRequest = countProjectViewRequest(result.projectId!!, result.id)
|
||||||
|
runCatching { client.newCall(countViewRequest).execute().close() }
|
||||||
|
|
||||||
// Check if the pages have exceeded the view limit of Google Drive.
|
// Check if the pages have exceeded the view limit of Google Drive.
|
||||||
val firstPage = pages[0]
|
val firstPage = pages[0]
|
||||||
|
|
||||||
@ -373,11 +377,16 @@ class TaoSect : HttpSource() {
|
|||||||
return GET(page.imageUrl!!, newHeaders)
|
return GET(page.imageUrl!!, newHeaders)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun countProjectViewRequest(projectId: String): Request {
|
private fun countProjectViewRequest(projectId: String, chapterId: String? = null): Request {
|
||||||
val formBody = FormBody.Builder()
|
val formBodyBuilder = FormBody.Builder()
|
||||||
.add("action", "update_views_v2")
|
.add("action", "update_views_v2")
|
||||||
.add("projeto", projectId)
|
.add("projeto", projectId)
|
||||||
.build()
|
|
||||||
|
if (chapterId != null) {
|
||||||
|
formBodyBuilder.add("capitulo", chapterId)
|
||||||
|
}
|
||||||
|
|
||||||
|
val formBody = formBodyBuilder.build()
|
||||||
|
|
||||||
val newHeaders = headersBuilder()
|
val newHeaders = headersBuilder()
|
||||||
.add("Content-Length", formBody.contentLength().toString())
|
.add("Content-Length", formBody.contentLength().toString())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user