0d84f92d2a
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
87 lines
1.9 KiB
Plaintext
87 lines
1.9 KiB
Plaintext
== Files ==
|
|
ocarina/include/
|
|
playlist.h
|
|
ocarina/lib/
|
|
playlist.cpp
|
|
$HOME/.ocarina{-debug}/
|
|
playlists.lst
|
|
|
|
== Depends ==
|
|
database
|
|
|
|
Playlist: (lib/playlist.cpp)
|
|
Playlists are a list of songs that the user has configured to play. I
|
|
will create a pool of playlists that will be filled by user actions.
|
|
|
|
Playlists will be put on a "deck" that is used to give an order to the
|
|
next songs played. When deck :: next() is called, find the first
|
|
playlist with PL_ENABLED set and call that playlists next() function.
|
|
|
|
When a playlist is empty, remove it from the deck.
|
|
|
|
- Flags:
|
|
enum playlist_flags {
|
|
PL_ENABLED (1 << 0),
|
|
PL_RANDOM (1 << 1),
|
|
PL_DRAIN (1 << 2),
|
|
};
|
|
|
|
- Playlist:
|
|
class Playlist : public Database {
|
|
private:
|
|
database<track_id> tracks; /* Keyed on track id */
|
|
unsigned int cur;
|
|
unsigned int flags;
|
|
public:
|
|
Playlist();
|
|
void add(vector<track_id> &);
|
|
void del(vector<track_id> &);
|
|
void set_flag(playlist_flags);
|
|
const unsigned int get_flags();
|
|
unsigned int size()
|
|
|
|
File &operator<<(File &);
|
|
File &operator>>(File &);
|
|
|
|
void sort();
|
|
void next();
|
|
}
|
|
|
|
File << flags << tracks.size() << tracks[0] << tracks[1] << ... << tracks[N];
|
|
|
|
- Deck:
|
|
list<Playlist> deck;
|
|
unsigned int current_track;
|
|
|
|
File << current_track << deck.size() << endl;
|
|
File << deck[0] << endl;
|
|
File << deck[1] << endl;
|
|
|
|
- Deck:
|
|
list<Playlist> deck;
|
|
File << deck[0] << endl;
|
|
File << deck[1] << endl;
|
|
File << deck[N] << endl;
|
|
|
|
- API
|
|
deck :: init();
|
|
Read in the playlist file
|
|
|
|
deck :: new();
|
|
Adds a new playlist to the deck
|
|
|
|
deck :: rm(N)
|
|
Removes playlist N from the deck
|
|
|
|
Playlist *deck :: get(N)
|
|
Return playlist N from the deck
|
|
|
|
deck :: next()
|
|
Play the next song from the deck
|
|
|
|
- TODO <<<<<
|
|
What if each playlist has its own playlist_id for tracks? This would
|
|
allow for simpler removals, since I won't need to search for a track id.
|
|
I can easily create a function for mapping a list of playlist_ids to
|
|
track_ids...
|