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' extName = 'MangaDex'
pkgNameSuffix = 'all.mangadex' pkgNameSuffix = 'all.mangadex'
extClass = '.MangaDexFactory' extClass = '.MangaDexFactory'
extVersionCode = 111 extVersionCode = 112
libVersion = '1.2' libVersion = '1.2'
containsNsfw = true containsNsfw = true
} }

View File

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

View File

@ -43,11 +43,14 @@ class MdAtHomeReportInterceptor(
return chain.proceed(chain.request()).let { response -> return chain.proceed(chain.request()).let { response ->
val url = originalRequest.url.toString() val url = originalRequest.url.toString()
if (url.contains(mdAtHomeUrlRegex)) { if (url.contains(mdAtHomeUrlRegex)) {
val cachedImage = response.header("X-Cache", "") == "HIT"
val jsonString = gson.toJson( val jsonString = gson.toJson(
mapOf( mapOf(
"url" to url, "url" to url,
"success" to response.isSuccessful, "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,
) )
) )