gboolean grl_gravatar_source_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { GRL_LOG_DOMAIN_INIT (gravatar_log_domain, "gravatar"); GRL_DEBUG ("grl_gravatar_source_plugin_init"); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); if (!GRL_METADATA_KEY_ARTIST_AVATAR && !GRL_METADATA_KEY_AUTHOR_AVATAR) { GRL_WARNING ("Unable to register \"author-avatar\" nor \"artist-avatar\""); return FALSE; } GrlGravatarSource *source = grl_gravatar_source_new (); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); return TRUE; }
static void server_found_cb (GrlDleynaServersManager *serversmgr, GrlDleynaServer *server, gpointer *user_data) { GrlPlugin *plugin = GRL_PLUGIN (user_data); GrlDleynaMediaDevice *device; GrlSource *source; GrlRegistry *registry; GError *error = NULL; GRL_DEBUG (G_STRFUNC); device = grl_dleyna_server_get_media_device (server); GRL_DEBUG ("%s udn: %s ", G_STRFUNC, grl_dleyna_media_device_get_udn (device)); registry = grl_registry_get_default (); source = GRL_SOURCE (grl_dleyna_source_new (server)); GRL_DEBUG ("%s id: %s ", G_STRFUNC, grl_source_get_id (source)); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), &error); if (error != NULL) { GRL_WARNING ("Failed to register source for DLNA device %s: %s", grl_dleyna_media_device_get_udn (device), error->message); g_error_free (error); } }
gboolean grl_tmdb_source_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { GrlConfig *config; char *api_key; GRL_LOG_DOMAIN_INIT (tmdb_log_domain, "tmdb"); GRL_DEBUG ("grl_tmdb_source_plugin_init"); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); if (!configs) { GRL_INFO ("No configuration provided. Will not load plugin"); return FALSE; } config = GRL_CONFIG (configs->data); api_key = grl_config_get_api_key (config); if (!api_key) { GRL_INFO ("Missing API Key, cannot load plugin"); return FALSE; } GRL_TMDB_METADATA_KEY_BACKDROP = register_metadata_key (registry, "tmdb-backdrop", "tmdb-backdrop", "A list of URLs for movie backdrops"); GRL_TMDB_METADATA_KEY_POSTER = register_metadata_key (registry, "tmdb-poster", "tmdb-poster", "A list of URLs for movie posters"); GRL_TMDB_METADATA_KEY_IMDB_ID = register_metadata_key (registry, "tmdb-imdb-id", "tmdb-imdb-id", "ID of this movie at imdb.org"); GRL_TMDB_METADATA_KEY_TMDB_ID = register_metadata_key (registry, "tmdb-id", "tmdb-id", "ID of this movie at tmdb.org"); GrlTmdbSource *source = grl_tmdb_source_new (api_key); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); g_free (api_key); return TRUE; }
gboolean grl_raitv_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { GRL_LOG_DOMAIN_INIT (raitv_log_domain, "raitv"); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); GrlRaitvSource *source = grl_raitv_source_new (); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); return TRUE; }
static gboolean grl_magnatune_plugin_init(GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { GrlMagnatuneSource *source; GRL_LOG_DOMAIN_INIT(magnatune_log_domain, "magnatune"); GRL_DEBUG("magnatune_plugin_init"); source = grl_magnatune_source_new(); grl_registry_register_source(registry, plugin, GRL_SOURCE(source), NULL); return TRUE; }
gboolean grl_metadata_store_source_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { GRL_LOG_DOMAIN_INIT (metadata_store_log_domain, "metadata-store"); GRL_DEBUG ("grl_metadata_store_source_plugin_init"); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); GrlMetadataStoreSource *source = grl_metadata_store_source_new (); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); return TRUE; }
static void grl_dpap_service_added_cb (DMAPMdnsBrowser *browser, DMAPMdnsBrowserService *service, GrlPlugin *plugin) { GrlRegistry *registry = grl_registry_get_default (); GrlDpapSource *source = grl_dpap_source_new (service); GRL_DEBUG (__FUNCTION__); g_object_add_weak_pointer (G_OBJECT (source), (gpointer *) &source); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); if (source != NULL) { g_hash_table_insert (sources, g_strdup (service->name), g_object_ref (source)); g_object_remove_weak_pointer (G_OBJECT (source), (gpointer *) &source); } }
static gboolean grl_bookmarks_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { GParamSpec *spec; GRL_LOG_DOMAIN_INIT (bookmarks_log_domain, "bookmarks"); GRL_DEBUG ("grl_bookmarks_plugin_init"); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); spec = g_param_spec_boxed ("bookmark-date", "Bookmark date", "When the media was bookmarked", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE), GRL_BOOKMARKS_KEY_BOOKMARK_TIME = grl_registry_register_metadata_key (registry, spec, NULL); /* If key was not registered, could be that it is already registered. If so, check if type is the expected one, and reuse it */ if (GRL_BOOKMARKS_KEY_BOOKMARK_TIME == GRL_METADATA_KEY_INVALID) { g_param_spec_unref (spec); GRL_BOOKMARKS_KEY_BOOKMARK_TIME = grl_registry_lookup_metadata_key (registry, "bookmark-date"); if (grl_metadata_key_get_type (GRL_BOOKMARKS_KEY_BOOKMARK_TIME) != G_TYPE_DATE_TIME) { GRL_BOOKMARKS_KEY_BOOKMARK_TIME = GRL_METADATA_KEY_INVALID; } } GrlBookmarksSource *source = grl_bookmarks_source_new (); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); return TRUE; }
gboolean grl_optical_media_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { GRL_LOG_DOMAIN_INIT (optical_media_log_domain, "optical_media"); GRL_DEBUG ("%s", __FUNCTION__); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); GrlOpticalMediaSource *source = grl_optical_media_source_new (); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); return TRUE; }
gboolean grl_local_metadata_source_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { guint config_count; gboolean guess_video = TRUE; GrlConfig *config; GRL_LOG_DOMAIN_INIT (local_metadata_log_domain, "local-metadata"); GRL_DEBUG ("grl_local_metadata_source_plugin_init"); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); if (!configs) { GRL_INFO ("\tConfiguration not provided! Using default configuration."); } else { config_count = g_list_length (configs); if (config_count > 1) { GRL_INFO ("\tProvided %i configs, but will only use one", config_count); } config = GRL_CONFIG (configs->data); guess_video = grl_config_get_boolean (config, "guess-video"); } GrlLocalMetadataSource *source = grl_local_metadata_source_new (guess_video); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); return TRUE; }
gboolean grl_tmdb_source_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { GrlConfig *config; char *api_key; GRL_LOG_DOMAIN_INIT (tmdb_log_domain, "tmdb"); GRL_DEBUG ("grl_tmdb_source_plugin_init"); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); if (!configs) { GRL_INFO ("No configuration provided. Will not load plugin"); return FALSE; } config = GRL_CONFIG (configs->data); api_key = grl_config_get_api_key (config); if (!api_key) { GRL_INFO ("Missing API Key, cannot load plugin"); return FALSE; } GrlTmdbSource *source = grl_tmdb_source_new (api_key); grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); g_free (api_key); return TRUE; }
gboolean grl_vimeo_plugin_init (GrlRegistry *registry, GrlPlugin *plugin, GList *configs) { gchar *vimeo_key; gchar *vimeo_secret; gchar *format; GrlConfig *config; gint config_count; gboolean init_result = FALSE; GrlVimeoSource *source; GRL_LOG_DOMAIN_INIT (vimeo_log_domain, "vimeo"); GRL_DEBUG ("vimeo_plugin_init"); /* Initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); if (!configs) { GRL_INFO ("Configuration not provided! Plugin not loaded"); return FALSE; } config_count = g_list_length (configs); if (config_count > 1) { GRL_INFO ("Provided %d configs, but will only use one", config_count); } config = GRL_CONFIG (configs->data); vimeo_key = grl_config_get_api_key (config); vimeo_secret = grl_config_get_api_secret (config); if (!vimeo_key || !vimeo_secret) { GRL_INFO ("Required API key or secret configuration not provided." " Plugin not loaded"); goto go_out; } source = grl_vimeo_source_new (); source->priv->vimeo = g_vimeo_new (vimeo_key, vimeo_secret); format = grl_config_get_string (config, "format"); if (format) { g_object_set (source->priv->vimeo, "quvi-format", format, NULL); g_free (format); } grl_registry_register_source (registry, plugin, GRL_SOURCE (source), NULL); init_result = TRUE; go_out: g_clear_pointer (&vimeo_key, g_free); g_clear_pointer (&vimeo_secret, g_free); return init_result; }