Saving changes
This commit is contained in:
+13
-1
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
|
||||
project(IcarusDownloadManager)
|
||||
@@ -9,6 +9,17 @@ message(STATUS "Checking compiler flags for C++17 support.")
|
||||
# Set C++17 support flags for various compilers
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
if(WIN32)
|
||||
message("Windows")
|
||||
set(vs_ver 19.29.30138)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL ${vs_ver})
|
||||
message("Visual Studio version is at least ${vs_ver}")
|
||||
|
||||
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++latest")
|
||||
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest")
|
||||
endif()
|
||||
else()
|
||||
check_cxx_compiler_flag("-std=c++17" COMPILER_SUPPORTS_CXX17)
|
||||
check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
|
||||
@@ -33,6 +44,7 @@ elseif(COMPILER_SUPPORTS_CXX0X)
|
||||
else()
|
||||
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
set(SOURCES
|
||||
|
||||
@@ -78,6 +78,8 @@ private:
|
||||
void printAction() noexcept;
|
||||
void printFlags() noexcept;
|
||||
|
||||
std::vector<std::string> parsedFlags();
|
||||
|
||||
std::string action;
|
||||
|
||||
std::vector<Models::Flags> flags;
|
||||
|
||||
@@ -55,6 +55,9 @@ private:
|
||||
void downloadSong();
|
||||
void retrieveObjects();
|
||||
void uploadSong();
|
||||
|
||||
Models::Token parseToken(Models::API);
|
||||
|
||||
// Uploads a single song. The song is constructed from a metadata file that contains
|
||||
// information about the album the song is from. Also, the cover art of the song must
|
||||
// be present.
|
||||
|
||||
@@ -13,13 +13,6 @@ public:
|
||||
std::string value;
|
||||
};
|
||||
|
||||
|
||||
struct Flags
|
||||
{
|
||||
std::string flag;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Syncers
|
||||
class Upload
|
||||
{
|
||||
public:
|
||||
Upload() = default;
|
||||
Upload(Models::API api, Models::Token token) : m_token(token), api(api)
|
||||
{
|
||||
this->api.endpoint = "song/data";
|
||||
|
||||
@@ -21,6 +21,9 @@ public:
|
||||
}
|
||||
|
||||
void initializeValues();
|
||||
|
||||
template<typename T>
|
||||
void printValue(T val);
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -36,14 +36,6 @@ IcarusAction ActionManager::retrieveIcarusAction() const
|
||||
return icarusAction;
|
||||
}
|
||||
|
||||
bool ActionManager::isNumber(string_view val) noexcept
|
||||
{
|
||||
return !val.empty() && std::find_if(val.begin(),
|
||||
val.end(), [](char c)
|
||||
{
|
||||
return !std::isdigit(c);
|
||||
}) == val.end();
|
||||
}
|
||||
|
||||
|
||||
void ActionManager::initialize()
|
||||
|
||||
+3
-19
@@ -2,8 +2,7 @@
|
||||
#include <filesystem>
|
||||
#include <exception>
|
||||
|
||||
#include<cpr/cpr.h>
|
||||
#include<nlohmann/json.hpp>
|
||||
#include "cpr/cpr.h"
|
||||
|
||||
#include "Syncers/Upload.h"
|
||||
#include "Utilities/Conversions.h"
|
||||
@@ -27,11 +26,6 @@ namespace Syncers
|
||||
{
|
||||
|
||||
#pragma region Constructors
|
||||
Upload::Upload() { }
|
||||
Upload::Upload(API api) : api(api)
|
||||
{
|
||||
this->api.endpoint = "song/data";
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
||||
@@ -97,13 +91,6 @@ void Upload::uploadSongsFromDirectory(const std::string& directory,
|
||||
}
|
||||
}
|
||||
|
||||
if (!confirmUpload)
|
||||
{
|
||||
confirmUpload = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cout << "uploading songs\n";
|
||||
for (auto& song: songs)
|
||||
{
|
||||
@@ -126,10 +113,9 @@ void Upload::uploadSongWithMetadata(Managers::CommitManager::Album &album, Model
|
||||
auto url = retrieveUrl();
|
||||
|
||||
cout<<"url "<<url<<endl;
|
||||
string auth{this->m_token.tokenType};
|
||||
string auth(this->m_token.tokenType);
|
||||
auth.append(" " + this->m_token.accessToken);
|
||||
|
||||
// const auto meta = song.toMetadataJson();
|
||||
nlohmann::json s;
|
||||
s["title"] = song.title;
|
||||
s["album"] = album.album;
|
||||
@@ -146,7 +132,6 @@ void Upload::uploadSongWithMetadata(Managers::CommitManager::Album &album, Model
|
||||
|
||||
cout<<"\n\nMeta:\n"<<meta<<"\n";
|
||||
|
||||
/**
|
||||
auto multipart = cpr::Multipart{{"cover", cpr::File{cover.path}},
|
||||
{"metadata", meta},
|
||||
{"file", cpr::File{song.songPath}}};
|
||||
@@ -157,7 +142,6 @@ void Upload::uploadSongWithMetadata(Managers::CommitManager::Album &album, Model
|
||||
|
||||
cout << "status code: " << r.status_code<< std::endl;
|
||||
cout << r.text << endl;
|
||||
*/
|
||||
}
|
||||
catch (exception &e)
|
||||
{
|
||||
@@ -250,7 +234,7 @@ void Upload::printJsonData(const json& obj)
|
||||
cout<<"duration: "<<obj["duration"]<<endl;
|
||||
cout<<"song_data: "<<obj["song_data"]<<endl;
|
||||
|
||||
cout<<endl<<endl;;
|
||||
cout<<endl<<endl;
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
Reference in New Issue
Block a user