[grilo] core: add GRL_METADATA_KEY_MB_TRACK_ID



commit 9cee9ffd2de288ef3081c01a10344f309174953e
Author: Victor Toso <me victortoso com>
Date:   Mon Jul 7 01:13:41 2014 -0300

    core: add GRL_METADATA_KEY_MB_TRACK_ID
    
    MusicBrainz track identifier.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732878

 bindings/vala/grilo-0.2-custom.vala |    2 ++
 doc/grilo/grilo-sections.txt        |    3 +++
 src/data/grl-media-audio.c          |   28 ++++++++++++++++++++++++++++
 src/data/grl-media-audio.h          |    4 ++++
 src/grl-metadata-key.c              |    9 +++++++++
 src/grl-metadata-key.h              |    1 +
 6 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/bindings/vala/grilo-0.2-custom.vala b/bindings/vala/grilo-0.2-custom.vala
index 0aa5483..bf8ef82 100644
--- a/bindings/vala/grilo-0.2-custom.vala
+++ b/bindings/vala/grilo-0.2-custom.vala
@@ -114,6 +114,8 @@ namespace Grl {
                public static Grl.KeyID ORIGINAL_TITLE;
                [CCode (cname ="GRL_METADATA_KEY_MB_ALBUM_ID")]
                public static Grl.KeyID MB_ALBUM_ID;
+               [CCode (cname ="GRL_METADATA_KEY_MB_TRACK_ID")]
+               public static Grl.KeyID MB_TRACK_ID;
 
                public static unowned GLib.List list_new (Grl.KeyID p, ...);
        }
diff --git a/doc/grilo/grilo-sections.txt b/doc/grilo/grilo-sections.txt
index d8a5380..1586961 100644
--- a/doc/grilo/grilo-sections.txt
+++ b/doc/grilo/grilo-sections.txt
@@ -559,6 +559,7 @@ grl_media_audio_get_genre_nth
 grl_media_audio_get_lyrics
 grl_media_audio_get_lyrics_nth
 grl_media_audio_get_mb_album_id
+grl_media_audio_get_mb_track_id
 grl_media_audio_get_track_number
 grl_media_audio_get_url_data
 grl_media_audio_get_url_data_nth
@@ -568,6 +569,7 @@ grl_media_audio_set_bitrate
 grl_media_audio_set_genre
 grl_media_audio_set_lyrics
 grl_media_audio_set_mb_album_id
+grl_media_audio_set_mb_track_id
 grl_media_audio_set_track_number
 grl_media_audio_set_url_data
 <SUBSECTION Standard>
@@ -654,6 +656,7 @@ GRL_METADATA_KEY_LAST_POSITION
 GRL_METADATA_KEY_LICENSE
 GRL_METADATA_KEY_LYRICS
 GRL_METADATA_KEY_MB_ALBUM_ID
+GRL_METADATA_KEY_MB_TRACK_ID
 GRL_METADATA_KEY_MIME
 GRL_METADATA_KEY_MODIFICATION_DATE
 GRL_METADATA_KEY_ORIENTATION
diff --git a/src/data/grl-media-audio.c b/src/data/grl-media-audio.c
index 2b0f516..40a967a 100644
--- a/src/data/grl-media-audio.c
+++ b/src/data/grl-media-audio.c
@@ -160,6 +160,21 @@ grl_media_audio_set_mb_album_id (GrlMediaAudio *audio, const gchar *mb_album_id)
 }
 
 /**
+ * grl_media_audio_set_mb_track_id:
+ * @audio: the media instance
+ * @mb_track_id: the MusicBrainz track identifier
+ *
+ * Set the MusicBrainz track identifier of the audio
+ */
+void
+grl_media_audio_set_mb_track_id (GrlMediaAudio *audio, const gchar *mb_track_id)
+{
+  g_return_if_fail (GRL_IS_MEDIA_AUDIO (audio));
+  grl_data_set_string (GRL_DATA (audio), GRL_METADATA_KEY_MB_TRACK_ID,
+                       mb_track_id);
+}
+
+/**
  * grl_media_audio_set_bitrate:
  * @audio: the media instance
  * @bitrate: the audio's bitrate
@@ -453,6 +468,19 @@ grl_media_audio_get_mb_album_id (GrlMediaAudio *audio)
 }
 
 /**
+ * grl_media_audio_get_mb_track_id:
+ * @audio: the media instance
+ *
+ * Returns: the MusicBrainz track identifier
+ */
+const gchar *
+grl_media_audio_get_mb_track_id (GrlMediaAudio *audio)
+{
+  g_return_val_if_fail (GRL_IS_MEDIA_AUDIO (audio), NULL);
+  return grl_data_get_string (GRL_DATA (audio), GRL_METADATA_KEY_MB_TRACK_ID);
+}
+
+/**
  * grl_media_audio_get_bitrate:
  * @audio: the media instance
  *
diff --git a/src/data/grl-media-audio.h b/src/data/grl-media-audio.h
index da215a7..442ce76 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_mb_album_id (GrlMediaAudio *audio, const gchar *mb_album_id);
 
+void grl_media_audio_set_mb_track_id (GrlMediaAudio *audio, const gchar *mb_track_id);
+
 void grl_media_audio_set_bitrate (GrlMediaAudio *audio, gint bitrate);
 
 void grl_media_audio_set_track_number (GrlMediaAudio *audio, gint track_number);
@@ -125,6 +127,8 @@ const gchar *grl_media_audio_get_lyrics_nth (GrlMediaAudio *audio, guint index);
 
 const gchar *grl_media_audio_get_mb_album_id (GrlMediaAudio *audio);
 
+const gchar *grl_media_audio_get_mb_track_id (GrlMediaAudio *audio);
+
 gint grl_media_audio_get_bitrate (GrlMediaAudio *audio);
 
 gint grl_media_audio_get_track_number (GrlMediaAudio *audio);
diff --git a/src/grl-metadata-key.c b/src/grl-metadata-key.c
index 7c07369..6d36892 100644
--- a/src/grl-metadata-key.c
+++ b/src/grl-metadata-key.c
@@ -539,6 +539,15 @@ grl_metadata_key_setup_system_keys (GrlRegistry *registry)
                                              GRL_METADATA_KEY_MB_ALBUM_ID,
                                              NULL);
 
+  grl_registry_register_metadata_key_system (registry,
+                                             g_param_spec_string ("mb-track-id",
+                                                                  "MusicBrainz Track Id",
+                                                                  "Track identifier in MusicBrainz",
+                                                                  NULL,
+                                                                  G_PARAM_STATIC_STRINGS | 
G_PARAM_READWRITE),
+                                             GRL_METADATA_KEY_MB_TRACK_ID,
+                                             NULL);
+
   /* Create the relations */
   grl_registry_register_metadata_key_relation (registry,
                                                GRL_METADATA_KEY_TITLE,
diff --git a/src/grl-metadata-key.h b/src/grl-metadata-key.h
index b11ae1e..464099e 100644
--- a/src/grl-metadata-key.h
+++ b/src/grl-metadata-key.h
@@ -99,6 +99,7 @@ typedef guint32 GrlKeyID;
 #define GRL_METADATA_KEY_SIZE                 50
 #define GRL_METADATA_KEY_TITLE_FROM_FILENAME  51
 #define GRL_METADATA_KEY_MB_ALBUM_ID          52
+#define GRL_METADATA_KEY_MB_TRACK_ID          53
 
 G_BEGIN_DECLS
 


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