Able to upload song. Left TODO on what's next

This commit is contained in:
kdeng00
2019-08-18 22:58:04 -04:00
parent bbd8186114
commit 4072526d35
6 changed files with 98 additions and 30 deletions
+22
View File
@@ -0,0 +1,22 @@
#include "managers/song_manager.h"
#include <fstream>
#include <filesystem>
namespace fs = std::filesystem;
song_manager::song_manager(std::string& x_path)
: exe_path(x_path)
{ }
void song_manager::saveSong(Song& song)
{
constexpr auto tmp_song = "/tmp/song.mp3";
if (fs::exists(fs::path(tmp_song))) {
std::cout << "deleting old song " << std::endl;
fs::remove(fs::path(tmp_song));
}
std::fstream s(tmp_song, std::fstream::binary | std::fstream::out);
s.write((char*)&song.data[0], song.data.size());
s.close();
}