Working on downloading the song

This commit is contained in:
kdeng00
2019-08-25 16:47:52 -04:00
parent 540d665a7e
commit fb03354189
5 changed files with 92 additions and 8 deletions
+14 -2
View File
@@ -27,7 +27,9 @@ void song_manager::saveSong(Song& song)
song.data = std::move(data);
coverArtManager covMgr(exe_path);
auto coverRootPath = directory_manager::pathConfigContent(exe_path)["cover_root_path"].get<std::string>();
auto pathConfigContent = directory_manager::pathConfigContent(exe_path);
auto coverRootPath = pathConfigContent["cover_root_path"].get<std::string>();
auto musicRootPath = pathConfigContent["root_music_path"].get<std::string>();
auto stockCoverPath = directory_manager::configPath(exe_path);
stockCoverPath.append("/CoverArt.png");
@@ -35,6 +37,16 @@ void song_manager::saveSong(Song& song)
auto cov = covMgr.saveCover(song, coverRootPath, stockCoverPath);
song.coverArtId = cov.id;
auto songPath = directory_manager::create_directory_process(song, musicRootPath);
songPath.append(song.title);
songPath.append(".mp3");
std::cout << std::endl;
std::cout << "temp path: " << song.songPath << std::endl;
std::cout << "new path: " << songPath << std::endl;
fs::copy(song.songPath, songPath);
fs::remove(song.songPath);
song.songPath = std::move(songPath);
printSong(song);
songRepository songRepo(exe_path);
@@ -43,7 +55,7 @@ void song_manager::saveSong(Song& song)
void song_manager::printSong(const Song& song)
{
std::cout << "song" << std::endl;
std::cout << std::endl << "song" << std::endl;
std::cout << "title: " << song.title << std::endl;
std::cout << "artist: " << song.artist << std::endl;
std::cout << "album: " << song.album << std::endl;