filesystem support works in c++11, but needs another lib linked. Add some namespacing to make easier to transition to official filesystem lib release. Move static var in wrong place. Add first method ot handle scanning.
This commit is contained in:
@@ -23,7 +23,10 @@
|
||||
#include <Wt/WServer>
|
||||
#include <Wt/WApplication>
|
||||
#include "WebInterface.h"
|
||||
#include <experimental/filesystem> //TODO:Change to non-gcc way when officially using c++17
|
||||
#include <locale>
|
||||
#include <Wt/WLogger>
|
||||
|
||||
std::filesystem::path GroovePlayer::musicScanDir = "";
|
||||
|
||||
GroovePlayer::GroovePlayer(std::string dbFile) : sqliteConnection(dbFile)
|
||||
{
|
||||
@@ -53,9 +56,29 @@ void GroovePlayer::grooveEventLoop()
|
||||
//TODO
|
||||
}
|
||||
|
||||
bool GroovePlayer::addFileToTrackDBIfTagged(std::filesystem::path file)
|
||||
{
|
||||
//Now check if tags exist and put into DB.
|
||||
}
|
||||
|
||||
|
||||
void GroovePlayer::grooveAudioScannerLoop()
|
||||
{
|
||||
//TODO
|
||||
for(std::filesystem::directory_entry p: std::filesystem::directory_iterator(musicScanDir))
|
||||
{
|
||||
std::string extensionLowered;
|
||||
for(auto elem : p.path().extension().string())
|
||||
{
|
||||
extensionLowered.push_back(std::tolower(elem));
|
||||
}
|
||||
if(extensionLowered == "mp3") //TODO:think about supporting more than mp3s.
|
||||
{
|
||||
if(addFileToTrackDBIfTagged(p.path()))
|
||||
{
|
||||
Wt::log("info") << p.path().string() << " was added to DB";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user