libsaria: Fix bug in updating library

I was readding all tracks to the new linked list, rather than checking
if the track existed first.  This has been fixed.
This commit is contained in:
Bryan Schumaker 2011-11-06 12:08:50 -05:00
parent b5c8efc6d5
commit 7507955018
2 changed files with 5 additions and 4 deletions

View File

@ -26,7 +26,7 @@ class LibraryPath
string get_path();
void get_info(void (*)(struct libsaria::library::PathInfo &));
bool get_info_id(ino_t &, void (*)(Track &));
void insert_track(TrackTag &);
void insert_track(ino_t &inode, TrackTag &);
bool play_id(ino_t &);
void save(OutFile &);
void update();

View File

@ -3,9 +3,10 @@
#include <libsaria/library.h>
#include "library.h"
void LibraryPath::insert_track(TrackTag &tag)
void LibraryPath::insert_track(ino_t &inode, TrackTag &tag)
{
file_list.push_back(tag);
if (find_id(inode) == file_list.end())
file_list.push_back(tag);
}
void LibraryPath::update()
@ -31,7 +32,7 @@ void ScanTask::tag_file(file filepath)
{
try {
TrackTag tag(dir + "/" + filepath.name, filepath.d_ino);
library->insert_track(tag);
library->insert_track(filepath.d_ino, tag);
} catch (string message) {
println(message);
}