Thank You for your continued support and contributions!
function file_put_contents(filename, mode, contents) local file = io.open(filename, mode) if not file then return false end local ret = file:write(contents) == true file:close() return retendrb.lcd_clear_display()file_put_contents("/temp.m3u8","w+","/test.mp3\n")file_put_contents("/temp.m3u8","a","/test2.mp3\n")rb.playlist_create("/","temp.m3u8")rb.sleep(2 * rb.HZ)rb.playlist_shuffle(rb.current_tick(),-1)rb.sleep(2 * rb.HZ)rb.playlist_start(0,0,0)return 1
rb.lcd_clear_display()rb.playlist_create("/Playlists/","MyPlaylist.m3u8")rb.sleep(2 * rb.HZ)rb.playlist_shuffle(rb.current_tick(),-1)rb.sleep(2 * rb.HZ)rb.playlist_start(0,0,0)return 1
Currently lua only accesses the current playlist so that might explain your issue if theplaylist wasn't already loaded.I'll see about fixing that..playlist_set_current is not exposed to plugins instead preload a playlist and use rb.playlist_remove_all_tracks()as a workaround if you wish to fill the playlist with your own tracksAs for bricking when running plugin after usb unplug that is probably a buffer freeing issue I'll look into that when I get a chance
rb.lcd_clear_display()rb.audio_stop()rb.playlist_create("/Playlists/","MyPlaylist2.m3u8")rb.playlist_insert_directory("/yourmusicdir/")rb.playlist_shuffle(rb.current_tick(),-1)rb.playlist_start(0,0,0)
local playlistdir = "/Playlists/"local playlist = "MyPlaylist.m3u8"local newplaylist = "MyPlaylist2.m3u8"local songs = {}local file = io.open(playlistdir .. playlist)if file then for line in file:lines() do songs[#songs+1] = line end file:close()else rb.splash(rb.HZ, "Invalid Playlist") os.exit()end--code to save playlistfile = io.open(playlistdir .. newplaylist, "w+")if file then --just reverses the order you need to come up with your own shuffle routine for line = #songs, 1, -1 do file:write(songs[line] .. "\n") end file:close()else rb.splash(rb.HZ, "Invalid New Playlist") os.exit()endrb.lcd_clear_display()rb.audio_stop()rb.playlist_create(playlistdir, newplaylist)for line = #songs, 1, -1 do rb.playlist_insert_track(songs[line])endrb.playlist_start(0,0,0)
what C plugins work that modify/load a playlist and what is the lua script you are trying to use one of the above?
What happens if you stop the audio first and actually add tracks?Code: [Select]rb.lcd_clear_display()rb.audio_stop()rb.playlist_create("/Playlists/","MyPlaylist2.m3u8")rb.playlist_insert_directory("/yourmusicdir/")rb.playlist_shuffle(rb.current_tick(),-1)rb.playlist_start(0,0,0)
Page created in 0.079 seconds with 20 queries.