コード例 #1
0
gint
main (gint argc, gchar **argv)
{
  g_setenv ("GRL_PLUGIN_PATH", LUA_FACTORY_PLUGIN_PATH, TRUE);
  g_setenv ("GRL_PLUGIN_LIST", LUA_FACTORY_ID, TRUE);
  g_setenv ("GRL_NET_MOCKED", LUA_FACTORY_DATA_PATH "config.ini", TRUE);
  g_setenv ("GRL_LUA_SOURCES_PATH", LUA_FACTORY_DATA_PATH, TRUE);

  grl_init (&argc, &argv);
  g_test_init (&argc, &argv, NULL);

  test_lua_factory_setup (NULL);

  g_test_add_func ("/lua-factory/lua-library/not-callback-simple", test_not_callback_simple);
  g_test_add_func ("/lua-factory/lua-library/not-callback-after-async", test_not_callback_on_async);
  g_test_add_func ("/lua-factory/lua-library/callback-after-end", test_callback_after_end_of_operation);
  g_test_add_func ("/lua-factory/lua-library/multiple-fetch", test_correct_state_on_multiple_fetch);

  gint result = g_test_run ();

  test_lua_factory_shutdown ();
  grl_deinit ();

  return result;
}
コード例 #2
0
ファイル: loading-plugins.c プロジェクト: GNOME/grilo
gint
main (int argc, gchar *argv[])
{
  GMainLoop *loop;

  grl_init (&argc, &argv);
  GRL_LOG_DOMAIN_INIT (example_log_domain, "example");
  load_plugins ();            /* Load Grilo plugins */

  /* Run the main loop */
  loop = g_main_loop_new (NULL, FALSE);
  g_main_loop_run (loop);

  grl_deinit ();

  return 0;
}
コード例 #3
0
int
main(int argc, char **argv)
{
  g_setenv ("GRL_PLUGIN_PATH", GRILO_PLUGINS_TESTS_TMDB_PLUGIN_PATH, TRUE);
  g_setenv ("GRL_PLUGIN_LIST", TMDB_PLUGIN_ID, TRUE);

  /* We must set this before calling grl_init.
   * See https://bugzilla.gnome.org/show_bug.cgi?id=685967#c17
   */
  g_setenv ("GRL_NET_MOCKED", GRILO_PLUGINS_TESTS_TMDB_DATA_PATH "empty-data.ini", TRUE);

  grl_init (&argc, &argv);
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/tmdb/missing-configuration", test_missing_configuration);

  gint result = g_test_run ();

  grl_deinit ();

  return result;
}
コード例 #4
0
int main (int argc, char *argv[])
{
#if !GLIB_CHECK_VERSION(2,35,0)
  g_type_init ();
#endif

  grl_init (&argc, &argv);

  /*
   * Set the TMDB API key:
   * You must use your own TMDB API key in your own application.
   */
  GrlRegistry *reg = grl_registry_get_default ();
  GrlConfig *config = grl_config_new (TMDB_PLUGIN_ID, NULL);
  grl_config_set_api_key (config, TMDB_KEY);
  grl_registry_add_config (reg, config, NULL);

  /*
   * Get the plugin:
   */
  GError *error = NULL;
  gboolean plugin_loaded =
    grl_registry_load_plugin_by_id (reg, TMDB_PLUGIN_ID, &error);
  g_assert (plugin_loaded);
  g_assert_no_error (error);

  /*
   * Get the Grilo source:
   */
  GrlSource *src =
    grl_registry_lookup_source (reg, TMDB_PLUGIN_ID);

  /*
   * Check that it has the expected capability:
   */
  g_assert (grl_source_supported_operations (src) & GRL_OP_RESOLVE);
  GrlCaps *caps = grl_source_get_caps (src, GRL_OP_RESOLVE);
  g_assert (caps);

  GrlOperationOptions *options = grl_operation_options_new (caps);

  /*
   * A media item that we will give to the TMDB plugin,
   * to discover its details.
   */
  GrlMedia *media = grl_media_video_new ();
  grl_media_set_title (media, "Sherlock Holmes");

  /*
   * Discover what keys are provided by the source:
   */
  const GList *keys = grl_source_supported_keys (src);
  const GList* l = NULL;
  for (l = keys; l != NULL; l = l->next) {
    GrlKeyID id = GPOINTER_TO_INT (l->data);
    g_assert (id);

    const gchar *name = grl_metadata_key_get_name (id);
    printf ("Supported key: %s\n", name);

    /*
     * Remember this for later use:
     * You may instead use grl_registry_lookup_metadata_key_name().
     */
    if (g_strcmp0 (name, "tmdb-director") == 0) {
      director_key = id;
    }
  }

  /*
   * Ask the TMDB plugin for the media item's details,
   * from the TMDB online service:
   */
  grl_source_resolve (src, media,
    keys, options,
    resolve_cb, NULL);

  /*
   * Start the main loop so our callback can be called:
   */
  loop = g_main_loop_new (NULL, FALSE);
  g_main_loop_run (loop);

  /*
   * Release objects:
   */
  g_object_unref (media);
  g_object_unref (config);
  g_object_unref (options);

  /*
   * Deinitialize Grilo:
   */
  grl_deinit ();
}
コード例 #5
0
void
test_lua_factory_deinit (void)
{
  grl_deinit ();
}