[grilo/0.1.x] core: Add GRL_METADATA_KEY_TRACK_NUMBER



commit 2eac268c82f9a0ebabd43857c95a96b2335ce3c6
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Fri Sep 2 22:55:57 2011 +0000

    core: Add GRL_METADATA_KEY_TRACK_NUMBER
    
    Add a key for Track Number.
    
    Add also required API in GrlMediaAudio to handle this key.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=657549
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 src/data/grl-media-audio.c |   26 ++++++++++++++++++++++++++
 src/data/grl-media-audio.h |    4 ++++
 src/grl-metadata-key.c     |   12 ++++++++++++
 src/grl-metadata-key.h     |    1 +
 4 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/src/data/grl-media-audio.c b/src/data/grl-media-audio.c
index 222bb14..e9eabf5 100644
--- a/src/data/grl-media-audio.c
+++ b/src/data/grl-media-audio.c
@@ -163,6 +163,20 @@ grl_media_audio_set_bitrate (GrlMediaAudio *audio, gint bitrate)
 }
 
 /**
+ * grl_media_audio_set_track_number:
+ * @audio: the media instance
+ * @track_number: the audio's track number
+ *
+ * Set the track number of the audio
+ */
+void
+grl_media_audio_set_track_number (GrlMediaAudio *audio, gint track_number)
+{
+  grl_data_set_int (GRL_DATA (audio), GRL_METADATA_KEY_TRACK_NUMBER,
+                    track_number);
+}
+
+/**
  * grl_media_audio_set_url_data:
  * @audio: the media instance
  * @url: the audio's url
@@ -401,6 +415,18 @@ grl_media_audio_get_bitrate (GrlMediaAudio *audio)
 }
 
 /**
+ * grl_media_audio_get_track_number:
+ * @audio: the media instance
+ *
+ * Returns: the track number of the audio
+ */
+gint
+grl_media_audio_get_track_number (GrlMediaAudio *audio)
+{
+  return grl_data_get_int (GRL_DATA (audio), GRL_METADATA_KEY_TRACK_NUMBER);
+}
+
+/**
  * grl_media_audio_get_url_data:
  * @audio: the media instance
  * @mime: (out) (transfer none): the url mime-type, or %NULL to ignore
diff --git a/src/data/grl-media-audio.h b/src/data/grl-media-audio.h
index 8f76b7f..b56e328 100644
--- a/src/data/grl-media-audio.h
+++ b/src/data/grl-media-audio.h
@@ -95,6 +95,8 @@ void grl_media_audio_set_lyrics (GrlMediaAudio *audio, const gchar *lyrics);
 
 void grl_media_audio_set_bitrate (GrlMediaAudio *audio, gint bitrate);
 
+void grl_media_audio_set_track_number (GrlMediaAudio *audio, gint track_number);
+
 void grl_media_audio_set_url_data (GrlMediaAudio *audio, const gchar *url, const gchar *mime, gint bitrate);
 
 void grl_media_audio_add_artist (GrlMediaAudio *audio, const gchar *artist);
@@ -121,6 +123,8 @@ const gchar *grl_media_audio_get_lyrics_nth (GrlMediaAudio *audio, guint index);
 
 gint grl_media_audio_get_bitrate (GrlMediaAudio *audio);
 
+gint grl_media_audio_get_track_number (GrlMediaAudio *audio);
+
 const gchar *grl_media_audio_get_url_data (GrlMediaAudio *audio, gchar **mime, gint *bitrate);
 
 const gchar *grl_media_audio_get_url_data_nth (GrlMediaAudio *audio, guint index, gchar **mime, gint *bitrate);
diff --git a/src/grl-metadata-key.c b/src/grl-metadata-key.c
index 0536aa1..64f8128 100644
--- a/src/grl-metadata-key.c
+++ b/src/grl-metadata-key.c
@@ -83,6 +83,8 @@ GrlKeyID GRL_METADATA_KEY_FLASH_USED = NULL;
 GrlKeyID GRL_METADATA_KEY_EXPOSURE_TIME = NULL;
 GrlKeyID GRL_METADATA_KEY_ISO_SPEED = NULL;
 
+GrlKeyID GRL_METADATA_KEY_TRACK_NUMBER = NULL;
+
 void
 grl_metadata_key_setup_system_keys (GrlPluginRegistry *registry)
 {
@@ -431,6 +433,16 @@ GRL_METADATA_KEY_STUDIO =
                                                                    G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
                                                NULL);
 
+  GRL_METADATA_KEY_TRACK_NUMBER =
+    grl_plugin_registry_register_metadata_key (registry,
+                                               g_param_spec_int ("track-number",
+                                                                 "Track number",
+                                                                 "Track number inside the album",
+                                                                 1, G_MAXINT,
+                                                                 1,
+                                                                 G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
+                                               NULL);
+
   /* Create the relations */
   grl_plugin_registry_register_metadata_key_relation (registry,
                                                       GRL_METADATA_KEY_URL,
diff --git a/src/grl-metadata-key.h b/src/grl-metadata-key.h
index 35474a7..2559317 100644
--- a/src/grl-metadata-key.h
+++ b/src/grl-metadata-key.h
@@ -82,6 +82,7 @@ extern GrlKeyID GRL_METADATA_KEY_ORIENTATION;
 extern GrlKeyID GRL_METADATA_KEY_FLASH_USED;
 extern GrlKeyID GRL_METADATA_KEY_EXPOSURE_TIME;
 extern GrlKeyID GRL_METADATA_KEY_ISO_SPEED;
+extern GrlKeyID GRL_METADATA_KEY_TRACK_NUMBER;
 
 const gchar *grl_metadata_key_get_name (GrlKeyID key);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]