
#include <libsaria/controls.h>
#include "path.h"

LibraryPath::LibraryPath(string dir)
{
	path = dir;
}

LibraryPath::~LibraryPath()
{
}

unsigned int LibraryPath::size()
{
	return file_map.size();
}

string LibraryPath::get_path()
{
	return path;
}

void LibraryPath::list_all(list<Track> &track_list)
{
	map<ino_t, TrackTag>::iterator it;
	for (it = file_map.begin(); it != file_map.end(); it++) {
		track_list.push_back(Track(it->first, &it->second));
	}
}

bool LibraryPath::play_id(ino_t inode)
{
	map<ino_t, TrackTag>::iterator iter;
	iter = file_map.find(inode);
	if (iter == file_map.end())
		return false;
	libsaria_load(iter->second.get_filepath());
	return true;
}
