Defaults: Deprecate DKOPTREADER_CONFIG_DOC_LANGS_TEXT

It's unused since #11977, dropping it ensures we no longer show it in
the advanced settings UI.
This commit is contained in:
NiLuJe
2024-09-10 20:43:49 +02:00
parent 7ff40a3412
commit 89cceee9f1
2 changed files with 12 additions and 2 deletions

View File

@@ -88,7 +88,6 @@ DKOPTREADER_CONFIG_CONTRAST = 1.0, -- range from 0.2 to 2.0
DKOPTREADER_CONFIG_WORD_SPACINGS = {0.05, -0.2, 0.375}, -- range from (+/-)0.05 to (+/-)0.5 DKOPTREADER_CONFIG_WORD_SPACINGS = {0.05, -0.2, 0.375}, -- range from (+/-)0.05 to (+/-)0.5
DKOPTREADER_CONFIG_DEFAULT_WORD_SPACING = -0.2, -- range from (+/-)0.05 to (+/-)0.5 DKOPTREADER_CONFIG_DEFAULT_WORD_SPACING = -0.2, -- range from (+/-)0.05 to (+/-)0.5
-- document languages for OCR -- document languages for OCR
DKOPTREADER_CONFIG_DOC_LANGS_TEXT = {"English", "Chinese"},
DKOPTREADER_CONFIG_DOC_LANGS_CODE = {"eng", "chi_sim"}, -- language code, make sure you have corresponding training data DKOPTREADER_CONFIG_DOC_LANGS_CODE = {"eng", "chi_sim"}, -- language code, make sure you have corresponding training data
DKOPTREADER_CONFIG_DOC_DEFAULT_LANG_CODE = "eng", -- that have filenames starting with the language codes DKOPTREADER_CONFIG_DOC_DEFAULT_LANG_CODE = "eng", -- that have filenames starting with the language codes

View File

@@ -10,7 +10,7 @@ local util = require("util")
local _ = require("gettext") local _ = require("gettext")
-- Date at which the last migration snippet was added -- Date at which the last migration snippet was added
local CURRENT_MIGRATION_DATE = 20240731 local CURRENT_MIGRATION_DATE = 20240911
-- Retrieve the date of the previous migration, if any -- Retrieve the date of the previous migration, if any
local last_migration_date = G_reader_settings:readSetting("last_migration_date", 0) local last_migration_date = G_reader_settings:readSetting("last_migration_date", 0)
@@ -697,5 +697,16 @@ if last_migration_date < 20240731 then
end end
end end
-- 20240911, Defaults: Deprecate DKOPTREADER_CONFIG_DOC_LANGS_TEXT after #11977, https://github.com/koreader/koreader/pull/12504
if last_migration_date < 20240911 then
logger.info("Performing one-time migration for 20240911")
if G_defaults:hasBeenCustomized("DKOPTREADER_CONFIG_DOC_LANGS_TEXT") then
G_defaults:delSetting("DKOPTREADER_CONFIG_DOC_LANGS_TEXT")
end
G_defaults:flush()
end
-- We're done, store the current migration date -- We're done, store the current migration date
G_reader_settings:saveSetting("last_migration_date", CURRENT_MIGRATION_DATE) G_reader_settings:saveSetting("last_migration_date", CURRENT_MIGRATION_DATE)