update mangadex at home reporting (#7038)

* fix reporting for md@home

* dont show safe rating

* dont show safe rating

* update gradle
This commit is contained in:
Carlos 2021-05-15 20:08:28 -04:00 committed by GitHub
parent 0e982b8380
commit 56d9d913f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 14 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaDex'
pkgNameSuffix = 'all.mangadex'
extClass = '.MangaDexFactory'
extVersionCode = 111
extVersionCode = 112
libVersion = '1.2'
containsNsfw = true
}

View File

@ -145,14 +145,17 @@ class MangaDexHelper() {
val attr = data["attributes"].obj
// things that will go with the genre tags but aren't actually genre
val tempContentRating = attr["contentRating"].nullString
val contentRating = if (tempContentRating == null || tempContentRating.equals("safe", true)) {
null
} else {
"Content rating: " + tempContentRating.capitalize(Locale.US)
}
val nonGenres = listOf(
(attr["publicationDemographic"]?.nullString ?: "").capitalize(Locale.US),
(
"Content rating: " + (
attr["contentRating"].nullString
?: ""
).capitalize(Locale.US)
),
contentRating,
Locale(attr["originalLanguage"].nullString ?: "").displayLanguage
)
@ -266,14 +269,14 @@ class MangaDexHelper() {
}
attr["title"].nullString?.let {
if(it.isNotEmpty()){
if (chapterName.isNotEmpty()) {
chapterName.add("-")
}
chapterName.add(it)
if (it.isNotEmpty()) {
if (chapterName.isNotEmpty()) {
chapterName.add("-")
}
chapterName.add(it)
}
}
// if volume, chapter and title is empty its a oneshot
if (chapterName.isEmpty()) {
chapterName.add("Oneshot")

View File

@ -43,11 +43,14 @@ class MdAtHomeReportInterceptor(
return chain.proceed(chain.request()).let { response ->
val url = originalRequest.url.toString()
if (url.contains(mdAtHomeUrlRegex)) {
val cachedImage = response.header("X-Cache", "") == "HIT"
val jsonString = gson.toJson(
mapOf(
"url" to url,
"success" to response.isSuccessful,
"bytes" to response.peekBody(Long.MAX_VALUE).bytes().size
"bytes" to response.peekBody(Long.MAX_VALUE).bytes().size,
"duration" to response.receivedResponseAtMillis - response.sentRequestAtMillis,
"cache" to cachedImage,
)
)