[libgdata] Bug 579885 — Add code examples to documentation
- From: Philip Withnall <pwithnall src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgdata] Bug 579885 — Add code examples to documentation
- Date: Mon, 26 Oct 2009 21:14:45 +0000 (UTC)
commit 791711972c658d1aca0cddda8077bf7471adb6cd
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Oct 26 21:14:02 2009 +0000
Bug 579885 â?? Add code examples to documentation
Added a code example for GDataYouTubeVideo. Helps: bgo#579885
gdata/services/youtube/gdata-youtube-video.c | 35 +++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/gdata/services/youtube/gdata-youtube-video.c b/gdata/services/youtube/gdata-youtube-video.c
index 98d1855..bcb58c8 100644
--- a/gdata/services/youtube/gdata-youtube-video.c
+++ b/gdata/services/youtube/gdata-youtube-video.c
@@ -27,6 +27,39 @@
*
* For more details of YouTube's GData API, see the <ulink type="http" url="http://code.google.com/apis/youtube/2.0/reference.html">
* online documentation</ulink>.
+ *
+ * <example>
+ * <title>Getting Basic Video Data</title>
+ * <programlisting>
+ * GDataYouTubeVideo *video;
+ * const gchar *video_id, *title, *player_uri, *description, *video_uri = NULL;
+ * GTimeVal updated, published;
+ * GDataMediaContent *content;
+ * GList *thumbnails;
+ *
+ * video = gdata_youtube_service_query_single_video (service, NULL, "R-9gzmQHoe0", NULL, NULL);
+ *
+ * video_id = gdata_youtube_video_get_video_id (video); /<!-- -->* e.g. "R-9gzmQHoe0" *<!-- -->/
+ * title = gdata_youtube_video_get_title (video); /<!-- -->* e.g. "Korpiklaani Vodka (official video 2009)" *<!-- -->/
+ * player_uri = gdata_youtube_video_get_player_uri (video); /<!-- -->* e.g. "http://www.youtube.com/watch?v=ZTUVgYoeN_b" *<!-- -->/
+ * description = gdata_youtube_video_get_description (video); /<!-- -->* e.g. "Vodka is the first single from the album..." *<!-- -->/
+ * gdata_entry_get_published (GDATA_ENTRY (video), &published); /<!-- -->* Date and time the video was originally published *<!-- -->/
+ * gdata_entry_get_updated (GDATA_ENTRY (video), &updated); /<!-- -->* When the video was most recently updated by the author *<!-- -->/
+ *
+ * /<!-- -->* Retrieve a specific encoding of the video in #GDataMediaContent format *<!-- -->/
+ * content = gdata_youtube_video_look_up_content (video, "video/3gpp");
+ * if (content != NULL)
+ * video_uri = gdata_media_content_get_uri (content); /<!-- -->* the URI for the direct 3GP version of the video *<!-- -->/
+ * else
+ * /<!-- -->* Fall back and try a different video encoding? SWF ("application/x-shockwave-flash") is always present. *<!-- -->/
+ *
+ * /<!-- -->* Get a list of #GDataMediaThumbnail<!-- -->s for the video *<!-- -->/
+ * for (thumbnails = gdata_youtube_video_get_thumbnails (video); thumbnails != NULL; thumbnails = thumbnails->next)
+ * download_and_do_something_with_thumbnail (gdata_media_thumbnail_get_uri (thumbnail));
+ *
+ * g_object_unref (video);
+ * </programlisting>
+ * </example>
**/
#include <config.h>
@@ -1342,7 +1375,7 @@ gdata_youtube_video_set_recorded (GDataYouTubeVideo *self, GTimeVal *recorded)
* For example:
* <informalexample><programlisting>
* video_id = gdata_youtube_video_get_video_id_from_uri ("http://www.youtube.com/watch?v=BH_vwsyCrTc&feature=featured");
- * g_message ("Video ID: %s", video_id); /\* Should print: BH_vwsyCrTc *\/
+ * g_message ("Video ID: %s", video_id); /<!-- -->* Should print: BH_vwsyCrTc *<!-- -->/
* g_free (video_id);
* </programlisting></informalexample>
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]