Compare commits
No commits in common. "63f86aa8e41318594e3b60bedcf24978df690e2e" and "6189a8b17fc19a40c09979afbc5b43a791162a9a" have entirely different histories.
63f86aa8e4
...
6189a8b17f
@ -4,10 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define version_str "1.0"
|
||||
#define conf_file "config.ini"
|
||||
#define mb_url \
|
||||
"https://musicbrainz.org/ws/2/artist?query=artist:\"%s\"&fmt=json"
|
||||
"https://musicbrainz.org/ws/2/artist?query=artist:\"Slayer\"&fmt=json"
|
||||
|
||||
const char *get_conf_str(char set_key[]) {
|
||||
const char *prog_conf = malloc(10 * sizeof(char));
|
||||
@ -66,27 +65,20 @@ void print_conf(const char m_dir[], const int mb_conf,
|
||||
}
|
||||
}
|
||||
|
||||
const char *get_mb_id(char *artist_name) {
|
||||
const char *get_mb_id() {
|
||||
int response_code;
|
||||
const char *mb_id;
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
char *buffer;
|
||||
long res_len;
|
||||
char mb_url_full[100];
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init();
|
||||
|
||||
if (curl) {
|
||||
/*Make the artist name URL safe.*/
|
||||
char *artist_name_esc = curl_easy_escape(curl, artist_name, 0);
|
||||
printf("%s", artist_name_esc);
|
||||
/*Format the MB URL to insert the Artist name for the query.*/
|
||||
snprintf(mb_url_full, sizeof(mb_url_full), mb_url, artist_name_esc);
|
||||
printf("%s\n", mb_url_full);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, mb_url_full);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, mb_url);
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, "get_artist_art.py/1.0");
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
@ -141,7 +133,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
get_mb_id("The Beatles");
|
||||
get_mb_id();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user