Reworked downloaded now available. Tagging not working

This commit is contained in:
Nedko 2024-07-01 12:52:39 +03:00
parent b499c65ac8
commit 438ccdc9d7
8 changed files with 167 additions and 1085 deletions

4
.gitignore vendored
View File

@ -1,5 +1,3 @@
login.json config.json
release.json
cookies.txt
mcat_dl* mcat_dl*
.vscode/* .vscode/*

View File

@ -1,4 +1,9 @@
srcs += main.cpp
srcs += curl_dl.cpp
srcs += monstercat_dl.cpp
srcs += common.cpp
all: all:
g++ main.cpp -o mcat_dl g++ ${srcs} -lcurl -o mcat_dl
.PHONY: all .PHONY: all

53
README
View File

@ -1,26 +1,42 @@
--- Usage --- # Usage
There must be a file named "login.json" in the working directory with your monstercat credentials. There must be a file named "config.json" in the working directory with your monstercat credentials and other configurations.
See example_login.json for the template. See config_example.json for the template.
--- JSON Library Source --- # Download File Structure
### Release Folder
**download_path/Type/YYYY-MM-DD - CatalogID - Artist - Title**
* download_path - Set in config.json
* Type - Album/EP/Single
* YYYY-MM-DD - Release Date in ISO format for easy sorting
* Artist/Title - removed featuring artists from "Artist" and added to "Title"
### Cover
* Cover(.jpg/.png) - Full resolution from Monstercat
* Cover_small.jpg - 750x750 added to files
### MP3 and FLAC folders
Separate folders if more than 1 track otherwise put in main folder
### File Naming
* Artist - Title.(mp3/flac) - Used when only 1 track
* Number - Title.(mp3/flac) - Used when track artist **matches** release artist
* Number - Artist - Title.(mp3/flac) - Used when track artist **does not match** release artist
# JSON Library Source
https://github.com/nlohmann/json https://github.com/nlohmann/json
Release - 3.10.5 Release - 3.10.5
Commit - 4f8fba14066156b73f1189a2b8bd568bde5284c5 Commit - 4f8fba14066156b73f1189a2b8bd568bde5284c5
--- id3edit --- # eyeD3
https://github.com/rstemmer/id3edit https://eyed3.readthedocs.io/en/latest/
For MP3 tagging * For MP3 tagging
id3edit * TODO: Add info here
--set-name "Title"
--set-album "Album"
--set-artist "Artist"
--set-track "Track Number"
--set-artwork "/path/to/cover"
file.mp3
--- metaflac --- # metaflac
https://xiph.org/flac/download.html https://xiph.org/flac/download.html
For FLAC tagging For FLAC tagging
```
metaflac metaflac
// Common // Common
--preserve-modtime --preserve-modtime
@ -44,11 +60,14 @@ metaflac
--dont-use-padding --dont-use-padding
file.flac file.flac
```
--- imagemagick --- # imagemagick
https://imagemagick.org/script/download.php https://imagemagick.org/script/download.php
For Image Resizing For Image Resizing
magick ```
convert
Cover Cover
-resize 750x750 -resize 750x750
Cover_small.jpg Cover_small.jpg
```

4
TODO
View File

@ -0,0 +1,4 @@
* Rate limit
* Use external tools
* Download and resize cover before tracks
* Tag tracks

View File

@ -124,7 +124,11 @@ bool ensure_folder(const string& main_path, const string& folder)
if (!path_exists(main_path)) if (!path_exists(main_path))
{ {
return false; error = mkdir(main_path.c_str(), 0775);
if (0 != error)
{
return false;
}
} }
full_path = build_fname(main_path, folder, ""); full_path = build_fname(main_path, folder, "");

View File

@ -1,5 +1,5 @@
{ {
"Email": "user@example.ccom", "Email": "user@example.com",
"Pass": "password", "Pass": "password",
"download_path": "/path/to/monstercat", "download_path": "/path/to/monstercat",
"convert_exec": "convert", "convert_exec": "convert",

1170
main.cpp

File diff suppressed because it is too large Load Diff

View File

@ -455,8 +455,7 @@ bool Monstercat_DL::download_cover(const string& catalog_id, const string& path)
return false; return false;
} }
filepath = path; filepath = build_fname(path, "", "Cover");
filepath += "Cover";
if (0 == out_headers.count("content-type")) if (0 == out_headers.count("content-type"))
{ {
if (nullptr != m_log) if (nullptr != m_log)
@ -572,7 +571,6 @@ bool Monstercat_DL::download_file(const string& file_id, const string& filepath)
CURL_DL& curl = CURL_DL::get_handle(); CURL_DL& curl = CURL_DL::get_handle();
bool ok; bool ok;
string url; string url;
string filepath;
stringstream out_data; stringstream out_data;
ofstream out_file; ofstream out_file;
@ -608,5 +606,5 @@ bool Monstercat_DL::download_file(const string& file_id, const string& filepath)
out_file << out_data.rdbuf(); out_file << out_data.rdbuf();
out_file.close(); out_file.close();
return false; return true;
} }