summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
authorPaul Sauro <olsroparadise@proton.me>2024-08-28 22:55:52 +0200
committerWilliam Wilgus <me.theuser@yahoo.com>2024-08-31 10:44:20 -0400
commitc16dbbfd1fb7bf4bc268a4693bbed21497456b30 (patch)
tree3faea1f6d294f5835f72075b9a27e996525aef0a /apps/tree.c
parentf6e8c20188276251d8b3ec512be81f2460ce39e7 (diff)
downloadrockbox-c16dbbfd1fb7bf4bc268a4693bbed21497456b30.tar.gz
rockbox-c16dbbfd1fb7bf4bc268a4693bbed21497456b30.zip
Reworks to the shuffle system to improve performance and allow fast shuffling from a big library (but this work for all database views)
This improvement brings a huge performance improvement to start a random mix of your library. Previously, the only way to do this was to increase the size of a playlist with absurd sizes number. Now it will respect the limitation but will insert random songs from the current view. Database: Add true random songs in playlist if it is gonna exceed its maximum capacity More context is available here : https://www.reddit.com/r/rockbox/comments/1ez0mq4/i_developped_true_full_library_shuffle_for/ Also : - Improved layout in the DB browser - New default max playlists capacity is now 2000 on old PortalPlayer targets to give a better user experience and not having to wait dozens of seconds while creating a playlist - "Show insert shuffled" option is now true by default - Add a new shortcut to play all songs shuffled in the DB browser - Now the feature is fully optional and enabled only on targets that have more than 2MB of RAM - Add entries about this feature in the manual to explain it to the users Change-Id: I1aebaf7ebcff2bf907080f1861027d530619097c Change-Id: I3354923b148eeef1975171990e814a1a505d1df0
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 71a7ee3f62..b4cd9d77b0 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -735,6 +735,17 @@ static int dirbrowse(void)
735 oldbutton = button; 735 oldbutton = button;
736 gui_synclist_do_button(&tree_lists, &button); 736 gui_synclist_do_button(&tree_lists, &button);
737 tc.selected_item = gui_synclist_get_sel_pos(&tree_lists); 737 tc.selected_item = gui_synclist_get_sel_pos(&tree_lists);
738 int customaction = ONPLAY_NO_CUSTOMACTION;
739 bool do_restore_display = true;
740 #ifdef HAVE_TAGCACHE
741 if (id3db && (button == ACTION_STD_OK || button == ACTION_STD_CONTEXT)) {
742 customaction = tagtree_get_custom_action(&tc);
743 if (customaction == ONPLAY_CUSTOMACTION_SHUFFLE_SONGS) {
744 button = ACTION_STD_CONTEXT; /** The code to insert shuffled is on the context branch of the switch so we always go here */
745 do_restore_display = false;
746 }
747 }
748 #endif
738 switch ( button ) { 749 switch ( button ) {
739 case ACTION_STD_OK: 750 case ACTION_STD_OK:
740 /* nothing to do if no files to display */ 751 /* nothing to do if no files to display */
@@ -773,7 +784,7 @@ static int dirbrowse(void)
773 default: 784 default:
774 break; 785 break;
775 } 786 }
776 restore = true; 787 restore = do_restore_display;
777 break; 788 break;
778 789
779 case ACTION_STD_CANCEL: 790 case ACTION_STD_CANCEL:
@@ -798,12 +809,12 @@ static int dirbrowse(void)
798 if (ft_exit(&tc) == 3) 809 if (ft_exit(&tc) == 3)
799 exit_func = true; 810 exit_func = true;
800 811
801 restore = true; 812 restore = do_restore_display;
802 break; 813 break;
803 814
804 case ACTION_TREE_STOP: 815 case ACTION_TREE_STOP:
805 if (list_stop_handler()) 816 if (list_stop_handler())
806 restore = true; 817 restore = do_restore_display;
807 break; 818 break;
808 819
809 case ACTION_STD_MENU: 820 case ACTION_STD_MENU:
@@ -851,7 +862,7 @@ static int dirbrowse(void)
851 skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); 862 skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL);
852 } 863 }
853 864
854 restore = true; 865 restore = do_restore_display;
855 break; 866 break;
856 } 867 }
857#endif 868#endif
@@ -872,7 +883,7 @@ static int dirbrowse(void)
872 break; 883 break;
873 884
874 if(!numentries) 885 if(!numentries)
875 onplay_result = onplay(NULL, 0, curr_context, hotkey); 886 onplay_result = onplay(NULL, 0, curr_context, hotkey, customaction);
876 else { 887 else {
877#ifdef HAVE_TAGCACHE 888#ifdef HAVE_TAGCACHE
878 if (id3db) 889 if (id3db)
@@ -902,7 +913,7 @@ static int dirbrowse(void)
902 ft_assemble_path(buf, sizeof(buf), currdir, entry->name); 913 ft_assemble_path(buf, sizeof(buf), currdir, entry->name);
903 914
904 } 915 }
905 onplay_result = onplay(buf, attr, curr_context, hotkey); 916 onplay_result = onplay(buf, attr, curr_context, hotkey, customaction);
906 } 917 }
907 switch (onplay_result) 918 switch (onplay_result)
908 { 919 {
@@ -911,7 +922,7 @@ static int dirbrowse(void)
911 break; 922 break;
912 923
913 case ONPLAY_OK: 924 case ONPLAY_OK:
914 restore = true; 925 restore = do_restore_display;
915 break; 926 break;
916 927
917 case ONPLAY_RELOAD_DIR: 928 case ONPLAY_RELOAD_DIR:
@@ -988,7 +999,7 @@ static int dirbrowse(void)
988 999
989 lastfilter = *tc.dirfilter; 1000 lastfilter = *tc.dirfilter;
990 lastsortcase = global_settings.sort_case; 1001 lastsortcase = global_settings.sort_case;
991 restore = true; 1002 restore = do_restore_display;
992 } 1003 }
993 1004
994 if (exit_func) 1005 if (exit_func)