Searching by imdb id works now.
This commit is contained in:
parent
2134029904
commit
15657f7ba6
1 changed files with 7 additions and 6 deletions
11
omdb.c
11
omdb.c
|
|
@ -188,6 +188,7 @@ int handle_response(struct response *restrict resp) {
|
|||
|
||||
int main(int argc, char **argv) {
|
||||
int ch;
|
||||
bool i_flag = false;
|
||||
bool k_flag = false;
|
||||
char search_mode[8] = "movie";
|
||||
|
||||
|
|
@ -204,11 +205,12 @@ int main(int argc, char **argv) {
|
|||
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) {
|
||||
case 'i':
|
||||
/* Lookup by ID */
|
||||
set_param(url, "id", optarg);
|
||||
i_flag = true;
|
||||
set_param(url, "i", optarg);
|
||||
break;
|
||||
case 'j':
|
||||
output_format = OUTPUT_JSON;
|
||||
|
|
@ -245,16 +247,15 @@ int main(int argc, char **argv) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// printf("Looking for: %s\n", argv[optind]);
|
||||
|
||||
/* Set remaining params if any... */
|
||||
set_param(url, "type", search_mode);
|
||||
set_param(url, "r", "json");
|
||||
/* Search for title... */
|
||||
if (i_flag == false)
|
||||
set_param(url, "t", argv[optind]);
|
||||
|
||||
/* 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue