libsaria: Added function for getting the library size

I like to show this on the library tab so I know how many songs are
currently in the library.
This commit is contained in:
Bryan Schumaker 2011-10-19 09:58:30 -04:00
parent a508b7ff72
commit 8cf3caeb27
2 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,8 @@ namespace libsaria
void add_path(string);
void play_id(ino_t);
void for_each(void (*)(Track &));
unsigned int size();
}
}

View File

@ -63,6 +63,15 @@ namespace libsaria
}
}
unsigned int library::size()
{
unsigned int size = 0;
map<string, LibraryPath>::iterator it;
for (it = path_map.begin(); it != path_map.end(); it++)
size += it->second.size();
return size;
}
void library::refresh()
{
trigger_callback(LIBRARY_REFRESH);