public void seek(SongManager songManager) {
String libPath = System.getProperty("freshet.libpath");
log.info("Starting seeker();");
if (libPath != null && !"".equals(libPath)) {
final String[] paths = libPath.split(";");
final SongManager finalSongManager = songManager;
new Thread("SEEKER") {
public void run() {
if (building) {
log.debug("Seeker waiting for db to finish building...");
} else {
log.debug("Seeker starting again...");
for(int i=0; i< paths.length; i++) {
Miner miner = new Miner(paths[i]);
log.debug("Seeker mining at: " + paths[i]);
File f;
while( (f=miner.next()) != null) {
if (f.getName().matches(".*[mM][pP]3")) {
if (!finalSongManager.songIsInDb(f)) {
try {
SongData songData = new SongData(f);
Song song = finalSongManager.saveSong(songData);
log.debug("Added: " + song.getName() + " ("+song.getId() +")"+
", " + song.getAlbum().getName() +
", " + song.getArtist().getName() +
", " + song.getGenre().getName());
} catch (SongDataException sdE) {