Searching by imdb id works now.

This commit is contained in:
Micheal Smith 2026-01-09 04:52:45 -06:00
parent 2134029904
commit 15657f7ba6
No known key found for this signature in database
GPG key ID: E40750BFE6702504

13
omdb.c
View file

@ -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... */
set_param(url, "t", argv[optind]);
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