Permalink
Browse files

Added the command line to specify the search type

  • Loading branch information...
1 parent c20c824 commit de78e38d6aeeeb642b9067e0408a8187e17dc382 @antonioarlo committed May 3, 2012
Showing with 27 additions and 1 deletion.
  1. +27 −1 backend/feed-test.c
View
@@ -4,6 +4,7 @@
static char *apikey;
static char *query = "batman";
+static char *search = "";
static GMainLoop *loop;
static GOptionEntry entries[] = {
@@ -21,6 +22,13 @@ static GOptionEntry entries[] = {
.arg_data = &query,
.description = "term to search",
},
+ {
+ .long_name = "search",
+ .short_name = 's',
+ .arg = G_OPTION_ARG_STRING,
+ .arg_data = &search,
+ .description = "search type: (movies [default], shows or episodes)",
+ },
{
.long_name = NULL,
}
@@ -54,8 +62,26 @@ cb(GObject *source, GAsyncResult *res, void *data)
gboolean
test1(void *data)
{
+ int searchInt;
+
+ if (0 == g_strcmp0("episodes", search))
+ {
+ g_print("search: episodes\n");
+ searchInt = GT_FEED_SEARCH_EPISODES;
+ }
+ else if (0 == g_strcmp0("shows", search))
+ {
+ g_print("search: shows\n");
+ searchInt = GT_FEED_SEARCH_SHOWS;
+ }
+ else
+ {
+ g_print("search: movies (default)\n");
+ searchInt = GT_FEED_SEARCH_MOVIES;
+ }
+
GtFeed *feed = g_object_new(GT_TYPE_FEED, "api-key", apikey, NULL);
- if (!gt_feed_search(feed, GT_FEED_SEARCH_MOVIES, query, cb, NULL)) {
+ if (!gt_feed_search(feed, searchInt, query, cb, NULL)) {
g_main_loop_quit(loop);
}
g_object_unref(feed);

0 comments on commit de78e38

Please sign in to comment.