[grilo] core: Add GRL_METADATA_KEY_TRACK_NUMBER
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: Add GRL_METADATA_KEY_TRACK_NUMBER
- Date: Fri, 2 Sep 2011 16:17:48 +0000 (UTC)
commit 832547ea7cf83fdf7bd4629d43640a36b094b800
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Tue Aug 30 15:16:41 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 | 10 ++++++++++
src/grl-metadata-key.h | 1 +
4 files changed, 41 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 977b77f..aefcf8a 100644
--- a/src/grl-metadata-key.c
+++ b/src/grl-metadata-key.c
@@ -421,6 +421,16 @@ grl_metadata_key_setup_system_keys (GrlPluginRegistry *registry)
GRL_METADATA_KEY_ISO_SPEED,
NULL);
+ grl_plugin_registry_register_metadata_key_full (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),
+ GRL_METADATA_KEY_TRACK_NUMBER,
+ 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 b11cf92..e73fbd3 100644
--- a/src/grl-metadata-key.h
+++ b/src/grl-metadata-key.h
@@ -82,6 +82,7 @@ typedef guint32 GrlKeyID;
#define GRL_METADATA_KEY_FLASH_USED 37
#define GRL_METADATA_KEY_EXPOSURE_TIME 38
#define GRL_METADATA_KEY_ISO_SPEED 39
+#define GRL_METADATA_KEY_TRACK_NUMBER 40
const gchar *grl_metadata_key_get_name (GrlKeyID key);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]