Don't use localized numbers for downloaded image filenames
Probably fixes #10258 (cherry picked from commit 19f0175a56b00afd772d5d0c4909c49371a59bbe) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt # core/src/main/java/tachiyomi/core/util/system/ImageUtil.kt
This commit is contained in:
parent
bb33624fb7
commit
7f89587889
@ -140,7 +140,7 @@ private fun TrackerStats(
|
|||||||
val meanScoreStr = remember(data.trackedTitleCount, data.meanScore) {
|
val meanScoreStr = remember(data.trackedTitleCount, data.meanScore) {
|
||||||
if (data.trackedTitleCount > 0 && !data.meanScore.isNaN()) {
|
if (data.trackedTitleCount > 0 && !data.meanScore.isNaN()) {
|
||||||
// All other numbers are localized in English
|
// All other numbers are localized in English
|
||||||
String.format(Locale.ENGLISH, "%.2f ★", data.meanScore)
|
"%.2f ★".format(Locale.ENGLISH, data.meanScore)
|
||||||
} else {
|
} else {
|
||||||
notApplicable
|
notApplicable
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ import uy.kohesive.injekt.api.get
|
|||||||
import java.io.BufferedOutputStream
|
import java.io.BufferedOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
import java.util.Locale
|
||||||
import java.util.zip.CRC32
|
import java.util.zip.CRC32
|
||||||
import java.util.zip.ZipEntry
|
import java.util.zip.ZipEntry
|
||||||
import java.util.zip.ZipOutputStream
|
import java.util.zip.ZipOutputStream
|
||||||
@ -441,7 +442,7 @@ class Downloader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val digitCount = (download.pages?.size ?: 0).toString().length.coerceAtLeast(3)
|
val digitCount = (download.pages?.size ?: 0).toString().length.coerceAtLeast(3)
|
||||||
val filename = String.format("%0${digitCount}d", page.number)
|
val filename = "%0${digitCount}d".format(Locale.ENGLISH, page.number)
|
||||||
val tmpFile = tmpDir.findFile("$filename.tmp")
|
val tmpFile = tmpDir.findFile("$filename.tmp")
|
||||||
|
|
||||||
// Delete temp file if it exists
|
// Delete temp file if it exists
|
||||||
@ -561,7 +562,7 @@ class Downloader(
|
|||||||
if (!downloadPreferences.splitTallImages().get()) return
|
if (!downloadPreferences.splitTallImages().get()) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val filenamePrefix = String.format("%03d", page.number)
|
val filenamePrefix = "%03d".format(Locale.ENGLISH, page.number)
|
||||||
val imageFile = tmpDir.listFiles()?.firstOrNull { it.name.orEmpty().startsWith(filenamePrefix) }
|
val imageFile = tmpDir.listFiles()?.firstOrNull { it.name.orEmpty().startsWith(filenamePrefix) }
|
||||||
?: error(context.stringResource(MR.strings.download_notifier_split_page_not_found, page.number))
|
?: error(context.stringResource(MR.strings.download_notifier_split_page_not_found, page.number))
|
||||||
|
|
||||||
@ -611,11 +612,7 @@ class Downloader(
|
|||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (downloadedImagesCount != downloadPageCount) {
|
return downloadedImagesCount == downloadPageCount
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +37,7 @@ import java.io.File
|
|||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.security.SecureRandom
|
import java.security.SecureRandom
|
||||||
|
import java.util.Locale
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@ -366,6 +367,7 @@ object ImageUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun splitImageName(filenamePrefix: String, index: Int) = "${filenamePrefix}__${"%03d".format(
|
private fun splitImageName(filenamePrefix: String, index: Int) = "${filenamePrefix}__${"%03d".format(
|
||||||
|
Locale.ENGLISH,
|
||||||
index + 1,
|
index + 1,
|
||||||
)}.jpg"
|
)}.jpg"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user