Ready for release
This commit is contained in:
@@ -7,7 +7,7 @@ IcarusDownloadManager is a Linux CLI software client application that has the fe
|
|||||||
|
|
||||||
* C++ with C++17 features
|
* C++ with C++17 features
|
||||||
* CMake
|
* CMake
|
||||||
* GCC >= 9
|
* GCC >= 9 or Visual Studio >= 16 [2019]
|
||||||
* [conan](https://github.com/conan-io/conan)
|
* [conan](https://github.com/conan-io/conan)
|
||||||
* [json](https://github.com/nlohmann/json)
|
* [json](https://github.com/nlohmann/json)
|
||||||
* [openssl](https://github.com/openssl/openssl)
|
* [openssl](https://github.com/openssl/openssl)
|
||||||
@@ -28,18 +28,20 @@ cd build
|
|||||||
|
|
||||||
conan install .. --build
|
conan install .. --build
|
||||||
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=RELEASE
|
cmake ..
|
||||||
cmake --build . -j
|
cmake --build . --config release -j
|
||||||
```
|
```
|
||||||
|
|
||||||
The program has been built and can be executed by the binary file *icd*. For information on how to use icd, merely execute the program without any command line arguments.
|
The program has been built and can be executed by the binary file *icd*. For information on how to use icd, merely execute the program without any command line arguments.
|
||||||
|
|
||||||
### Downloading Song
|
### Downloading Song
|
||||||
|
|
||||||
```BASH
|
```BASH
|
||||||
icd download -u spacecadet -p stellar40 -h https://icarus.com -b 15
|
icd download -u spacecadet -p stellar40 -h https://icarus.com -b 15
|
||||||
```
|
```
|
||||||
|
|
||||||
### Uploading Song
|
### Uploading Song
|
||||||
|
|
||||||
```BASH
|
```BASH
|
||||||
icd upload -u spacecadet -p stellar40 -h https://icarus.com -s /path/of/song.mp3
|
icd upload -u spacecadet -p stellar40 -h https://icarus.com -s /path/of/song.mp3
|
||||||
```
|
```
|
||||||
@@ -53,16 +55,18 @@ icd upload-meta -u spacecadet -p stellar40 -h https://icarus.com -s /path/of/son
|
|||||||
### Uploading Song with metadata from directory
|
### Uploading Song with metadata from directory
|
||||||
|
|
||||||
```BASH
|
```BASH
|
||||||
icd upload-meta -u spacecadet -p stellar40 -h https://icarus.com -smca /path/where/songs/and/metadata/exist
|
icd upload-meta -u spacecadet -p stellar40 -h https://icarus.com -smca /path/where/songs/and/metadata/exists/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Retrieving Song in json
|
### Retrieving Song in json
|
||||||
|
|
||||||
```Bash
|
```Bash
|
||||||
icd retrieve -u spacecadet -p stellar40 -h https://icarus.com -rt songs
|
icd retrieve -u spacecadet -p stellar40 -h https://icarus.com -rt songs
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deleting Song
|
### Deleting Song
|
||||||
|
|
||||||
```BASH
|
```BASH
|
||||||
icd delete -u spacecadet -p stellar40 -h https://icarus.com -D 15
|
icd delete -u spacecadet -p stellar40 -h https://icarus.com -D 15
|
||||||
```
|
```
|
||||||
@@ -74,6 +78,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on the code of conduc
|
|||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
|
[v0.2.0](https://github.com/kdeng00/IcarusDownloadManager/releases/tag/v0.2.0)
|
||||||
[v0.1.1](https://github.com/kdeng00/IcarusDownloadManager/releases/tag/v0.1.1)
|
[v0.1.1](https://github.com/kdeng00/IcarusDownloadManager/releases/tag/v0.1.1)
|
||||||
[v0.1.0](https://github.com/kdeng00/IcarusDownloadManager/releases/tag/0.1.0)
|
[v0.1.0](https://github.com/kdeng00/IcarusDownloadManager/releases/tag/0.1.0)
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
@@ -19,6 +20,44 @@ public:
|
|||||||
std::cout<<"\n";
|
std::cout<<"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string song_path() noexcept
|
||||||
|
{
|
||||||
|
std::stringstream buffer;
|
||||||
|
|
||||||
|
buffer << this->directory;
|
||||||
|
|
||||||
|
const auto count = this->directory.size();
|
||||||
|
|
||||||
|
if (this->directory.at(count - 1) != '/' || this->directory.at(count - 1) != '\\')
|
||||||
|
{
|
||||||
|
buffer << "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer << this->filename;
|
||||||
|
|
||||||
|
return buffer.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
int generate_filename_from_track()
|
||||||
|
{
|
||||||
|
auto result = 0;
|
||||||
|
std::stringstream buffer;
|
||||||
|
buffer << "track";
|
||||||
|
|
||||||
|
// NOTE: Multiple discs in one directory is not being addressed
|
||||||
|
if (this->track < 10)
|
||||||
|
{
|
||||||
|
buffer << "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer << this->track << ".mp3";
|
||||||
|
|
||||||
|
|
||||||
|
this->filename.assign(buffer.str());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
std::string toMetadataJson();
|
std::string toMetadataJson();
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +71,10 @@ public:
|
|||||||
int track;
|
int track;
|
||||||
int disc;
|
int disc;
|
||||||
std::string data;
|
std::string data;
|
||||||
|
[[deprecated("Use song_path() function instead")]]
|
||||||
std::string songPath;
|
std::string songPath;
|
||||||
|
std::string filename;
|
||||||
|
std::string directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CoverArt
|
class CoverArt
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ using Managers::CommitManager;
|
|||||||
|
|
||||||
constexpr static auto IcarusDownloadManager_version()
|
constexpr static auto IcarusDownloadManager_version()
|
||||||
{
|
{
|
||||||
return "v0.1.2";
|
return "v0.2.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
void printHelp()
|
void printHelp()
|
||||||
|
|||||||
@@ -308,7 +308,9 @@ void CommitManager::singTargetUpload(const std::string &songPath, const std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
song = *sng;
|
song = *sng;
|
||||||
song.songPath = songPath;
|
const auto p = fs::path(songPath);
|
||||||
|
song.directory = p.parent_path.string();
|
||||||
|
song.generate_filename_from_track();
|
||||||
|
|
||||||
Models::CoverArt cover;
|
Models::CoverArt cover;
|
||||||
cover.title = song.title;
|
cover.title = song.title;
|
||||||
@@ -363,6 +365,8 @@ void CommitManager::multiTargetUpload(const std::string &sourcePath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto album = retrieveMetadata(metadataPath);
|
auto album = retrieveMetadata(metadataPath);
|
||||||
|
songs.clear();
|
||||||
|
songs.assign(album.songs.begin(), album.songs.end());
|
||||||
|
|
||||||
Upload up(api, token);
|
Upload up(api, token);
|
||||||
|
|
||||||
@@ -399,6 +403,9 @@ CommitManager::Album CommitManager::retrieveMetadata(const std::string_view path
|
|||||||
song.album = album.album;
|
song.album = album.album;
|
||||||
song.year = album.year;
|
song.year = album.year;
|
||||||
song.genre = album.genre;
|
song.genre = album.genre;
|
||||||
|
song.generate_filename_from_track();
|
||||||
|
const auto p = fs::path(path);
|
||||||
|
song.directory = p.parent_path().string();
|
||||||
|
|
||||||
album.songs.push_back(song);
|
album.songs.push_back(song);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ void Upload::uploadSongWithMetadata(Managers::CommitManager::Album &album, Model
|
|||||||
{
|
{
|
||||||
auto url = retrieveUrl();
|
auto url = retrieveUrl();
|
||||||
|
|
||||||
cout<<"url "<<url<<endl;
|
cout << "url " << url << "\n";
|
||||||
string auth(this->m_token.tokenType);
|
string auth(this->m_token.tokenType);
|
||||||
auth.append(" " + this->m_token.accessToken);
|
auth.append(" " + this->m_token.accessToken);
|
||||||
|
|
||||||
@@ -131,10 +131,11 @@ void Upload::uploadSongWithMetadata(Managers::CommitManager::Album &album, Model
|
|||||||
const auto meta = s.dump();
|
const auto meta = s.dump();
|
||||||
|
|
||||||
cout<<"\n\nMeta:\n"<<meta<<"\n";
|
cout<<"\n\nMeta:\n"<<meta<<"\n";
|
||||||
|
cout << "Filepath: " << song.song_path() << "\n";
|
||||||
|
|
||||||
auto multipart = cpr::Multipart{{"cover", cpr::File{cover.path}},
|
auto multipart = cpr::Multipart{{"cover", cpr::File{cover.path}},
|
||||||
{"metadata", meta},
|
{"metadata", meta},
|
||||||
{"file", cpr::File{song.songPath}}};
|
{"file", cpr::File{song.song_path()}}};
|
||||||
|
|
||||||
auto r = cpr::Post(cpr::Url{url}, multipart,
|
auto r = cpr::Post(cpr::Url{url}, multipart,
|
||||||
cpr::Header{{"authorization", auth}}
|
cpr::Header{{"authorization", auth}}
|
||||||
|
|||||||
Reference in New Issue
Block a user