diff --git a/docs/html/d1/d14/fetch_8c_source.html b/docs/html/d1/d14/fetch_8c_source.html index 7d6e5b48..720810c7 100644 --- a/docs/html/d1/d14/fetch_8c_source.html +++ b/docs/html/d1/d14/fetch_8c_source.html @@ -166,7 +166,7 @@
74 }
75
76 /* Download the JSON response. */
-
77 aria2_download(tags, page, is_nsfw, 20);
+
77 aria2_download(tags, page, is_nsfw, 20);
78
79 /* Check if the JSON response downloaded. */
80 FILE *response_json = fopen("posts.json", "r");
@@ -287,7 +287,7 @@
201 /* Delete posts.json file. */
202 remove("posts.json");
203}
-
aria2_download
void aria2_download(char *tags, int page, bool is_nsfw, int lim)
downloads the API response by using aria2c, works with a system call
Definition: aria2_download.c:19
+
aria2_download
void aria2_download(char *tags, bool is_nsfw, char *uname, char *apikey, int page, int lim)
downloads the API response by using aria2c, works with a system call
Definition: aria2_download.c:19
buffer
char * buffer
Definition: cjson.h:170
cjson_error_msg
void cjson_error_msg(const char *ptr_error)
Shows some information when cjson root gives error.
Definition: cjson_error_msg.c:18
MAX_FILE_PATH
#define MAX_FILE_PATH
This macro is used to set the default size for getting the home directory file.
Definition: fetch.c:15
diff --git a/docs/html/d5/d05/yiffy__fetch_8h.html b/docs/html/d5/d05/yiffy__fetch_8h.html index 0325b0e0..27ce8806 100644 --- a/docs/html/d5/d05/yiffy__fetch_8h.html +++ b/docs/html/d5/d05/yiffy__fetch_8h.html @@ -175,7 +175,6 @@  Reads the configuration file, sets the options and sends a request to e621-e926. After taking the response, it calls the output function to show the URLs. More...
  void aria2_download (char *tags, int page, bool is_nsfw, int lim) - downloads the API response by using aria2c, works with a system call More...
 

Macro Definition Documentation

@@ -234,18 +233,6 @@

-

downloads the API response by using aria2c, works with a system call

-
Parameters
- - - - -
tagsThese are the e621-e926 tags prompted by the user as an argument value. Example: yiffy –fetch "anthro+fur+male+smile".
pageThis is the value that is passed to the API to get results from the specified pages.
is_nsfwThis is the boolean value that checks the NSFW option. If true, sets the request string for e621 otherwise sets for e926.
-
-
- -

Definition at line 19 of file aria2_download.c.

- diff --git a/docs/html/d5/d05/yiffy__fetch_8h_source.html b/docs/html/d5/d05/yiffy__fetch_8h_source.html index 3fde6110..c43883dd 100644 --- a/docs/html/d5/d05/yiffy__fetch_8h_source.html +++ b/docs/html/d5/d05/yiffy__fetch_8h_source.html @@ -128,11 +128,11 @@
25#define BAD_SYSTEM_FUNC_CALL -1
26
27void fetch(char *tags, int page, char *command);
-
28void aria2_download(char *tags, int page, bool is_nsfw, int lim);
+
28void aria2_download(char *tags, int page, bool is_nsfw, int lim);
29
30#endif /* YIFFY_SEARCH_H */
void fetch(char *tags, int page, char *command)
Reads the configuration file, sets the options and sends a request to e621-e926. After taking the res...
Definition: fetch.c:32
-
void aria2_download(char *tags, int page, bool is_nsfw, int lim)
downloads the API response by using aria2c, works with a system call
+
void aria2_download(char *tags, int page, bool is_nsfw, int lim)
diff --git a/docs/html/d6/d60/aria2__download_8c.html b/docs/html/d6/d60/aria2__download_8c.html index 97c09f78..e55cecfe 100644 --- a/docs/html/d6/d60/aria2__download_8c.html +++ b/docs/html/d6/d60/aria2__download_8c.html @@ -141,9 +141,9 @@ - - - + + +

Functions

void aria2_download (char *tags, int page, bool is_nsfw, int lim)
 downloads the API response by using aria2c, works with a system call More...
 
void aria2_download (char *tags, bool is_nsfw, char *uname, char *apikey, int page, int lim)
 downloads the API response by using aria2c, works with a system call More...
 

Detailed Description

Downloads the JSON file by using aria2c, works with the system function.

@@ -153,8 +153,8 @@

Definition in file aria2_download.c.

Function Documentation

- -

◆ aria2_download()

+ +

◆ aria2_download()

@@ -168,14 +168,26 @@

- int  - page, + bool  + is_nsfw, - bool  - is_nsfw, + char *  + uname, + + + + + char *  + apikey, + + + + + int  + page, diff --git a/docs/html/d6/d60/aria2__download_8c.js b/docs/html/d6/d60/aria2__download_8c.js index b9305c94..c9cddc08 100644 --- a/docs/html/d6/d60/aria2__download_8c.js +++ b/docs/html/d6/d60/aria2__download_8c.js @@ -1,4 +1,4 @@ var aria2__download_8c = [ - [ "aria2_download", "d6/d60/aria2__download_8c.html#a5d6732ce337f794d14f9f2b835a0d2ef", null ] + [ "aria2_download", "d6/d60/aria2__download_8c.html#a89f12219462c5d1dd6d1d1dc2896914d", null ] ]; \ No newline at end of file diff --git a/docs/html/d6/d60/aria2__download_8c_source.html b/docs/html/d6/d60/aria2__download_8c_source.html index 058bcab8..ddde638a 100644 --- a/docs/html/d6/d60/aria2__download_8c_source.html +++ b/docs/html/d6/d60/aria2__download_8c_source.html @@ -113,7 +113,7 @@ Go to the documentation of this file.
1
13#include "yiffy_fetch.h"
14
-
19void aria2_download(char *tags, int page, bool is_nsfw, int lim)
+
19void aria2_download(char *tags, bool is_nsfw, char *uname, char *apikey, int page, int lim)
20{
21 char *request_string = (char*)malloc(256 * sizeof(char));
22
@@ -126,11 +126,11 @@
29 /* Set the string for NSFW or SFW option by checking the isNsfw parameter. */
30 if (is_nsfw)
31 {
-
32 sprintf(request_string, "aria2c \"https://e621.net/posts.json?limit=%d&page=%d&tags=%s\" -o posts.json >/dev/null 2>&1", lim, page, tags);
+
32 sprintf(request_string, "aria2c \"https://e621.net/posts.json?login=%s&api_key=%s&limit=%d&page=%d&tags=%s\" -o posts.json >/dev/null 2>&1", uname, apikey, lim, page, tags);
33 }
34 else
35 {
-
36 sprintf(request_string, "aria2c \"https://e926.net/posts.json?limit=%d&page=%d&tags=%s\" -o posts.json >/dev/null 2>&1", lim, page, tags);
+
36 sprintf(request_string, "aria2c \"https://e926.net/posts.json?login=%s&api_key=%s&limit=%d&page=%d&tags=%s\" -o posts.json >/dev/null 2>&1", uname, apikey, lim, page, tags);
37 }
38
39 /* Download the JSON and set a sleep(1) for signals. */
@@ -145,7 +145,7 @@
48 exit(EXIT_FAILURE);
49 }
50}
-
void aria2_download(char *tags, int page, bool is_nsfw, int lim)
downloads the API response by using aria2c, works with a system call
+
void aria2_download(char *tags, bool is_nsfw, char *uname, char *apikey, int page, int lim)
downloads the API response by using aria2c, works with a system call
void malloc_error_msg()
Shows some information when yiffy cannot allocate memory.
void system_func_error_msg()
Shows some information when system function not works.
diff --git a/docs/html/dc/d3b/show__config_8c_source.html b/docs/html/dc/d3b/show__config_8c_source.html index ebe09b41..d73fe0d1 100644 --- a/docs/html/dc/d3b/show__config_8c_source.html +++ b/docs/html/dc/d3b/show__config_8c_source.html @@ -153,8 +153,8 @@
52 }
53
54 /* Write the configurations to terminal. */
-
55 fprintf(stdout, "current yiffy configurations\n");
-
56 fprintf(stdout, "----------------------------\n");
+
55 fprintf(stdout, "yiffy configurations (config.txt)\n");
+
56 fprintf(stdout, "---------------------------------\n");
57
58 while (fgets(buffer, MAX_BUFFER_SIZE - 1, config_file))
59 {
@@ -178,8 +178,8 @@
78 }
79
80 /* Write the credentials to terminal. */
-
81 fprintf(stdout, "current yiffy credentials\n");
-
82 fprintf(stdout, "-------------------------\n");
+
81 fprintf(stdout, "yiffy credentials (credentials.txt)\n");
+
82 fprintf(stdout, "-----------------------------------\n");
83
84 while (fgets(buffer, MAX_BUFFER_SIZE - 1, credentials_file))
85 {
diff --git a/docs/html/dc/dec/search_8c_source.html b/docs/html/dc/dec/search_8c_source.html index df612c23..f871ab09 100644 --- a/docs/html/dc/dec/search_8c_source.html +++ b/docs/html/dc/dec/search_8c_source.html @@ -197,7 +197,7 @@
99 create_controls_window(controls_window, &posts_panel_height, controls, sizeof(controls) / sizeof(controls[0]));
100
101 /* Download the first page of posts with prompted tags. */
-
102 aria2_download(tags, 1, is_nsfw, posts_panel_height);
+
102 aria2_download(tags, 1, is_nsfw, posts_panel_height);
103
104 /* Read the posts.json file. */
105 FILE *posts_json_file = fopen("posts.json", "r");
@@ -277,7 +277,7 @@
179 getch();
180 endwin();
181}
-
void aria2_download(char *tags, int page, bool is_nsfw, int lim)
downloads the API response by using aria2c, works with a system call
+
void aria2_download(char *tags, bool is_nsfw, char *uname, char *apikey, int page, int lim)
downloads the API response by using aria2c, works with a system call
char * buffer
Definition: cjson.h:170
void create_controls_window(WINDOW *window, int *posts_panel_height, control *controls, int total_controls)
Creates a new window to display the controls and adds it to the specified position.
void create_post_tags_window(WINDOW *window, int *posts_panel_height)
Creates a new window to display post tags and adds it to the specified position.
diff --git a/docs/html/de/d0c/show__help_8c_source.html b/docs/html/de/d0c/show__help_8c_source.html index 11605bdb..26914cd2 100644 --- a/docs/html/de/d0c/show__help_8c_source.html +++ b/docs/html/de/d0c/show__help_8c_source.html @@ -115,36 +115,36 @@
12
17{
-
18 fprintf(stdout, "usage: yiffy [OPTION]\n");
+
18 fprintf(stdout, "usage: yiffy [option]\n");
19 fprintf(stdout, "use e621 and e926 from the terminal interface\n\n");
20
21 fprintf(stdout, "yiffy search tui argument\n");
22 fprintf(stdout, "-------------------------\n");
-
23 fprintf(stdout, "--search \"[TAGS]\" opens a tui interface\n\n");
+
23 fprintf(stdout, "--search [tags] opens a tui interface\n\n");
24
25 fprintf(stdout, "yiffy api fetch arguments\n");
26 fprintf(stdout, "-------------------------\n");
-
27 fprintf(stdout, "--fetch \"[TAGS]\" fetches urls\n");
-
28 fprintf(stdout, "--dfetch \"[TAGS]\" fetches urls and downloads\n\n");
+
27 fprintf(stdout, "--fetch [tags] fetches urls\n");
+
28 fprintf(stdout, "--dfetch [tags] fetches urls and downloads\n\n");
29
30 fprintf(stdout, "yiffy information menu arguments\n");
31 fprintf(stdout, "--------------------------------\n");
-
32 fprintf(stdout, "--help outputs the help menu\n");
-
33 fprintf(stdout, "--version outputs the version\n");
-
34 fprintf(stdout, "--github outputs the github url\n");
-
35 fprintf(stdout, "--config outputs the configs-credentials\n\n");
+
32 fprintf(stdout, "--help outputs the help menu\n");
+
33 fprintf(stdout, "--version outputs the version\n");
+
34 fprintf(stdout, "--github outputs the github url\n");
+
35 fprintf(stdout, "--config outputs the configs-credentials\n\n");
36
37 fprintf(stdout, "yiffy data import-export arguments\n");
-
38 fprintf(stdout, "-----------------------------------\n");
-
39 fprintf(stdout, "--import imports the data to program\n");
-
40 fprintf(stdout, "--export exports the data from program\n\n");
+
38 fprintf(stdout, "----------------------------------\n");
+
39 fprintf(stdout, "--import imports the data to program\n");
+
40 fprintf(stdout, "--export exports the data from program\n\n");
41
42 fprintf(stdout, "yiffy config and credential arguments\n");
43 fprintf(stdout, "-------------------------------------\n");
-
44 fprintf(stdout, "--nsfw \"[ON/OFF]\" switches to nsfw/sfw options\n");
-
45 fprintf(stdout, "--ivcommand \"[CMD]\" sets the image viewer command\n");
-
46 fprintf(stdout, "--uname \"[UNAME]\" sets the username\n");
-
47 fprintf(stdout, "--apikey \"[API KEY]\" sets the api key\n");
+
44 fprintf(stdout, "--nsfw [on/off] switches to nsfw/sfw options\n");
+
45 fprintf(stdout, "--ivcommand [cmd] sets the image viewer command\n");
+
46 fprintf(stdout, "--uname [uname] sets the username\n");
+
47 fprintf(stdout, "--apikey [apikey] sets the api key\n");
48
49}
void show_help()
Shows the general help menu to user.
Definition: show_help.c:16
diff --git a/docs/html/globals.html b/docs/html/globals.html index 3f85a16d..78a8faea 100644 --- a/docs/html/globals.html +++ b/docs/html/globals.html @@ -114,7 +114,7 @@

- a -

diff --git a/docs/html/globals_func.html b/docs/html/globals_func.html index a4a19129..5b6f8411 100644 --- a/docs/html/globals_func.html +++ b/docs/html/globals_func.html @@ -113,7 +113,7 @@

- a -

diff --git a/docs/html/navtreeindex0.js b/docs/html/navtreeindex0.js index b96e5622..71cd3349 100644 --- a/docs/html/navtreeindex0.js +++ b/docs/html/navtreeindex0.js @@ -181,7 +181,7 @@ var NAVTREEINDEX0 = "d6/d49/cjson_8c.html#aed7e219a2b9187880c97c6f0ea5fa1b4":[6,0,0,1,0,21], "d6/d49/cjson_8c_source.html":[6,0,0,1,0], "d6/d60/aria2__download_8c.html":[6,0,0,3,0], -"d6/d60/aria2__download_8c.html#a5d6732ce337f794d14f9f2b835a0d2ef":[6,0,0,3,0,0], +"d6/d60/aria2__download_8c.html#a89f12219462c5d1dd6d1d1dc2896914d":[6,0,0,3,0,0], "d6/d60/aria2__download_8c_source.html":[6,0,0,3,0], "d6/dd7/conf__successful__msg_8c.html":[6,0,0,5,5], "d6/dd7/conf__successful__msg_8c.html#a4c232dc73b53a88d1d351208928e889c":[6,0,0,5,5,0], diff --git a/docs/html/search/all_0.js b/docs/html/search/all_0.js index 6dcd2161..7eebe32f 100644 --- a/docs/html/search/all_0.js +++ b/docs/html/search/all_0.js @@ -8,6 +8,6 @@ var searchData= ['argc_5ferror_5fmsg_5',['argc_error_msg',['../d3/de0/argc__error__msg_8c.html#a020d66de7fd128881c8398247a0d0bdd',1,'argc_error_msg(int argc): argc_error_msg.c'],['../d0/de2/yiffy__messages_8h.html#a020d66de7fd128881c8398247a0d0bdd',1,'argc_error_msg(int argc): argc_error_msg.c']]], ['argc_5ferror_5fmsg_2ec_6',['argc_error_msg.c',['../d3/de0/argc__error__msg_8c.html',1,'']]], ['argc_5fqty_5ferror_7',['ARGC_QTY_ERROR',['../dc/dc0/yiffy_8c.html#a667329addeab5d6f7d3f18fc38bd9b90',1,'yiffy.c']]], - ['aria2_5fdownload_8',['aria2_download',['../d6/d60/aria2__download_8c.html#a5d6732ce337f794d14f9f2b835a0d2ef',1,'aria2_download(char *tags, int page, bool is_nsfw, int lim): aria2_download.c'],['../d5/d05/yiffy__fetch_8h.html#a5d6732ce337f794d14f9f2b835a0d2ef',1,'aria2_download(char *tags, int page, bool is_nsfw, int lim): aria2_download.c']]], + ['aria2_5fdownload_8',['aria2_download',['../d6/d60/aria2__download_8c.html#a89f12219462c5d1dd6d1d1dc2896914d',1,'aria2_download(char *tags, bool is_nsfw, char *uname, char *apikey, int page, int lim): aria2_download.c'],['../d5/d05/yiffy__fetch_8h.html#a5d6732ce337f794d14f9f2b835a0d2ef',1,'aria2_download(char *tags, int page, bool is_nsfw, int lim): yiffy_fetch.h']]], ['aria2_5fdownload_2ec_9',['aria2_download.c',['../d6/d60/aria2__download_8c.html',1,'']]] ]; diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js index 234c9cad..690704a2 100644 --- a/docs/html/search/functions_0.js +++ b/docs/html/search/functions_0.js @@ -4,5 +4,5 @@ var searchData= ['allocate_1',['allocate',['../d1/d07/structinternal__hooks.html#a8b8f7ff45faa5da18dd3ccd2a2c8e416',1,'internal_hooks']]], ['already_5fconf_5fmsg_2',['already_conf_msg',['../da/d03/already__conf__msg_8c.html#a2b3c403bb7977f8a7672f39dec8d5659',1,'already_conf_msg(char *option, char *argv): already_conf_msg.c'],['../d0/de2/yiffy__messages_8h.html#a2b3c403bb7977f8a7672f39dec8d5659',1,'already_conf_msg(char *option, char *argv): already_conf_msg.c']]], ['argc_5ferror_5fmsg_3',['argc_error_msg',['../d3/de0/argc__error__msg_8c.html#a020d66de7fd128881c8398247a0d0bdd',1,'argc_error_msg(int argc): argc_error_msg.c'],['../d0/de2/yiffy__messages_8h.html#a020d66de7fd128881c8398247a0d0bdd',1,'argc_error_msg(int argc): argc_error_msg.c']]], - ['aria2_5fdownload_4',['aria2_download',['../d6/d60/aria2__download_8c.html#a5d6732ce337f794d14f9f2b835a0d2ef',1,'aria2_download(char *tags, int page, bool is_nsfw, int lim): aria2_download.c'],['../d5/d05/yiffy__fetch_8h.html#a5d6732ce337f794d14f9f2b835a0d2ef',1,'aria2_download(char *tags, int page, bool is_nsfw, int lim): aria2_download.c']]] + ['aria2_5fdownload_4',['aria2_download',['../d6/d60/aria2__download_8c.html#a89f12219462c5d1dd6d1d1dc2896914d',1,'aria2_download(char *tags, bool is_nsfw, char *uname, char *apikey, int page, int lim): aria2_download.c'],['../d5/d05/yiffy__fetch_8h.html#a5d6732ce337f794d14f9f2b835a0d2ef',1,'aria2_download(char *tags, int page, bool is_nsfw, int lim): yiffy_fetch.h']]] ]; diff --git a/src/fetch/aria2_download.c b/src/fetch/aria2_download.c index a7523094..bd88d548 100644 --- a/src/fetch/aria2_download.c +++ b/src/fetch/aria2_download.c @@ -16,7 +16,7 @@ /// @param tags These are the e621-e926 tags prompted by the user as an argument value. Example: yiffy --fetch "anthro+fur+male+smile". /// @param page This is the value that is passed to the API to get results from the specified pages. /// @param is_nsfw This is the boolean value that checks the NSFW option. If true, sets the request string for e621 otherwise sets for e926. -void aria2_download(char *tags, int page, bool is_nsfw, int lim) +void aria2_download(char *tags, bool is_nsfw, char *uname, char *apikey, int page, int lim) { char *request_string = (char*)malloc(256 * sizeof(char)); @@ -29,11 +29,11 @@ void aria2_download(char *tags, int page, bool is_nsfw, int lim) /* Set the string for NSFW or SFW option by checking the isNsfw parameter. */ if (is_nsfw) { - sprintf(request_string, "aria2c \"https://e621.net/posts.json?limit=%d&page=%d&tags=%s\" -o posts.json >/dev/null 2>&1", lim, page, tags); + sprintf(request_string, "aria2c \"https://e621.net/posts.json?login=%s&api_key=%s&limit=%d&page=%d&tags=%s\" -o posts.json >/dev/null 2>&1", uname, apikey, lim, page, tags); } else { - sprintf(request_string, "aria2c \"https://e926.net/posts.json?limit=%d&page=%d&tags=%s\" -o posts.json >/dev/null 2>&1", lim, page, tags); + sprintf(request_string, "aria2c \"https://e926.net/posts.json?login=%s&api_key=%s&limit=%d&page=%d&tags=%s\" -o posts.json >/dev/null 2>&1", uname, apikey, lim, page, tags); } /* Download the JSON and set a sleep(1) for signals. */