Changed endpoint for scanlator cache, and fixed caching issue with chapter pageLists. (#1401)
This commit is contained in:
parent
a5c5e5c10c
commit
4c60142a5b
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Guya'
|
appName = 'Tachiyomi: Guya'
|
||||||
pkgNameSuffix = "en.guya"
|
pkgNameSuffix = "en.guya"
|
||||||
extClass = '.Guya'
|
extClass = '.Guya'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
override val supportsLatest = false
|
override val supportsLatest = false
|
||||||
override val lang = "en"
|
override val lang = "en"
|
||||||
|
|
||||||
|
private val scanlatorCacheUrl = "https://raw.githubusercontent.com/appu1232/guyamoe/master/api/data_cache/all_groups.json"
|
||||||
|
|
||||||
override fun headersBuilder() = Headers.Builder().apply {
|
override fun headersBuilder() = Headers.Builder().apply {
|
||||||
add("User-Agent","(Android ${Build.VERSION.RELEASE}; " +
|
add("User-Agent","(Android ${Build.VERSION.RELEASE}; " +
|
||||||
"${Build.MANUFACTURER} ${Build.MODEL}) " +
|
"${Build.MANUFACTURER} ${Build.MODEL}) " +
|
||||||
|
@ -164,27 +166,22 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
val preference = ListPreference(screen.context).apply {
|
val preference = ListPreference(screen.context).apply {
|
||||||
key = "preferred_scanlator"
|
key = "preferred_scanlator"
|
||||||
title = "Preferred scanlator"
|
title = "Preferred scanlator"
|
||||||
var scanlators = arrayOf<String>()
|
entries = arrayOf<String>()
|
||||||
var scanlatorsIndex = arrayOf<String>()
|
entryValues = arrayOf<String>()
|
||||||
for (key in Scanlators.keys()) {
|
for (key in Scanlators.keys()) {
|
||||||
scanlators += Scanlators.getValueFromKey(key)
|
entries += Scanlators.getValueFromKey(key)
|
||||||
scanlatorsIndex += key
|
entryValues += key
|
||||||
}
|
}
|
||||||
entries = scanlators
|
|
||||||
entryValues = scanlatorsIndex
|
|
||||||
summary = "Current: %s\n\n" +
|
summary = "Current: %s\n\n" +
|
||||||
"This setting sets the scanlation group to prioritize " +
|
"This setting sets the scanlation group to prioritize " +
|
||||||
"on chapter refresh/update. It will get the next available if " +
|
"on chapter refresh/update. It will get the next available if " +
|
||||||
"your preferred scanlator isn't an option (yet)." +
|
"your preferred scanlator isn't an option (yet)."
|
||||||
"\nNOTE: If you've already downloaded a chapter and the pages aren't updating, " +
|
|
||||||
"clear your chapter cache under Settings > Advanced > Clear chapter cache."
|
|
||||||
|
|
||||||
this.setDefaultValue(1)
|
this.setDefaultValue(1)
|
||||||
|
|
||||||
setOnPreferenceChangeListener{_, newValue ->
|
setOnPreferenceChangeListener{_, newValue ->
|
||||||
val selected = newValue.toString()
|
val selected = newValue.toString()
|
||||||
val index = (this.findIndexOfValue(selected) + 1).toString()
|
preferences.edit().putString(SCANLATOR_PREFERENCE, selected).commit()
|
||||||
preferences.edit().putString(SCANLATOR_PREFERENCE, index).commit()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +243,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
chapter.scanlator = Scanlators.getValueFromKey(firstGroupId)
|
chapter.scanlator = Scanlators.getValueFromKey(firstGroupId)
|
||||||
chapter.name = num + " - " + json.getString("title")
|
chapter.name = num + " - " + json.getString("title")
|
||||||
chapter.chapter_number = num.toFloat()
|
chapter.chapter_number = num.toFloat()
|
||||||
chapter.url = "$slug/$num/1"
|
chapter.url = "$slug/$num/$firstGroupId"
|
||||||
|
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
@ -318,7 +315,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
private fun update() {
|
private fun update() {
|
||||||
if (scanlatorMap.isEmpty() && !polling) {
|
if (scanlatorMap.isEmpty() && !polling) {
|
||||||
polling = true
|
polling = true
|
||||||
clientBuilder().newCall(GET("$baseUrl/api/get_all_groups/", headers)).enqueue(
|
clientBuilder().newCall(GET(scanlatorCacheUrl, headers)).enqueue(
|
||||||
object: Callback {
|
object: Callback {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
val json = JSONObject(response.body()!!.string())
|
val json = JSONObject(response.body()!!.string())
|
||||||
|
|
Loading…
Reference in New Issue