WIP. Improved database cleanup + various db fixes
This commit is contained in:
@@ -5,9 +5,10 @@
|
||||
#include <Wt/WIOService>
|
||||
|
||||
#include "metadata/MetaData.hpp"
|
||||
#include "database/DatabaseHandler.hpp"
|
||||
|
||||
#include "database/FileTypes.hpp"
|
||||
#include "database/DatabaseHandler.hpp"
|
||||
#include "database/MediaDirectory.hpp"
|
||||
#include "database/FileTypes.hpp" // to remove
|
||||
#include "database/DatabaseHandler.hpp"
|
||||
|
||||
namespace DatabaseUpdater {
|
||||
@@ -30,30 +31,32 @@ class Updater
|
||||
std::size_t nbModified;
|
||||
Stats() : nbAdded(0), nbRemoved(0), nbModified(0) {}
|
||||
|
||||
void clear(void) { nbAdded = 0; nbRemoved = 0; nbModified = 0; }
|
||||
std::size_t nbChanges() const { return nbAdded + nbRemoved + nbModified;}
|
||||
};
|
||||
|
||||
struct Result
|
||||
{
|
||||
Stats audioStats;
|
||||
Stats videoStats;
|
||||
};
|
||||
|
||||
// Job handling
|
||||
void processNextJob();
|
||||
void scheduleScan(boost::posix_time::time_duration duration);
|
||||
void scheduleScan(boost::posix_time::ptime time);
|
||||
|
||||
// Update database
|
||||
// Update database (scheduled callback)
|
||||
void process(boost::system::error_code ec);
|
||||
|
||||
// Check if a file exists and is still in a root directory
|
||||
static bool checkFile(const boost::filesystem::path& p, const std::vector<boost::filesystem::path>& rootDirectories);
|
||||
|
||||
// Video
|
||||
void refreshVideoDirectory( const boost::filesystem::path& directory );
|
||||
|
||||
void processDirectory( const boost::filesystem::path& rootDirectory,
|
||||
const boost::filesystem::path& directory,
|
||||
Database::MediaDirectory::Type type,
|
||||
Stats& stats);
|
||||
|
||||
void processVideoFile( const boost::filesystem::path& file);
|
||||
|
||||
// Audio
|
||||
void removeMissingAudioFiles( Stats& stats );
|
||||
void refreshAudioDirectory( const boost::filesystem::path& directory, Stats& stats);
|
||||
void checkAudioFiles( Stats& stats );
|
||||
void processAudioFile( const boost::filesystem::path& file, Stats& stats);
|
||||
|
||||
Database::Path::pointer getAddPath(const boost::filesystem::path& path);
|
||||
@@ -67,7 +70,6 @@ class Updater
|
||||
|
||||
MetaData::Parser& _metadataParser;
|
||||
|
||||
Result _result; // update results
|
||||
}; // class Updater
|
||||
|
||||
} // DatabaseUpdater
|
||||
|
||||
Reference in New Issue
Block a user