diff options
-rw-r--r-- | music.cpp | 9 | ||||
-rw-r--r-- | music.h | 2 |
2 files changed, 7 insertions, 4 deletions
@@ -145,13 +145,13 @@ void music::begin_update(const std::string path) { MusicDirectory::p dir = get_directory(path); std::cout << boost::format("updater(%s) called") % path << std::endl; if(dir) { - update(dir->path); + dir->update(); } } /** Recursively update \p dir and its subdirectories. */ -void music::update(const MusicDirectory& dir) { +void MusicDirectory::update() { // TODO: Fix engine-specific SQL syntax inside this function. soci::session sql(config::vm["audist.database"].as<std::string>()); @@ -196,7 +196,10 @@ void music::update(const MusicDirectory& dir) { } sql.close(); - std::for_each(dir.directories.begin(), dir.directories.end(), update); + for(PathListings::iterator it = directories.begin(); it != directories.end(); it++) { + MusicDirectory dir(*it); + dir.update(); + } } void MusicDirectory::render(HTTP::Connection::p req) { @@ -35,6 +35,7 @@ class MusicDirectory : public MusicListing { MusicDirectory(const fs::path root); virtual void render(HTTP::Connection::p req); + void update(); }; namespace music { @@ -46,7 +47,6 @@ namespace music { std::vector<MusicListing::p> find(const std::map<std::string, std::string> search); std::vector<MusicListing::p> find(std::string search); void begin_update(const std::string path); - void update(const MusicDirectory& dir); }; #endif |