libsaria: Create a Playlist stack

My goal is to eventually pick songs from whatever is on top of the
playlist stack.  Right now, only the library is added and no songs are
picked.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-02-25 17:21:19 -05:00
parent 8d50e63df2
commit b7e1c2c631
5 changed files with 39 additions and 1 deletions

View File

@ -35,6 +35,7 @@ namespace libsaria
unsigned int size;
};
void init();
void load();
void save();
void update();

13
include/libsaria/stack.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef LIBSARIA_PLAYLIST_STACK_H
#define LIBSARIA_PLAYLIST_STACK_H
#include <libsaria/playlist.h>
namespace libsaria
{
void stack_playlist(Playlist *);
}; /* Namespace: libsaria */
#endif /* LIBSARIA_PLAYLIST_STACK_H */

View File

@ -7,6 +7,7 @@ using namespace std;
#include <libsaria/callback.h>
#include <libsaria/library.h>
#include <libsaria/playlist.h>
#include <libsaria/stack.h>
#include "library.h"
list<libsaria::LibraryPath> path_list;
@ -32,6 +33,12 @@ static void do_update(libsaria::LibraryPath *path)
namespace libsaria
{
void library::init()
{
load();
stack_playlist(&lib_playlist);
}
void library::for_each_path(void (*info_func)(struct library::PathInfo &))
{
list<LibraryPath>::iterator it;

View File

@ -22,7 +22,7 @@ namespace libsaria
audio::init(argc, argv);
println("saria dir: %s", get_saria_dir().c_str());
make_saria_dir();
libsaria::library::load();
libsaria::library::init();
libsaria::queue::load();
}

View File

@ -0,0 +1,17 @@
// Copyright (c) 2012 Bryan Schumaker.
#include <libsaria/playlist.h>
#include <list>
using namespace std;
static list<libsaria::Playlist *> playlist_stack;
namespace libsaria
{
void stack_playlist(Playlist *plist)
{
playlist_stack.push_front(plist);
}
}; /* Namespace: libsaria */