Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

[BugFix] open_plugins allow more than one entry with a plugin / parameter

you should be able to have multiple parameters to a single plugin
you can do this from outsid the plugin, but not from within the plugin
this makes it possible to have several entries with the same
plugin and a different parameter for each entry

it now also updates the name of the entry to the name of the parameter
instead of the name of the plugin (unless user edited it)

Change-Id: Ifb52b21e3b8ed3257364635b5d92e7c21a35a199

+22 -4
+22 -4
apps/plugins/open_plugins.c
··· 176 176 (op_entry.lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY); 177 177 } 178 178 179 - static void op_entry_set_name(void) 179 + static bool op_entry_set_name(void) 180 180 { 181 181 char tmp_buf[OPEN_PLUGIN_NAMESZ+1]; 182 182 rb->strlcpy(tmp_buf, op_entry.name, OPEN_PLUGIN_NAMESZ); 183 + uint32_t crc = rb->crc_32(tmp_buf, sizeof(tmp_buf), 0xffffffff); 184 + 183 185 if (rb->kbd_input(tmp_buf, OPEN_PLUGIN_NAMESZ, NULL) >= 0) 186 + { 184 187 rb->strlcpy(op_entry.name, tmp_buf, OPEN_PLUGIN_NAMESZ); 188 + return crc != rb->crc_32(tmp_buf, sizeof(tmp_buf), 0xffffffff); 189 + } 190 + return false; 185 191 } 186 192 187 193 static int op_entry_set_path(void) ··· 392 398 rb->strlcpy(op_entry.param, parameter, OPEN_PLUGIN_BUFSZ); 393 399 394 400 /* hash on the parameter path if it is a file */ 395 - if (op_entry.lang_id <0 && key == op_entry.path && 401 + if (op_entry.lang_id <0 && (key == op_entry.path || key == NULL) && 396 402 rb->file_exists(op_entry.param)) 397 403 { 398 - open_plugin_get_hash(op_entry.path, &newhash); 404 + open_plugin_get_hash(op_entry.param, &newhash); 399 405 op_entry.hash = newhash; 400 406 } 401 407 } ··· 692 698 { 693 699 int selected_item; 694 700 bool exit = false; 701 + bool name_set = false; 695 702 int action = 0; 696 703 697 704 if (!op_entry_read(fd_dat, selection, op_entry_sz)) ··· 713 720 { 714 721 case ACTION_STD_OK: 715 722 if (selected_item == 0) 716 - op_entry_set_name(); 723 + { 724 + name_set = op_entry_set_name(); 725 + } 717 726 else if (selected_item == 2) 718 727 op_entry_set_path(); 719 728 else if (selected_item == 4) 729 + { 720 730 op_entry_set_param(); 731 + /* if user already set the name they probably don't want us to change it */ 732 + if (!name_set && op_entry.lang_id < 0 && rb->file_exists(op_entry.param)) 733 + { 734 + char *slash=strrchr(op_entry.param, '/'); 735 + if(slash) 736 + rb->strlcpy(op_entry.name, slash+1, OPEN_PLUGIN_NAMESZ); 737 + } 738 + } 721 739 else 722 740 exit = true; 723 741