libsaria: Create new LibraryPaths
The UI calls the library::add_path() function to create a new LibraryPath structure to be managed by the library. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
7c8ef5508e
commit
ae9074103a
|
@ -1,21 +1,17 @@
|
||||||
#ifndef LIBSARIA_LIBRARY_H
|
#ifndef LIBSARIA_LIBRARY_H
|
||||||
#define LIBSARIA_LIBRARY_H
|
#define LIBSARIA_LIBRARY_H
|
||||||
|
|
||||||
#include <libsaria/track.h>
|
|
||||||
#include <libsaria/playlist.h>
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace libsaria
|
namespace libsaria
|
||||||
{
|
{
|
||||||
|
|
||||||
class LibraryPath;
|
|
||||||
|
|
||||||
namespace library
|
namespace library
|
||||||
{
|
{
|
||||||
|
|
||||||
|
void add_path(string);
|
||||||
|
|
||||||
/*namespace iter
|
/*namespace iter
|
||||||
{
|
{
|
||||||
void reset();
|
void reset();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
|
||||||
static list<libsaria::LibraryPath>::iterator it;
|
//static list<libsaria::LibraryPath>::iterator it;
|
||||||
|
|
||||||
namespace libsaria
|
namespace libsaria
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
// Copyright (c) 2011 Bryan Schumaker.
|
// Copyright (c) 2011 Bryan Schumaker.
|
||||||
#include <map>
|
#include <libsaria/library.h>
|
||||||
|
|
||||||
|
//#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <libsaria/callback.h>
|
/*#include <libsaria/callback.h>
|
||||||
#include <libsaria/library.h>
|
#include <libsaria/library.h>
|
||||||
#include <libsaria/playlist.h>
|
#include <libsaria/playlist.h>
|
||||||
#include <libsaria/stack.h>
|
#include <libsaria/stack.h>*/
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
|
||||||
|
list<struct LibraryPath> path_list;
|
||||||
/*list<libsaria::LibraryPath> path_list;
|
/*list<libsaria::LibraryPath> path_list;
|
||||||
libsaria::Playlist lib_playlist(PL_RANDOM | PL_SEQUENTIAL | PL_FILTER);
|
libsaria::Playlist lib_playlist(PL_RANDOM | PL_SEQUENTIAL | PL_FILTER);
|
||||||
static map<sid_t, libsaria::Track *> lookup_map;
|
static map<sid_t, libsaria::Track *> lookup_map;
|
||||||
|
@ -24,15 +27,15 @@ void library_unmap_track(libsaria::Track *track)
|
||||||
lookup_map.erase(track->get_songid());
|
lookup_map.erase(track->get_songid());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_update(libsaria::LibraryPath *path)
|
static void do_update(libsaria::LibraryPath *path):
|
||||||
{
|
{
|
||||||
path->validate();
|
path->validate();
|
||||||
path->update();
|
path->update();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
namespace libsaria
|
namespace libsaria
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
void library::init()
|
void library::init()
|
||||||
{
|
{
|
||||||
load();
|
load();
|
||||||
|
@ -69,13 +72,14 @@ namespace libsaria
|
||||||
{
|
{
|
||||||
trigger_callback(LIBRARY_REFRESH);
|
trigger_callback(LIBRARY_REFRESH);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
void library::add_path(string dir)
|
void library::add_path(string dir)
|
||||||
{
|
{
|
||||||
path_list.push_back(LibraryPath(dir));
|
struct LibraryPath path;
|
||||||
path_list.back().update();
|
path.path = dir;
|
||||||
|
path_list.push_back(path);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void library::remove_path(string dir)
|
void library::remove_path(string dir)
|
||||||
{
|
{
|
||||||
list<LibraryPath>::iterator it;
|
list<LibraryPath>::iterator it;
|
||||||
|
@ -104,5 +108,5 @@ namespace libsaria
|
||||||
{
|
{
|
||||||
return &lib_playlist;
|
return &lib_playlist;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
};*/ /* namespace: libsaria */
|
}; /* namespace: libsaria */
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
#ifndef LIBSARIA_LIBRARY_SOURCE_H
|
#ifndef LIBSARIA_LIBRARY_SOURCE_H
|
||||||
#define LIBSARIA_LIBRARY_SOURCE_H
|
#define LIBSARIA_LIBRARY_SOURCE_H
|
||||||
|
|
||||||
#include <list>
|
#include <string>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
struct LibraryPath {
|
||||||
|
string path;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*#include <list>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#include <libsaria/libpath.h>
|
#include <libsaria/libpath.h>
|
||||||
#include <libsaria/playlist.h>
|
#include <libsaria/playlist.h>
|
||||||
|
@ -10,6 +17,6 @@ extern list<libsaria::LibraryPath> path_list;
|
||||||
extern libsaria::Playlist lib_playlist;
|
extern libsaria::Playlist lib_playlist;
|
||||||
|
|
||||||
void library_map_track(libsaria::Track *);
|
void library_map_track(libsaria::Track *);
|
||||||
void library_unmap_track(libsaria::Track *);
|
void library_unmap_track(libsaria::Track *);*/
|
||||||
|
|
||||||
#endif /* LIBSARIA_LIBRARY_SOURCE_H */
|
#endif /* LIBSARIA_LIBRARY_SOURCE_H */
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright (c) 2012 Bryan Schumaker
|
// Copyright (c) 2012 Bryan Schumaker
|
||||||
|
#include <libsaria/library.h>
|
||||||
#include <ocarina/ocarina.h>
|
#include <ocarina/ocarina.h>
|
||||||
#include <ocarina/chooser.h>
|
#include <ocarina/chooser.h>
|
||||||
#include <ocarina/button.h>
|
#include <ocarina/button.h>
|
||||||
|
@ -9,6 +10,7 @@ static void on_click_add(GtkWidget *b, GdkEvent *e, gpointer d)
|
||||||
string dir = ocarina::choose_dir();
|
string dir = ocarina::choose_dir();
|
||||||
if (dir != "") {
|
if (dir != "") {
|
||||||
println("Scanning dir: " + dir);
|
println("Scanning dir: " + dir);
|
||||||
|
libsaria::library::add_path(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user