
#include <libsaria/libsaria.h>
#include <libsaria/library.h>
#include <libsaria/audio.h>
#include <libsaria/path.h>

static int current_inode(ino_t &inode)
{
	string file = libsaria::audio::get_current_file();
	if (file == "")
		return false;
	return get_inode(file, inode);
}

namespace libsaria
{

	void current_track(void (*func)(Track &))
	{
		ino_t inode;

		if (current_inode(inode) < 0) {
			Track blank;
			func(blank);
			return;
		}

		if (!library::get_info(inode, func)) {
			TrackTag tag(libsaria::audio::get_current_file());
			Track track(inode, &tag);
			func(track);
		}
	}

};
