Rockbox Ports are now being developed for various digital audio players!
/playlists/jingles.m3u825funk.m3u8rock.m3u8new_wave.m3u8(...)
-- ROCKBOX META SHUFFLER-- This script shuffles playlist on a timer-- version 2.5 (december 7th 2018)-- works with rockbox dev-release 9450689483-181207 and later-- creator @rockboxyo-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as-- published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.-- This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.require("actions") require("rbcompat")local pl={} -- array of playlist nameslocal pl_count=-2 -- total number of playlists local minutes_of_play=40 --number of minutes for each playlist before switchlocal trans_pl -- name of transition playlistlocal prev_pl={} -- keeps track of 2 previous playlists to avoid repeatinglocal prev_switch=0local seconds_elapsed=0local ticks_elapsed=0 -- time since new playlist startedlocal last_tick=0local current_tick=0local action -- input managementfunction changePlaylist() local trans_nr=0 -- number of available transitions local trans_name local nr=0 rb.lcd_clear_display() -- first choose random indice not recently played repeat nr=math.random(0,pl_count-1) until nr~=prev_pl[0] and nr~=prev_pl[1] prev_pl[prev_switch]=nr prev_switch=1-prev_switch local playlist_name=pl[nr] -- set playlist rb.audio("stop") rb.playlist("create","/Playlists/",playlist_name) rb.playlist("shuffle",rb.current_tick(),0) --add transition if applylocal file = io.open(trans_pl, "r")if not file then rb.splash(3*rb.HZ,"transition FILE NOT FOUND !")else for line in file:lines() do trans_nr =trans_nr +1endnr=math.random(1,trans_nr)file:seek("set")for i=1,nr do trans_name=file:read("*l") end rb.playlist("insert_track",trans_name,0 ,true,-1)end --start play rb.sleep(2*rb.HZ) -- added this to void buffering problems (?) rb.playlist("start",0,0,0) last_tick=rb.current_tick() current_tick=last_tick seconds_elapsed=0 ticks_elapsed=0 rb.lcd_clear_display() rb.splash(2*rb.HZ, "now playing: "..playlist_name)end-- MAIN SCRIPTmath.randomseed(rb.current_tick())rb.lcd_clear_display()prev_pl[0]=-1prev_pl[1]=-1local file = io.open("/.rockbox/rocks/apps/playlist_randomizer_config.txt", "r")if not file then rb.splash(3*rb.HZ,"CONFIG FILE NOT FOUND !") return nilelsefor line in file:lines() do pl[pl_count]=line pl_count=pl_count+1endif pl_count<=1 then rb.splash(4*rb.HZ,"ERROR: No playlist found in file!") return nilend trans_pl=pl[-2] minutes_of_play=tonumber(pl[-1]) file:close() --if rockbox is currently playing when plugin is started, then this will not change the playlist if rb.audio("status")==0 then changePlaylist() else rb.splash(3*rb.HZ,"Playlist randomized in "..minutes_of_play.." minutes...") end repeat current_tick=rb.current_tick() if current_tick>last_tick then ticks_elapsed=ticks_elapsed+(current_tick-last_tick) last_tick=current_tick if ticks_elapsed>=rb.HZ then ticks_elapsed=ticks_elapsed-rb.HZ seconds_elapsed=seconds_elapsed+1 if seconds_elapsed>=(60*minutes_of_play) then changePlaylist() end end end action = rb.get_action(rb.contexts.CONTEXT_STD, rb.HZ) if action==rb.actions.ACTION_STD_OK then changePlaylist() end until action == rb.actions.ACTION_STD_CANCEL or action == rb.actions.ACTION_STD_MENU --rb.audio_stop()end
Most of the backend for rliimage is in lua (last few dev versions of RB) I'll have an update finished in the next week or so that speeds it up a bit but you can check out the sample programs to see how it workshttp://forums.rockbox.org/index.php/topic,52352.0.html
See here for grabbing track info:http://forums.rockbox.org/index.php/topic,52509.0.html
Page created in 0.032 seconds with 22 queries.