Revert "Always attempt to split tall images when downloading"

This partially reverts commit 2769525b2c.

Keeps the change to silently ignore spliting errors since it falls back to
the original images in those cases.
This commit is contained in:
arkon 2023-03-20 08:41:55 -04:00
parent 7ec5a51eb8
commit ac0596a53d
4 changed files with 10 additions and 0 deletions

View File

@ -55,6 +55,11 @@ object SettingsDownloadScreen : SearchableSettings {
pref = downloadPreferences.saveChaptersAsCBZ(), pref = downloadPreferences.saveChaptersAsCBZ(),
title = stringResource(R.string.save_chapter_as_cbz), title = stringResource(R.string.save_chapter_as_cbz),
), ),
Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.splitTallImages(),
title = stringResource(R.string.split_tall_images),
subtitle = stringResource(R.string.split_tall_images_summary),
),
getDeleteChaptersGroup( getDeleteChaptersGroup(
downloadPreferences = downloadPreferences, downloadPreferences = downloadPreferences,
categories = allCategories, categories = allCategories,

View File

@ -495,6 +495,8 @@ class Downloader(
} }
private fun splitTallImageIfNeeded(page: Page, tmpDir: UniFile) { private fun splitTallImageIfNeeded(page: Page, tmpDir: UniFile) {
if (!downloadPreferences.splitTallImages().get()) return
try { try {
val filenamePrefix = String.format("%03d", page.number) val filenamePrefix = String.format("%03d", page.number)
val imageFile = tmpDir.listFiles()?.firstOrNull { it.name.orEmpty().startsWith(filenamePrefix) } val imageFile = tmpDir.listFiles()?.firstOrNull { it.name.orEmpty().startsWith(filenamePrefix) }

View File

@ -14,6 +14,8 @@ class DownloadPreferences(
fun saveChaptersAsCBZ() = preferenceStore.getBoolean("save_chapter_as_cbz", true) fun saveChaptersAsCBZ() = preferenceStore.getBoolean("save_chapter_as_cbz", true)
fun splitTallImages() = preferenceStore.getBoolean("split_tall_images", false)
fun autoDownloadWhileReading() = preferenceStore.getInt("auto_download_while_reading", 0) fun autoDownloadWhileReading() = preferenceStore.getInt("auto_download_while_reading", 0)
fun removeAfterReadSlots() = preferenceStore.getInt("remove_after_read_slots", -1) fun removeAfterReadSlots() = preferenceStore.getInt("remove_after_read_slots", -1)

View File

@ -443,6 +443,7 @@
</plurals> </plurals>
<string name="download_ahead_info">Only works on entries in library and if the current chapter plus the next one are already downloaded</string> <string name="download_ahead_info">Only works on entries in library and if the current chapter plus the next one are already downloaded</string>
<string name="save_chapter_as_cbz">Save as CBZ archive</string> <string name="save_chapter_as_cbz">Save as CBZ archive</string>
<string name="split_tall_images">Split tall images</string>
<string name="split_tall_images_summary">Improves reader performance</string> <string name="split_tall_images_summary">Improves reader performance</string>
<!-- Tracking section --> <!-- Tracking section -->