WIP. Adding audio stats when refreshing database, and use it to refresh database lastUpdated entry

This commit is contained in:
emeric
2014-07-04 12:15:57 +02:00
parent e715b3812a
commit 579a565e22
2 changed files with 47 additions and 13 deletions
+26 -4
View File
@@ -14,13 +14,33 @@ class Updater
{
public:
struct Stats
{
std::size_t nbAdded;
std::size_t nbRemoved;
std::size_t nbModified;
Stats() : nbAdded(0), nbRemoved(0), nbModified(0) {}
std::size_t nbChanges() const { return nbAdded + nbRemoved + nbModified;}
};
struct Result
{
Stats audioStats;
Stats videoStats;
};
Updater(boost::filesystem::path db, MetaData::Parser& parser);
// Update database
// TODO add a callback to get notifed once finished
void process();
const Result& getResult(void) const { return _result; }
private:
// void refresh(const WatchedDirectory& directory);
// Video
@@ -28,15 +48,17 @@ class Updater
void processVideoFile( const boost::filesystem::path& file);
// Audio
void removeMissingAudioFiles( void );
void refreshAudioDirectory( const boost::filesystem::path& directory);
void processAudioFile( const boost::filesystem::path& file);
void removeMissingAudioFiles( Stats& stats );
void refreshAudioDirectory( const boost::filesystem::path& directory, Stats& stats);
void processAudioFile( const boost::filesystem::path& file, Stats& stats);
Database::Path::pointer getAddPath(const boost::filesystem::path& path);
Database::Handler _db;
MetaData::Parser& _metadataParser;
MetaData::Parser& _metadataParser;
Result _result; // update results
}; // class Updater
} // DatabaseUpdater