Terminal based audio player for Node.js. Written to solve my very specific problem: how to DJ my own party maintaining an easy to view record of all the songs I had already played.
dj [path/to/playlists] loads djesbe as a terminal app. Path can be left blank to scan the current directory.
The top left pane is a list of
m3u8 files that the app found and parsed. The lower left pane is a list of tracks in the selected playlist. The right pane is the actual queue of tracks to play. As tracks get enqueued, they are grayed out from the track pane (though they are still playable).
tabtoggles focus between the queue and the selection panes
spacestarts and stops the current track in the queue
shift-leftskip forward and backward in the queue
From the playlist pane (app starts with it focused)
enterselects a playlist and expands the track pane
amarks a playlist as "autoplay." The jukebox will pull from this list if the queue runs dry
eenqueues all tracks at once, ignoring those already queued up.
shift-eenqueues everything without checking
From the track pane
enterenqueues a track
escapeshrinks the pane and returns focus to the playlist pane
shift-e, as above
From the queue
enterskips directly to the selected track and plays it
backspaceremoves that track from the queue
If this module is required from within node, it will just expose
Track. Most of the async flow is controlled (poorly, at the moment) by promises.
Jukebox.load(directory) parsed all of the
m3u8 files in the specified directory, turning them into arrays of
Tracks. It returns a promise.
Track.unique is a constructor that memoizes tracks by filename, so that multiple playlists can load duplicates of the same file without generating multiple copies of it in memory.
Track is responsible for playing itself with the
Jukebox loads the playlists, maintains the queue of tracks to play, and keeps the queue playing tunes. It has
stop methods that each take a
Track object as their only argument; they also handle the callbacks that enable the next track in the queue to autoplay. The
unqueue method is tricky because even though it should accept a
Track, it accepts an index instead (the queue must be able to contain duplicate tracks, so it need to know which index is being removed from the queue).
Jukebox.advance takes an integer, positive or negative, and skips that many tracks ahead or behind in the queue.
- The queue needs its own model to move logic out of Jukebox
- AAC support
- "undo" levels (maybe just 1)
- websocket interface?
Currently supports only
ogg files. (It will filter out extensions that it does not support.)
Some of the architecture has come from poring over the Decibel project for insights.
A few alterations were made to Blessed as well, to accomodate how I preferred to use list boxes.
I meant to type "Notes" for this section but my right hand was off a letter.