A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

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

playlist: Remove playlist_add()

It was only used in filetree.c. It's still implemented in Lua so
scripts using rb.playlist_add() won't break, but has been removed
from the Lua API "backend".

Change-Id: I5625a47f0692456008c6b10dee14755151d22f29

authored by

Aidan MacDonald and committed by
Solomon Peachy
9ba51e35 129fb401

+14 -28
+5 -3
apps/filetree.c
··· 74 74 int i; 75 75 int res = 0; 76 76 int start=start_index; 77 + struct playlist_info *playlist = playlist_get_current(); 77 78 78 79 tree_lock_cache(c); 79 80 struct entry *entries = tree_get_entries(c); ··· 82 83 { 83 84 if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) 84 85 { 85 - res = playlist_add(entries[i].name); 86 + res = playlist_insert_track(playlist, entries[i].name, 87 + PLAYLIST_INSERT_LAST, false, false); 86 88 if (res < 0) 87 89 break; 88 90 } ··· 127 129 if (playlist_create(dirname, filename) != -1) 128 130 { 129 131 if (global_settings.playlist_shuffle) 130 - { 131 132 playlist_shuffle(current_tick, -1); 132 - } 133 133 134 + playlist_set_modified(NULL, false); 134 135 playlist_start(0, 0, 0); 135 136 return true; 136 137 } ··· 528 529 start_index = 0; 529 530 } 530 531 532 + playlist_set_modified(NULL, false); 531 533 playlist_start(start_index, 0, 0); 532 534 play = true; 533 535 }
+2 -15
apps/playlist.c
··· 1207 1207 if (global_settings.playlist_shuffle) 1208 1208 playlist_shuffle(current_tick, -1); 1209 1209 1210 + playlist_set_modified(NULL, false); 1211 + 1210 1212 if (play_last && direction <= 0) 1211 1213 index = current_playlist.amount - 1; 1212 1214 else ··· 2022 2024 pl_close_control(playlist); 2023 2025 2024 2026 playlist_write_unlock(playlist); 2025 - } 2026 - 2027 - /* 2028 - * Add track to end of the playlist. Prefer playlist_insert_track(), 2029 - * this is DEPRECATED and will be going away at some point. 2030 - */ 2031 - int playlist_add(const char *filename) 2032 - { 2033 - int ret = playlist_insert_track(NULL, filename, PLAYLIST_INSERT_LAST, 2034 - false, true); 2035 - if (ret < 0) 2036 - return ret; 2037 - 2038 - playlist_set_modified(NULL, false); 2039 - return ret; 2040 2027 } 2041 2028 2042 2029 /* returns number of tracks in playlist (includes queued/inserted tracks) */
-1
apps/playlist.h
··· 103 103 void playlist_shutdown(void); 104 104 int playlist_create(const char *dir, const char *file); 105 105 int playlist_resume(void); 106 - int playlist_add(const char *filename); 107 106 int playlist_shuffle(int random_seed, int start_index); 108 107 unsigned int playlist_get_filename_crc32(struct playlist_info *playlist, 109 108 int index);
-1
apps/plugin.c
··· 692 692 playlist_resume_track, 693 693 playlist_set_modified, 694 694 playlist_start, 695 - playlist_add, 696 695 playlist_sync, 697 696 playlist_remove_all_tracks, 698 697 playlist_create,
-1
apps/plugin.h
··· 797 797 void (*playlist_set_modified)(struct playlist_info *playlist, bool modified); 798 798 void (*playlist_start)(int start_index, unsigned long elapsed, 799 799 unsigned long offset); 800 - int (*playlist_add)(const char *filename); 801 800 void (*playlist_sync)(struct playlist_info* playlist); 802 801 int (*playlist_remove_all_tracks)(struct playlist_info *playlist); 803 802 int (*playlist_create)(const char *dir, const char *file);
+1 -1
apps/plugins/lua/include_lua/playlist.lua
··· 28 28 return rb.playlist("amount") 29 29 end 30 30 rb.playlist_add = function (filename) 31 - return rb.playlist("add", filename) 31 + return rb.playlist("insert_track", filename, rb.PLAYLIST_INSERT_LAST, false, true) 32 32 end 33 33 rb.playlist_create = function(dir, filename) 34 34 return rb.playlist("create", dir, filename)
+2 -6
apps/plugins/lua/rocklib.c
··· 317 317 RB_WRAP(playlist) 318 318 { 319 319 /* just passes NULL to work with the current playlist */ 320 - enum e_playlist {PLAYL_AMOUNT = 0, PLAYL_ADD, PLAYL_CREATE, 320 + enum e_playlist {PLAYL_AMOUNT = 0, PLAYL_CREATE, 321 321 PLAYL_START, PLAYL_RESUMETRACK, PLAYL_RESUME, 322 322 PLAYL_SHUFFLE, PLAYL_SYNC, PLAYL_REMOVEALLTRACKS, 323 323 PLAYL_INSERTTRACK, PLAYL_INSERTDIRECTORY, PLAYL_INSERTPLAYL, 324 324 PLAYL_ECOUNT}; 325 325 326 - const char *playlist_option[] = {"amount", "add", "create", "start", "resume_track", 326 + const char *playlist_option[] = {"amount", "create", "start", "resume_track", 327 327 "resume", "shuffle", "sync", "remove_all_tracks", 328 328 "insert_track", "insert_directory", "insert_playlist", NULL}; 329 329 ··· 338 338 { 339 339 case PLAYL_AMOUNT: 340 340 result = rb->playlist_amount(); 341 - break; 342 - case PLAYL_ADD: 343 - filename = luaL_checkstring(L, 2); 344 - result = rb->playlist_add(filename); 345 341 break; 346 342 case PLAYL_CREATE: 347 343 dir = luaL_checkstring(L, 2);
+4
apps/tree.c
··· 1105 1105 { 1106 1106 if (global_settings.playlist_shuffle) 1107 1107 playlist_shuffle(seed, -1); 1108 + 1109 + playlist_set_modified(NULL, false); 1108 1110 playlist_start(index, elapsed, offset); 1109 1111 started = true; 1110 1112 } ··· 1156 1158 else 1157 1159 return false; 1158 1160 } 1161 + 1162 + playlist_set_modified(NULL, false); 1159 1163 playlist_start(index, elapsed, offset); 1160 1164 started = true; 1161 1165 }