Fixed API issue caused by change on guya.moe, and added description to preferred scanlator. (#1364)
Additional bug-fixes and improvements to Guya extension.
This commit is contained in:
parent
092735d678
commit
ee434f2458
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Guya'
|
appName = 'Tachiyomi: Guya'
|
||||||
pkgNameSuffix = "en.guya"
|
pkgNameSuffix = "en.guya"
|
||||||
extClass = '.Guya'
|
extClass = '.Guya'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.os.Build
|
||||||
import android.support.v7.preference.ListPreference
|
import android.support.v7.preference.ListPreference
|
||||||
import android.support.v7.preference.PreferenceScreen
|
import android.support.v7.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.extension.BuildConfig
|
import eu.kanade.tachiyomi.extension.BuildConfig
|
||||||
|
@ -28,7 +29,10 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
override val lang = "en"
|
override val lang = "en"
|
||||||
|
|
||||||
override fun headersBuilder() = Headers.Builder().apply {
|
override fun headersBuilder() = Headers.Builder().apply {
|
||||||
add("User-Agent", "Tachiyomi/${BuildConfig.VERSION_NAME}")
|
add("User-Agent","(Android ${Build.VERSION.RELEASE}; " +
|
||||||
|
"${Build.MANUFACTURER} ${Build.MODEL}) " +
|
||||||
|
"Tachiyomi/${BuildConfig.VERSION_NAME} " +
|
||||||
|
Build.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val Scanlators: ScanlatorStore = ScanlatorStore()
|
private val Scanlators: ScanlatorStore = ScanlatorStore()
|
||||||
|
@ -61,7 +65,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
// Called when the series is loaded, or when opening in browser
|
// Called when the series is loaded, or when opening in browser
|
||||||
override fun mangaDetailsRequest(manga: SManga): Request {
|
override fun mangaDetailsRequest(manga: SManga): Request {
|
||||||
return GET("$baseUrl/reader/series/" + manga.url + "/", headers)
|
return GET("$baseUrl/reader/series/${manga.url}/", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stub
|
// Stub
|
||||||
|
@ -76,7 +80,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
// Gets the chapter list based on the series being viewed
|
// Gets the chapter list based on the series being viewed
|
||||||
override fun chapterListRequest(manga: SManga): Request {
|
override fun chapterListRequest(manga: SManga): Request {
|
||||||
return GET("$baseUrl/api/series/" + manga.url + "/", headers)
|
return GET("$baseUrl/api/series/${manga.url}/", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called after the request
|
// Called after the request
|
||||||
|
@ -94,6 +98,10 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
|
return GET("$baseUrl/api/series/${chapter.url.split("/")[0]}/", headers)
|
||||||
|
}
|
||||||
|
|
||||||
// Stub
|
// Stub
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
throw Exception("Unused")
|
throw Exception("Unused")
|
||||||
|
@ -164,7 +172,13 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
entries = scanlators
|
entries = scanlators
|
||||||
entryValues = scanlatorsIndex
|
entryValues = scanlatorsIndex
|
||||||
summary = "%s"
|
summary = "Current: %s\n\n" +
|
||||||
|
"This setting sets the scanlation group to prioritize " +
|
||||||
|
"on chapter refresh/update. It will get the next available if " +
|
||||||
|
"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 ->
|
||||||
|
@ -232,7 +246,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 = "/api/series/$slug/$num/1"
|
chapter.url = "$slug/$num/1"
|
||||||
|
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue