Added feature to upload all songs from a directory (optional recursive). Need to document the use of it as well as how to even use this CLI

This commit is contained in:
kdeng00
2019-10-23 20:48:42 -04:00
parent 27aecc7a0d
commit 81892cc52e
11 changed files with 162 additions and 29 deletions
+26 -4
View File
@@ -157,14 +157,17 @@ namespace Managers
}
void CommitManager::uploadSong()
{
bool uploadSingleSong = true;
bool recursiveDirectory = false;
string songDirectory;
APIParser apiPrs{icaAction};
auto api = apiPrs.retrieveAPI();
auto token = parseToken(api);
Song song{};
Song song;
for (auto arg : icaAction.flags)
for (auto& arg : icaAction.flags)
{
auto flag = arg.flag;
auto value = arg.value;
@@ -173,11 +176,30 @@ namespace Managers
{
song.songPath.assign(arg.value);
}
else if (flag.compare("-sd") == 0)
{
songDirectory = value;
uploadSingleSong = false;
}
else if (flag.compare("-sr") == 0)
{
songDirectory = value;
uploadSingleSong = false;
recursiveDirectory = true;
}
}
Upload upld{api};
cout<<"Uploading song..."<<endl;
upld.uploadSong(token, song);
if (uploadSingleSong)
{
cout<<"Uploading song..."<<endl;
upld.uploadSong(token, song);
}
else
{
cout<<"Uploading songs from " << songDirectory << endl;
upld.uploadSongsFromDirectory(token, songDirectory, recursiveDirectory);
}
}
#pragma Functions
}