Searching by imdb id works now.
This commit is contained in:
parent
2134029904
commit
15657f7ba6
1 changed files with 7 additions and 6 deletions
13
omdb.c
13
omdb.c
|
|
@ -188,6 +188,7 @@ int handle_response(struct response *restrict resp) {
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
int ch;
|
int ch;
|
||||||
|
bool i_flag = false;
|
||||||
bool k_flag = false;
|
bool k_flag = false;
|
||||||
char search_mode[8] = "movie";
|
char search_mode[8] = "movie";
|
||||||
|
|
||||||
|
|
@ -204,11 +205,12 @@ int main(int argc, char **argv) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ch = getopt_long(argc, argv, "hijk:ft:y:", opts, NULL)) != -1) {
|
while ((ch = getopt_long(argc, argv, "hi:jk:ft:y:", opts, NULL)) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'i':
|
case 'i':
|
||||||
/* Lookup by ID */
|
/* Lookup by ID */
|
||||||
set_param(url, "id", optarg);
|
i_flag = true;
|
||||||
|
set_param(url, "i", optarg);
|
||||||
break;
|
break;
|
||||||
case 'j':
|
case 'j':
|
||||||
output_format = OUTPUT_JSON;
|
output_format = OUTPUT_JSON;
|
||||||
|
|
@ -245,16 +247,15 @@ int main(int argc, char **argv) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("Looking for: %s\n", argv[optind]);
|
|
||||||
|
|
||||||
/* Set remaining params if any... */
|
/* Set remaining params if any... */
|
||||||
set_param(url, "type", search_mode);
|
set_param(url, "type", search_mode);
|
||||||
set_param(url, "r", "json");
|
set_param(url, "r", "json");
|
||||||
/* Search for title... */
|
/* Search for title... */
|
||||||
set_param(url, "t", argv[optind]);
|
if (i_flag == false)
|
||||||
|
set_param(url, "t", argv[optind]);
|
||||||
|
|
||||||
/* Print it... */
|
/* Print it... */
|
||||||
// print_url(url);
|
/* print_url(url); */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All of the call setup should be done via the URL so all that's left is to
|
* All of the call setup should be done via the URL so all that's left is to
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue