50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
//
|
|
// Created by versustune on 22.02.20.
|
|
//
|
|
|
|
#ifndef ELIYA_FILEREADER_H
|
|
#define ELIYA_FILEREADER_H
|
|
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <thread>
|
|
#include "../Models/AudioFile.h"
|
|
#include "FileValidator.h"
|
|
#include "../Utils/ProgressBar.h"
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
/*
|
|
* This class pureRead recursive from the disk and build and vector with all files.
|
|
*/
|
|
class FileReader {
|
|
private:
|
|
std::string path;
|
|
std::string outputPath;
|
|
std::string cacheName = "";
|
|
std::vector<AudioFile*> validFiles;
|
|
FileValidator validator;
|
|
public:
|
|
FileReader(std::string path, std::string outputPath);
|
|
|
|
~FileReader();
|
|
|
|
void pureRead();
|
|
|
|
void readAudioFiles();
|
|
|
|
const std::vector<AudioFile*> &getValidFiles() const;
|
|
std::vector<std::string> files; //clean after audioFile reading because can need alot of memory!
|
|
std::vector<std::string> processedFiles;
|
|
protected:
|
|
void validateDirectories();
|
|
void writeToCache();
|
|
std::string getCacheName();
|
|
static ProgressBar *getProgressBar(std::string name, int maxTicks);
|
|
};
|
|
|
|
|
|
#endif //ELIYA_FILEREADER_H
|