Tidied up code, going to put up the coding convention later on

This commit is contained in:
amazing-username
2019-09-04 15:41:43 +00:00
parent dd995269df
commit d4e9b8c71f
73 changed files with 1334 additions and 1368 deletions
+34
View File
@@ -0,0 +1,34 @@
#include "manager/CoverArtManager.h"
#include "database/CoverArtRepository.h"
#include "type/CoverFilter.h"
#include "utility/MetadataRetriever.h"
manager::CoverArtManager::CoverArtManager(const std::string& configPath) : path(configPath)
{ }
manager::CoverArtManager::CoverArtManager(const model::BinaryPath& bConf) : m_bConf(bConf)
{ }
model::Cover manager::CoverArtManager::saveCover(const model::Song& song, std::string& rootPath, const std::string& stockCoverPath)
{
utility::MetadataRetriever meta;
model::Cover cov;
cov.imagePath = rootPath;
cov = meta.updateCoverArt(song, cov, stockCoverPath);
cov.songTitle = song.title;
database::CoverArtRepository covRepo(m_bConf);
if (!covRepo.doesCoverArtExist(cov, type::CoverFilter::songTitle)) {
std::cout << "saving image record to the database" << std::endl;
covRepo.saveRecord(cov);
} else {
std::cout << "cover art record already exists" << std::endl;
}
std::cout << "retrieving image record from database" << std::endl;
cov = covRepo.retrieveRecord(cov, type::CoverFilter::songTitle);
return cov;
}