lastfm_scrobbler speed up track culling, better duplicate logic

rather than going through the whole file each time we can just walk
through the remainder speeds up duplicate removal by quite a bit

check timestamp of tracks to not remove multiple plays of the same song
at different times, unless back to back (then its probably a resume after
shutdown)

devices without RTC use current_tick but thats in centiseconds
convert to milliseconds so we can use the timestamp in the above calculations

my fix to the scrobbler_viewer makes the include menus disappear as
soon as you hide columns so explicitly mark if we are
dealing with a scrobbler log at load

Change-Id: I11bbebe9af45945a7e1326a5e419290086b05aaa
This commit is contained in:
William Wilgus 2025-01-13 10:40:41 -05:00
parent ab9b687607
commit 0493ee19c3
3 changed files with 59 additions and 49 deletions

View file

@ -62,7 +62,7 @@ struct printcell_data_t {
size_t buf_size;
off_t buf_used;
char header[PRINTCELL_MAXLINELEN];
bool is_scrobbler;
};
enum e_find_type {
@ -730,7 +730,7 @@ static int scrobbler_context_menu(struct printcell_data_t *pc_data)
menu_item[2]= "Include";
menu_item[3]= "Custom Filter";
if (pc_data->view_columns < SCROBBLER_MIN_COLUMNS)
if (!pc_data->is_scrobbler)
col = -1;
if (col == -1)
@ -947,11 +947,11 @@ static void synclist_set(int selected_item, int items, int sel_size, struct prin
pc_data->header, Icon_Rockbox);
printcell_enable(true);
int max_cols = count_max_columns(items, pcs.text_delimeter,
SCROBBLER_MIN_COLUMNS, pc_data);
if (max_cols < SCROBBLER_MIN_COLUMNS) /* not a scrobbler file? */
{
pc_data->is_scrobbler = false;
/*check for a playlist_control file or a playback log*/
max_cols = count_max_columns(items, ':', 3, pc_data);
@ -1064,6 +1064,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->memset(&printcell_data, 0, sizeof (struct printcell_data_t));
printcell_data.fd_cur = -1;
printcell_data.view_lastcol = -1;
printcell_data.is_scrobbler = true;
if (rb->file_exists(filename))
{