Allow hitomi users to select whether they want to download images as Webp or not
This commit is contained in:
parent
4771fa529d
commit
ff1e0d7578
@ -270,4 +270,6 @@ object PreferenceKeys {
|
||||
const val sourcesSort = "sources_sort"
|
||||
|
||||
const val recommendsInOverflow = "recommends_in_overflow"
|
||||
|
||||
const val hitomiAlwaysWebp = "hitomi_always_webp"
|
||||
}
|
||||
|
||||
@ -370,4 +370,6 @@ class PreferencesHelper(val context: Context) {
|
||||
fun sourceSorting() = flowPrefs.getInt(Keys.sourcesSort, 0)
|
||||
|
||||
fun recommendsInOverflow() = flowPrefs.getBoolean(Keys.recommendsInOverflow, false)
|
||||
|
||||
fun hitomiAlwaysWebp() = flowPrefs.getBoolean(Keys.hitomiAlwaysWebp, true)
|
||||
}
|
||||
|
||||
@ -375,8 +375,8 @@ class Hitomi(val context: Context) : HttpSource(), LewdSource<HitomiSearchMetada
|
||||
val json = JsonParser.parseString(str.removePrefix("var galleryinfo = "))
|
||||
return json["files"].array.mapIndexed { index, jsonElement ->
|
||||
val hash = jsonElement["hash"].string
|
||||
val ext = if (jsonElement["haswebp"].string == "0") jsonElement["name"].string.split('.').last() else "webp"
|
||||
val path = if (jsonElement["haswebp"].string == "0") "images" else "webp"
|
||||
val ext = if (jsonElement["haswebp"].string == "0" || !prefs.hitomiAlwaysWebp().get()) jsonElement["name"].string.split('.').last() else "webp"
|
||||
val path = if (jsonElement["haswebp"].string == "0" || !prefs.hitomiAlwaysWebp().get()) "images" else "webp"
|
||||
val hashPath1 = hash.takeLast(1)
|
||||
val hashPath2 = hash.takeLast(3).take(2)
|
||||
Page(
|
||||
|
||||
@ -22,5 +22,13 @@ class SettingsHlController : SettingsController() {
|
||||
key = PreferenceKeys.eh_hl_useHighQualityThumbs
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
titleRes = R.string.always_download_webp
|
||||
summaryOn = context.getString(R.string.always_download_webp_summary_on)
|
||||
summaryOff = context.getString(R.string.always_download_webp_summary_off)
|
||||
key = PreferenceKeys.hitomiAlwaysWebp
|
||||
defaultValue = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,6 +142,11 @@
|
||||
<!-- Library settings -->
|
||||
<string name="pref_skip_pre_migration_summary">Use last saved pre-migration preferences and sources to mass migrate</string>
|
||||
|
||||
<!-- Hitomi.la settings -->
|
||||
<string name="always_download_webp">Always download webp</string>
|
||||
<string name="always_download_webp_summary_on">Will always try to download images as webp when possible</string>
|
||||
<string name="always_download_webp_summary_off">Will only download images as webp if its the only option, most images will be jpg</string>
|
||||
|
||||
<!-- Other Settings -->
|
||||
<string name="high_quality_thumbnails">Use high-quality thumbnails</string>
|
||||
<string name="high_quality_thumbnails_summary">May slow down search results</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user