summaryrefslogtreecommitdiff
path: root/src/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/database')
-rw-r--r--src/database/CMakeLists.txt2
-rw-r--r--src/database/tag_processor.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/database/CMakeLists.txt b/src/database/CMakeLists.txt
index 47f8fe31..27cc7071 100644
--- a/src/database/CMakeLists.txt
+++ b/src/database/CMakeLists.txt
@@ -1,7 +1,7 @@
idf_component_register(
SRCS "env_esp.cpp" "database.cpp" "tag_processor.cpp" "db_task.cpp"
INCLUDE_DIRS "include"
- REQUIRES "result" "span" "esp_psram" "fatfs" "libtags")
+ REQUIRES "result" "span" "esp_psram" "fatfs" "libtags" "komihash")
target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS})
diff --git a/src/database/tag_processor.cpp b/src/database/tag_processor.cpp
index 13a284f6..c1795686 100644
--- a/src/database/tag_processor.cpp
+++ b/src/database/tag_processor.cpp
@@ -2,6 +2,8 @@
#include <esp_log.h>
#include <ff.h>
+#include <komihash.h>
+#include <stdint.h>
#include <tags.h>
namespace database {
@@ -97,6 +99,13 @@ auto GetInfo(const std::string& path, FileInfo* out) -> bool {
ESP_LOGI(kTag, "artist: %s", aux.artist.c_str());
ESP_LOGI(kTag, "album: %s", aux.album.c_str());
ESP_LOGI(kTag, "title: %s", aux.title.c_str());
+ komihash_stream_t hash;
+ komihash_stream_init(&hash, 0);
+ komihash_stream_update(&hash, aux.artist.c_str(), aux.artist.length());
+ komihash_stream_update(&hash, aux.album.c_str(), aux.album.length());
+ komihash_stream_update(&hash, aux.title.c_str(), aux.title.length());
+ uint64_t final_hash = komihash_stream_final(&hash);
+ ESP_LOGI(kTag, "hash: %#llx", final_hash);
out->is_playable = true;
out->title = aux.title;
return true;