Compare commits

...

3 Commits

Author SHA1 Message Date
cf21d5cd74 Fixed donwloader to work with direct cookie. Cleaned some files. 2024-09-10 14:50:21 +03:00
7fd7492dc2 Changed file naming 2024-07-09 16:42:14 +03:00
49eb64f589 Addedd Prerequisites to README 2024-07-01 16:34:58 +03:00
8 changed files with 35 additions and 34 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
config.json config.json
cookies.txt
mcat_dl* mcat_dl*
.vscode/* .vscode/*

View File

@@ -1,9 +1,23 @@
# Prerequisites
### Ubuntu
`apt install build-essential libcurl4-gnutls-dev imagemagick eyeD3 flac`
### Other OS
* make
* g++
* libcurl
* imagemagick (convert executable)
* eyeD3 executable
* metaflac executable
# Usage # Usage
There must be a file named "config.json" in the working directory with your monstercat credentials and other configurations. There must be a file named "config.json" in the working directory with your monstercat credentials and other configurations.
See config_example.json for the template. See config_example.json for the template.
Invoke `make` to compile. Requires libcurl. Invoke `make` to compile. Requires libcurl.
Login via browser and export `cid` cookie to cookies.txt (Netscape format)
Invoke `mcat_dl` with catalog ID as extra arguments to download. Invoke `mcat_dl` with catalog ID as extra arguments to download.
# Download File Structure # Download File Structure
@@ -25,7 +39,7 @@ Separate folders if more than 1 track otherwise put in main folder.
This is where extended mixes are put into. They are in their original format. This is where extended mixes are put into. They are in their original format.
### File Naming ### File Naming
* Artist - Title.(mp3/flac) - Used when only 1 track * Title.(mp3/flac) - Used when only 1 track
* Number - Title.(mp3/flac) - Used when track artist **matches** release artist * 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 * Number - Artist - Title.(mp3/flac) - Used when track artist **does not match** release artist

View File

@@ -185,13 +185,13 @@ bool CURL_DL::download(const string& url, ostream* out,
curl_easy_reset(m_handle); curl_easy_reset(m_handle);
// Enable cookie engine // Enable cookie engine
curl_easy_setopt(m_handle, CURLOPT_COOKIEFILE, ""); curl_easy_setopt(m_handle, CURLOPT_COOKIEFILE, "cookies.txt");
// Enable error messages // Enable error messages
curl_easy_setopt(m_handle, CURLOPT_ERRORBUFFER, m_error); curl_easy_setopt(m_handle, CURLOPT_ERRORBUFFER, m_error);
// Set User-Agent // Set User-Agent
curl_easy_setopt(m_handle, CURLOPT_USERAGENT, "Internedko Archiver"); curl_easy_setopt(m_handle, CURLOPT_USERAGENT, "Internedko Downloader");
if ((nullptr == params) || (params->count("no-redir") == 0)) if ((nullptr == params) || (params->count("no-redir") == 0))
{ {

View File

@@ -1,7 +0,0 @@
{
"comment": "This file will attempt to download MCLP001, MCLP001-X, MCLP002, ... MCLP010-X",
"prefix": "MCLP",
"suffix_try": "-X",
"start": 1,
"end": 10
}

View File

@@ -1,10 +0,0 @@
{
"comment": "This file will attempt to download MCS1091, MCS1195, MCS1425, MCS1426",
"releases":
[
"MCS1091",
"MCS1195",
"MCS1425",
"MCS1426"
]
}

View File

@@ -1,4 +0,0 @@
{
"Email": "USER",
"Password": "PASS"
}

View File

@@ -160,12 +160,15 @@ int main(int argc, char **argv)
json_extract(config, "eyed3_exec", eyed3_exec); json_extract(config, "eyed3_exec", eyed3_exec);
json_extract(config, "metaflac_exec", metaflac_exec); json_extract(config, "metaflac_exec", metaflac_exec);
// Disable LOGIN
#if 0
ok = mcat.login(email, pass); ok = mcat.login(email, pass);
if (!ok) if (!ok)
{ {
cout << "Could not login" << endl; cout << "Could not login" << endl;
return -1; return -1;
} }
#endif
if (argc < 2) if (argc < 2)
{ {
@@ -331,11 +334,14 @@ int main(int argc, char **argv)
} }
} }
// Disable LOGOUT
#if 0
ok = mcat.logout(); ok = mcat.logout();
if (!ok) if (!ok)
{ {
cout << "Could not log out" << endl; cout << "Could not log out" << endl;
} }
#endif
return 0; return 0;
} }

View File

@@ -389,15 +389,17 @@ string Monstercat_DL::calc_track_filename(const Release& release, int track_num)
return ""; return "";
} }
// Determine what we need // Determine whether number is needed
if (1 == release.tracks.size()) if (1 == release.tracks.size())
{ {
use_number = false; use_number = false;
use_artist = true;
} }
else else
{ {
use_number = true; use_number = true;
}
// Determine whether artist is needed
if (track->artist == release.artist) if (track->artist == release.artist)
{ {
use_artist = false; use_artist = false;
@@ -406,7 +408,6 @@ string Monstercat_DL::calc_track_filename(const Release& release, int track_num)
{ {
use_artist = true; use_artist = true;
} }
}
// Build filename // Build filename
result = ""; result = "";