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.

[Feature] filetree fallback to loading a playlist from disk

give user option to load playlist from disk when
namebuffer is too small -- max_playlist size still
limits the total entries but filename length
won't stop them from playing the directory

Change-Id: I1787689417661ea670a211f575f2c52e84465869

authored by

William Wilgus and committed by
William Wilgus
282a54b2 593103cd

+26 -4
+19 -2
apps/filetree.c
··· 72 72 int ft_build_playlist(struct tree_context* c, int start_index) 73 73 { 74 74 int i; 75 + int res = 0; 75 76 int start=start_index; 76 77 77 78 tree_lock_cache(c); ··· 81 82 { 82 83 if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) 83 84 { 84 - if (playlist_add(entries[i].name) < 0) 85 + res = playlist_add(entries[i].name); 86 + if (res < 0) 85 87 break; 86 88 } 87 89 else ··· 92 94 } 93 95 } 94 96 95 - tree_unlock_cache(c); 97 + if (res == -2) /* name buffer is full store to disk? */ 98 + { 99 + if (yesno_pop(ID2P(LANG_CATALOG_ADD_TO_NEW))) 100 + { 101 + char playlist_dir[MAX_PATH]; 102 + strmemccpy(playlist_dir, c->currdir, sizeof(playlist_dir)); 103 + tree_unlock_cache(c); 104 + if (playlist_create(playlist_dir, "dynamic.m3u8") >= 0) 105 + { 106 + playlist_insert_directory(NULL, playlist_dir, 107 + PLAYLIST_REPLACE, false, false); 108 + } 109 + } 110 + } 111 + else 112 + tree_unlock_cache(c); 96 113 97 114 return start_index; 98 115 }
+7 -2
apps/playlist.c
··· 2082 2082 struct playlist_info* playlist = &current_playlist; 2083 2083 int len = strlen(filename); 2084 2084 2085 - if((len+1 > playlist->buffer_size - playlist->buffer_end_pos) || 2086 - (playlist->amount >= playlist->max_playlist_size)) 2085 + if(len+1 > playlist->buffer_size - playlist->buffer_end_pos) 2086 + { 2087 + notify_buffer_full(); 2088 + return -2; 2089 + } 2090 + 2091 + if(playlist->amount >= playlist->max_playlist_size) 2087 2092 { 2088 2093 notify_buffer_full(); 2089 2094 return -1;