Add a setting for document matching method

This commit is contained in:
Justin Mitchell
2026-01-04 23:48:42 -05:00
parent ae34fc76e1
commit 77bb97339d
8 changed files with 133 additions and 26 deletions

View File

@@ -17,13 +17,22 @@
class KOReaderDocumentId {
public:
/**
* Calculate the KOReader document hash for a file.
* Calculate the KOReader document hash for a file (binary/content-based).
*
* @param filePath Path to the file (typically an EPUB)
* @return 32-character lowercase hex string, or empty string on failure
*/
static std::string calculate(const std::string& filePath);
/**
* Calculate document hash from filename only (filename-based sync mode).
* This is simpler and works when files have the same name across devices.
*
* @param filePath Path to the file (only the filename portion is used)
* @return 32-character lowercase hex MD5 of the filename
*/
static std::string calculateFromFilename(const std::string& filePath);
private:
// Size of each chunk to read at each offset
static constexpr size_t CHUNK_SIZE = 1024;