Almost done with updating metadata of song, just need to handle records that have no related records associated with them
This commit is contained in:
@@ -25,6 +25,7 @@ namespace database
|
||||
|
||||
void deleteRecord(const model::Cover&);
|
||||
void saveRecord(const model::Cover&);
|
||||
void updateRecord(const model::Cover&);
|
||||
private:
|
||||
std::vector<model::Cover> parseRecords(MYSQL_STMT*);
|
||||
|
||||
|
||||
@@ -20,12 +20,13 @@ namespace database
|
||||
|
||||
std::vector<model::Song> retrieveRecords();
|
||||
|
||||
bool doesSongExist(const model::Song&, type::SongFilter);
|
||||
|
||||
model::Song retrieveRecord(model::Song&, type::SongFilter);
|
||||
|
||||
bool doesSongExist(const model::Song&, type::SongFilter);
|
||||
bool deleteRecord(const model::Song&);
|
||||
|
||||
void saveRecord(const model::Song&);
|
||||
void updateRecord(const model::Song&);
|
||||
private:
|
||||
std::vector<model::Song> parseRecords(MYSQL_RES*); // TODO: to be removed
|
||||
std::vector<model::Song> parseRecords(MYSQL_STMT*);
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace manager
|
||||
model::Album saveAlbum(const model::Song&);
|
||||
|
||||
void deleteAlbum(const model::Song&);
|
||||
void updateAlbum(model::Song&, const model::Song&);
|
||||
|
||||
static void printAlbum(const model::Album&);
|
||||
private:
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace manager
|
||||
model::Artist saveArtist(const model::Song&);
|
||||
|
||||
void deleteArtist(const model::Song&);
|
||||
void updateArtist(model::Song&, const model::Song&);
|
||||
|
||||
static void printArtist(const model::Artist&);
|
||||
private:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define COVERARTMANAGER_H_
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "model/Models.h"
|
||||
|
||||
@@ -13,9 +14,14 @@ namespace manager
|
||||
CoverArtManager(const std::string&);
|
||||
CoverArtManager(const model::BinaryPath& bConf);
|
||||
|
||||
model::Cover saveCover(const model::Song&, std::string&, const std::string&);
|
||||
model::Cover saveCover(const model::Song&, std::string&,
|
||||
const std::string&);
|
||||
|
||||
std::pair<bool, std::string> defaultCover(const model::Cover&);
|
||||
|
||||
void deleteCover(const model::Song&);
|
||||
void updateCover(const model::Song&);
|
||||
void updateCoverRecord(const model::Song&);
|
||||
private:
|
||||
model::BinaryPath m_bConf;
|
||||
std::string path;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "model/Models.h"
|
||||
#include "type/PathType.h"
|
||||
|
||||
namespace manager
|
||||
{
|
||||
@@ -14,17 +15,20 @@ namespace manager
|
||||
{
|
||||
public:
|
||||
static std::string createDirectoryProcess(model::Song, const std::string&);
|
||||
static std::string createDirectoryProcess(const model::Song&, const model::BinaryPath&, type::PathType);
|
||||
static std::string configPath(std::string_view);
|
||||
static std::string configPath(const model::BinaryPath&);
|
||||
static std::string contentOfPath(const std::string&);
|
||||
static std::string retrievePathType(type::PathType);
|
||||
|
||||
static nlohmann::json credentialConfigContent(const model::BinaryPath&);
|
||||
static nlohmann::json databaseConfigContent(const model::BinaryPath&);
|
||||
static nlohmann::json pathConfigContent(const model::BinaryPath&);
|
||||
|
||||
void deleteCoverArtFile(const std::string&, const std::string&);
|
||||
static void deleteDirectories(model::Song, const std::string&);
|
||||
|
||||
void deleteCoverArtFile(const std::string&, const std::string&);
|
||||
|
||||
private:
|
||||
void deleteSong(const model::Song);
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace manager
|
||||
model::Genre saveGenre(const model::Song&);
|
||||
|
||||
void deleteGenre(const model::Song&);
|
||||
void updateGenre(model::Song&, const model::Song&);
|
||||
|
||||
static void printGenre(const model::Genre&);
|
||||
private:
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
#define SONGMANAGER_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "dto/SongDto.hpp"
|
||||
#include "model/Models.h"
|
||||
#include "type/SongChanged.h"
|
||||
|
||||
namespace manager
|
||||
{
|
||||
@@ -17,6 +19,7 @@ namespace manager
|
||||
SongManager(std::string&);
|
||||
SongManager(const model::BinaryPath&);
|
||||
|
||||
|
||||
bool didSongChange(const model::Song&, const model::Song&);
|
||||
bool requiresFilesystemChange(const model::Song&, const model::Song&);
|
||||
|
||||
@@ -28,9 +31,17 @@ namespace manager
|
||||
|
||||
static void printSong(const model::Song&);
|
||||
private:
|
||||
std::map<type::SongChanged, bool> changesInSong(const model::Song&, const model::Song&);
|
||||
|
||||
void assignMiscId(model::Song&, const model::Song&);
|
||||
void assignMiscFields(std::map<type::SongChanged, bool>&, model::Song&,
|
||||
const model::Song&);
|
||||
void saveSongTemp(model::Song&);
|
||||
void saveMisc(model::Song&);
|
||||
void deleteMisc(const model::Song&);
|
||||
void updateMisc(const std::map<type::SongChanged, bool>&,
|
||||
model::Song&, const model::Song&);
|
||||
void modifySongOnFilesystem(model::Song&, const model::Song&);
|
||||
|
||||
model::BinaryPath m_bConf;
|
||||
std::string exe_path;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace manager
|
||||
model::Year saveYear(const model::Song&);
|
||||
|
||||
void deleteYear(const model::Song&);
|
||||
void updateYear(model::Song&, const model::Song&);
|
||||
|
||||
static void printYear(const model::Year&);
|
||||
private:
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef PATHTYPE_H_
|
||||
#define PATHTYPE_H_
|
||||
|
||||
namespace type
|
||||
{
|
||||
enum PathType
|
||||
{
|
||||
music = 0,
|
||||
archive,
|
||||
temp,
|
||||
coverArt
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef SONGCHANGED_H_
|
||||
#define SONGCHANGED_H_
|
||||
|
||||
namespace type
|
||||
{
|
||||
enum SongChanged
|
||||
{
|
||||
title = 0,
|
||||
artist,
|
||||
album,
|
||||
genre,
|
||||
year
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user