Output hash of song triple

custom
jacqueline 2 years ago
parent 86c44199b0
commit fe19478e0f
  1. 2
      src/database/CMakeLists.txt
  2. 9
      src/database/tag_processor.cpp

@ -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})

@ -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;

Loading…
Cancel
Save