Skip to content

Commit

Permalink
Add a metric for tracking searches initiated while openlyrics is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesh committed Aug 24, 2024
1 parent d6e1c7a commit 3f7cbb6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lyric_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ static void internal_search_for_all_lyrics_from_source(LyricSearchHandle& handle
static void internal_search_for_all_lyrics(LyricSearchHandle& handle, std::string artist, std::string album, std::string title)
{
LOG_INFO("Searching for lyrics using custom parameters...");
assert(handle.get_type() != LyricUpdate::Type::AutoSearch);
handle.set_started();

// NOTE: This is only ever used in this function as a const&,
Expand Down
6 changes: 6 additions & 0 deletions src/lyric_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "lyric_io.h"
#include "lyric_search.h"
#include "metadb_index_search_avoidance.h"
#include "metrics.h"
#include "tag_util.h"
#include "ui_hooks.h"

Expand Down Expand Up @@ -138,6 +139,11 @@ void LyricAutosearchManager::initiate_search(metadb_handle_ptr track, metadb_v2_
m_handle_mutex.lock();
m_search_handles.push_back({std::move(handle), avoid_reason});
m_handle_mutex.unlock();

if(IsIconic(core_api::get_main_window()) || (num_visible_lyric_panels() == 0))
{
metrics::log_hidden_search();
}
}

std::optional<std::string> LyricAutosearchManager::get_progress_message()
Expand Down
6 changes: 6 additions & 0 deletions src/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ DECLARE_FEATURETRACKER(externalwindow, { 0xf426ac64, 0x4aa7, 0x403a, { 0x97, 0x6
DECLARE_FEATURETRACKER(manualscroll, { 0x3b751894, 0x9163, 0x4902, { 0x8d, 0x65, 0x3, 0x10, 0x35, 0x21, 0xb5, 0x4d } });
DECLARE_FEATURETRACKER(lyricupload, { 0xf4975820, 0x23c, 0x44e6, { 0x8d, 0x30, 0xf1, 0xb8, 0x63, 0x2a, 0x8c, 0x46 } });
DECLARE_FEATURETRACKER(remotetrack, { 0xa0cbfda0, 0x99c3, 0x4be7, { 0x86, 0xf0, 0x8e, 0xb2, 0xd1, 0x48, 0x89, 0x9 } });
DECLARE_FEATURETRACKER(hiddensearch, { 0xf056ae7c, 0xae9c, 0x45de, { 0x82, 0xb3, 0x72, 0x99, 0x4d, 0xba, 0xff, 0x41 } });

void metrics::log_used_bulk_search()
{
Expand Down Expand Up @@ -183,6 +184,11 @@ void metrics::log_searched_for_lyrics_for_a_remote_track()
featuretrack_remotetrack.log_usage();
}

void metrics::log_hidden_search()
{
featuretrack_hiddensearch.log_usage();
}

static const char* get_windows_version_string()
{
// NOTE: There is no `IsWindows11OrGreater()` function
Expand Down
1 change: 1 addition & 0 deletions src/metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ namespace metrics
void log_used_manual_scroll();
void log_used_lyric_upload();
void log_searched_for_lyrics_for_a_remote_track();
void log_hidden_search();
}

0 comments on commit 3f7cbb6

Please sign in to comment.