Compare commits

..

No commits in common. "6189a8b17fc19a40c09979afbc5b43a791162a9a" and "39c6a1bcc13b8b9acd6e3d850e71fae2c0c7be65" have entirely different histories.

View File

@ -1,14 +1,13 @@
#include <curl/curl.h>
#include <libconfig.h>
#include <unistd.h>
#include <curl/curl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define conf_file "config.ini"
#define mb_url \
"https://musicbrainz.org/ws/2/artist?query=artist:\"Slayer\"&fmt=json"
#define mb_url "https://musicbrainz.org/ws/2/artist?query=artist:\"Slayer\"&fmt=json"
const char *get_conf_str(char set_key[]) {
const char *get_conf_str(char set_key[10]) {
const char *prog_conf = malloc(10 * sizeof(char));
config_t cfg;
config_setting_t *setting;
@ -30,7 +29,7 @@ const char *get_conf_str(char set_key[]) {
return prog_conf;
}
int get_conf_int(char set_key[]) {
int get_conf_int(char set_key[10]) {
int set_int;
config_t cfg;
config_setting_t *setting;
@ -52,7 +51,7 @@ int get_conf_int(char set_key[]) {
return set_int;
}
void print_conf(const char m_dir[], const int mb_conf,
void print_conf(const char m_dir[20], const int mb_conf,
const char ftv_api_key[32]) {
if (m_dir != NULL) {
printf("The music directory is: %s\n", m_dir);
@ -79,13 +78,11 @@ const char *get_mb_id() {
if (curl) {
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);
if (res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed with error: %s\n",
curl_easy_strerror(res));
fprintf(stderr, "curl_easy_perform() failed with error: %s\n", curl_easy_strerror(res));
return "1";
}
@ -96,8 +93,7 @@ const char *get_mb_id() {
res = curl_easy_recv(curl, buffer, res_len, 0);
if(res != CURLE_OK){
fprintf(stderr, "curl_easy_recv() failed with error: %s\n",
curl_easy_strerror(res));
fprintf(stderr, "curl_easy_recv() failed with error: %s\n", curl_easy_strerror(res));
return "1";
}
@ -108,9 +104,12 @@ const char *get_mb_id() {
curl_easy_cleanup(curl);
}
return mb_id;
}
int main(int argc, char **argv) {
int mb_conf, opt;
const char *m_dir, *ftv_api_key;
@ -124,16 +123,11 @@ int main(int argc, char **argv) {
case 'p':
print_conf(m_dir, mb_conf, ftv_api_key);
break;
case 's':
printf("This doesn't do anything yet but you searched for %s\n", optarg);
break;
default:
printf("So long and thanks for all the fish.\n");
break;
}
}
get_mb_id();
return EXIT_SUCCESS;
}