libsaria: Find tags for songs not in the library
I always want to find tags if it's possible. Since I already have a way to find the tags, it's fairly simple to tag a random file and pass the result back to the UI.
This commit is contained in:
parent
049f91e514
commit
0da84e8151
|
@ -26,7 +26,7 @@ namespace libsaria
|
|||
void add_path(string);
|
||||
void remove_path(string);
|
||||
void play_id(ino_t &);
|
||||
void get_info(ino_t &, void(*)(Track &));
|
||||
bool get_info(ino_t &, void(*)(Track &));
|
||||
void for_each(SourceModel *);
|
||||
void for_each_path(void (*)(struct PathInfo &));
|
||||
|
||||
|
|
|
@ -18,12 +18,18 @@ namespace libsaria
|
|||
void current_track(void (*func)(Track &))
|
||||
{
|
||||
ino_t inode;
|
||||
|
||||
if (current_inode(inode) < 0) {
|
||||
Track blank;
|
||||
func(blank);
|
||||
return;
|
||||
}
|
||||
library::get_info(inode, func);
|
||||
|
||||
if (!library::get_info(inode, func)) {
|
||||
TrackTag tag(libsaria::audio::get_current_file());
|
||||
Track track(inode, &tag);
|
||||
func(track);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -98,13 +98,17 @@ namespace libsaria
|
|||
}
|
||||
}
|
||||
|
||||
void library::get_info(ino_t &id, void (*func)(Track &))
|
||||
bool library::get_info(ino_t &id, void (*func)(Track &))
|
||||
{
|
||||
bool found = false;
|
||||
map<string, LibraryPath>::iterator it;
|
||||
for (it = path_map.begin(); it != path_map.end(); it++) {
|
||||
if (it->second.get_info_id(id, func) == true)
|
||||
if (it->second.get_info_id(id, func) == true) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
unsigned int library::size()
|
||||
|
|
Loading…
Reference in New Issue