libsaria: Find song file tags
I don't pull out the audio properties yet, but I do find artist, album, title and everything else that I can. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
011db26d92
commit
97a0bb7260
|
@ -13,15 +13,15 @@ namespace libsaria
|
|||
private:
|
||||
library::Path *path;
|
||||
string filepath;
|
||||
/* string title;
|
||||
string title;
|
||||
string artist;
|
||||
string album;
|
||||
string comment;
|
||||
string genre;
|
||||
string lenstr;
|
||||
/* string lenstr;*/
|
||||
unsigned int year;
|
||||
unsigned int track;
|
||||
int length;
|
||||
/* int length;
|
||||
int bitrate;
|
||||
int sample;
|
||||
int channels;
|
||||
|
@ -31,6 +31,7 @@ namespace libsaria
|
|||
string *album_lc;
|
||||
void make_lenstr();
|
||||
void do_bookkeeping();*/
|
||||
void read_tags();
|
||||
|
||||
public:
|
||||
Track(string, library::Path *);
|
||||
|
|
|
@ -55,8 +55,13 @@ void ScanTask::run_task()
|
|||
list<string>::iterator it;
|
||||
list<libsaria::library::Driver *>::iterator d_it;
|
||||
|
||||
for (it = file_list.begin(); it != file_list.end(); it++)
|
||||
path->tracks.push_back(libsaria::Track(*it, path));
|
||||
for (it = file_list.begin(); it != file_list.end(); it++) {
|
||||
try {
|
||||
path->tracks.push_back(libsaria::Track(*it, path));
|
||||
} catch (string message) {
|
||||
println(message);
|
||||
}
|
||||
}
|
||||
|
||||
for (d_it = driver_list.begin(); d_it != driver_list.end(); d_it++)
|
||||
(*d_it)->path_updated(path);
|
||||
|
|
|
@ -11,10 +11,31 @@
|
|||
namespace libsaria
|
||||
{
|
||||
|
||||
void Track::read_tags()
|
||||
{
|
||||
TagLib::Tag *tag;
|
||||
//TagLib::AudioProperties *prop;
|
||||
TagLib::FileRef ref(filepath.c_str());
|
||||
|
||||
if (ref.isNull())
|
||||
throw "Error tagging file: " + filepath;
|
||||
|
||||
/* Extract tags */
|
||||
tag = ref.tag();
|
||||
title = tag->title().to8Bit(true);
|
||||
artist = tag->artist().to8Bit(true);
|
||||
album = tag->album().to8Bit(true);
|
||||
comment = tag->comment().to8Bit(true);
|
||||
genre = tag->genre().to8Bit(true);
|
||||
year = tag->year();
|
||||
track = tag->track();
|
||||
}
|
||||
|
||||
Track::Track(string file, struct library::Path *lib_path)
|
||||
{
|
||||
filepath = file;
|
||||
path = lib_path;
|
||||
read_tags();
|
||||
}
|
||||
|
||||
Track::~Track()
|
||||
|
|
Loading…
Reference in New Issue