Saving changes
This commit is contained in:
+33
-21
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
|
||||
project(IcarusDownloadManager)
|
||||
@@ -9,29 +9,41 @@ message(STATUS "Checking compiler flags for C++17 support.")
|
||||
# Set C++17 support flags for various compilers
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
check_cxx_compiler_flag("-std=c++17" COMPILER_SUPPORTS_CXX17)
|
||||
check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
if(WIN32)
|
||||
message("Windows")
|
||||
set(vs_ver 19.29.30138)
|
||||
|
||||
if(COMPILER_SUPPORTS_CXX17)
|
||||
message(STATUS "C++17 is supported.")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL ${vs_ver})
|
||||
message("Visual Studio version is at least ${vs_ver}")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
||||
endif()
|
||||
elseif(COMPILER_SUPPORTS_CXX0X)
|
||||
message(STATUS "C++0x is supported.")
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
endif()
|
||||
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++latest")
|
||||
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
|
||||
check_cxx_compiler_flag("-std=c++17" COMPILER_SUPPORTS_CXX17)
|
||||
check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
|
||||
if(COMPILER_SUPPORTS_CXX17)
|
||||
message(STATUS "C++17 is supported.")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
||||
endif()
|
||||
elseif(COMPILER_SUPPORTS_CXX0X)
|
||||
message(STATUS "C++0x is supported.")
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+11
-10
@@ -1,18 +1,18 @@
|
||||
#ifndef UPLOAD_H_
|
||||
#define UPLOAD_H_
|
||||
|
||||
#include<filesystem>
|
||||
#include<string>
|
||||
#include<vector>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include<nlohmann/json.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include"Managers/CommitManager.h"
|
||||
#include"Managers/FileManager.h"
|
||||
#include"Models/API.h"
|
||||
#include"Models/Song.h"
|
||||
#include"Models/Token.h"
|
||||
#include"Models/UploadForm.h"
|
||||
#include "Managers/CommitManager.h"
|
||||
#include "Managers/FileManager.h"
|
||||
#include "Models/API.h"
|
||||
#include "Models/Song.h"
|
||||
#include "Models/Token.h"
|
||||
#include "Models/UploadForm.h"
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@@ -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()
|
||||
|
||||
+8
-24
@@ -1,12 +1,11 @@
|
||||
#include<iostream>
|
||||
#include<filesystem>
|
||||
#include<exception>
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <exception>
|
||||
|
||||
#include<cpr/cpr.h>
|
||||
#include<nlohmann/json.hpp>
|
||||
#include "cpr/cpr.h"
|
||||
|
||||
#include"Syncers/Upload.h"
|
||||
#include"Utilities/Conversions.h"
|
||||
#include "Syncers/Upload.h"
|
||||
#include "Utilities/Conversions.h"
|
||||
|
||||
using std::cout;
|
||||
using std::cin;
|
||||
@@ -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