[grilo] grl-metadata-key: Add metadata keys for MB Release ID and MB Release Group ID



commit d6fad8022b74e21c489ff8633535657b9cb474b3
Author: Sumaid Syed <sumaidsyed gmail com>
Date:   Thu Jun 13 21:05:06 2019 +0530

    grl-metadata-key: Add metadata keys for MB Release ID and MB Release Group ID
    
    A MusicBrainz release represents the unique release (i.e. issuing) of a product on
     a specific date with specific release information such as the country, label, barcode
    and packaging.
    A release group is used to group several different releases into a single
    logical entity.
    Add Grilo Media support for MusicBrainz release and release group identifiers.
    Deprecate use of album identifier since it could mean release or release group id.
    
    https://gitlab.gnome.org/GNOME/grilo/issues/136

 bindings/vala/grilo-0.3-custom.vala |  4 +++
 doc/grilo/grilo-sections.txt        |  6 ++++
 src/data/grl-media.c                | 64 +++++++++++++++++++++++++++++++++++++
 src/data/grl-media.h                |  8 +++++
 src/grl-metadata-key.c              | 20 ++++++++++++
 src/grl-metadata-key.h              |  2 ++
 6 files changed, 104 insertions(+)
---
diff --git a/bindings/vala/grilo-0.3-custom.vala b/bindings/vala/grilo-0.3-custom.vala
index 68b9e8e..d5c8223 100644
--- a/bindings/vala/grilo-0.3-custom.vala
+++ b/bindings/vala/grilo-0.3-custom.vala
@@ -109,6 +109,10 @@ namespace Grl {
                public static Grl.KeyID MB_ARTIST_ID;
                [CCode (cname ="GRL_METADATA_KEY_MB_RECORDING_ID")]
                public static Grl.KeyID MB_RECORDING_ID;
+               [CCode (cname ="GRL_METADATA_KEY_MB_RELEASE_ID")]
+               public static Grl.KeyID MB_RELEASE_ID;
+               [CCode (cname ="GRL_METADATA_KEY_MB_RELEASE_GROUP_ID")]
+               public static Grl.KeyID MB_RELEASE_GROUP_ID;
                [CCode (cname ="GRL_METADATA_KEY_AUDIO_TRACK")]
                public static Grl.KeyID AUDIO_TRACK;
                [CCode (cname ="GRL_METADATA_KEY_ALBUM_DISC_NUMBER")]
diff --git a/doc/grilo/grilo-sections.txt b/doc/grilo/grilo-sections.txt
index 8958676..6d8230b 100644
--- a/doc/grilo/grilo-sections.txt
+++ b/doc/grilo/grilo-sections.txt
@@ -410,6 +410,8 @@ grl_media_get_mb_album_id
 grl_media_get_mb_artist_id
 grl_media_get_mb_artist_id_nth
 grl_media_get_mb_recording_id
+grl_media_get_mb_release_group_id
+grl_media_get_mb_release_id
 grl_media_get_mb_track_id
 grl_media_get_media_type
 grl_media_get_mime
@@ -481,6 +483,8 @@ grl_media_set_lyrics
 grl_media_set_mb_album_id
 grl_media_set_mb_artist_id
 grl_media_set_mb_recording_id
+grl_media_set_mb_release_group_id
+grl_media_set_mb_release_id
 grl_media_set_mb_track_id
 grl_media_set_mime
 grl_media_set_modification_date
@@ -617,6 +621,8 @@ GRL_METADATA_KEY_LYRICS
 GRL_METADATA_KEY_MB_ALBUM_ID
 GRL_METADATA_KEY_MB_ARTIST_ID
 GRL_METADATA_KEY_MB_RECORDING_ID
+GRL_METADATA_KEY_MB_RELEASE_GROUP_ID
+GRL_METADATA_KEY_MB_RELEASE_ID
 GRL_METADATA_KEY_MB_TRACK_ID
 GRL_METADATA_KEY_MIME
 GRL_METADATA_KEY_MODIFICATION_DATE
diff --git a/src/data/grl-media.c b/src/data/grl-media.c
index 67358e4..5b1cb6a 100644
--- a/src/data/grl-media.c
+++ b/src/data/grl-media.c
@@ -1685,6 +1685,40 @@ grl_media_set_mb_album_id (GrlMedia *media, const gchar *mb_album_id)
                        mb_album_id);
 }
 
+/**
+ * grl_media_set_mb_release_id:
+ * @media: the media instance
+ * @mb_release_id: Album release identifier in MusicBrainz
+ *
+ * Set the MusicBrainz release identifier of the media
+ *
+ * Since: 0.3.8
+ */
+void
+grl_media_set_mb_release_id (GrlMedia *media, const gchar *mb_release_id)
+{
+  g_return_if_fail (GRL_IS_MEDIA (media));
+  grl_data_set_string (GRL_DATA (media), GRL_METADATA_KEY_MB_RELEASE_ID,
+                       mb_release_id);
+}
+
+/**
+ * grl_media_set_mb_release_group_id:
+ * @media: the media instance
+ * @mb_release_group_id:  Album group release identifier in MusicBrainz
+ *
+ * Set the MusicBrainz Release Group identifier of the media
+ *
+ * Since: 0.3.8
+ */
+void
+grl_media_set_mb_release_group_id (GrlMedia *media, const gchar *mb_release_group_id)
+{
+  g_return_if_fail (GRL_IS_MEDIA (media));
+  grl_data_set_string (GRL_DATA (media), GRL_METADATA_KEY_MB_RELEASE_GROUP_ID,
+                       mb_release_group_id);
+}
+
 /**
  * grl_media_set_lyrics:
  * @media: the media instance
@@ -3064,6 +3098,36 @@ grl_media_get_mb_track_id (GrlMedia *media)
   return grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_MB_TRACK_ID);
 }
 
+/**
+ * grl_media_get_mb_release_id:
+ * @media: the media instance
+ *
+ * Returns: the MusicBrainz release identifier of the media
+ *
+ * Since: 0.3.8
+ */
+const gchar *
+grl_media_get_mb_release_id (GrlMedia *media)
+{
+  g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+  return grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_MB_RELEASE_ID);
+}
+
+/**
+ * grl_media_get_mb_release_group_id:
+ * @media: the media instance
+ *
+ * Returns: the MusicBrainz release group identifier of the media
+ *
+ * Since: 0.3.8
+ */
+const gchar *
+grl_media_get_mb_release_group_id (GrlMedia *media)
+{
+  g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+  return grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_MB_RELEASE_GROUP_ID);
+}
+
 /**
  * grl_media_get_lyrics:
  * @media: the media instance
diff --git a/src/data/grl-media.h b/src/data/grl-media.h
index 8392e41..53a06a7 100644
--- a/src/data/grl-media.h
+++ b/src/data/grl-media.h
@@ -187,6 +187,10 @@ void grl_media_set_mb_artist_id (GrlMedia *media, const gchar *mb_artist_id);
 
 void grl_media_set_mb_album_id (GrlMedia *media, const gchar *mb_album_id);
 
+void grl_media_set_mb_release_id (GrlMedia *media, const gchar *mb_release_id);
+
+void grl_media_set_mb_release_group_id (GrlMedia *media, const gchar *mb_release_group_id);
+
 void grl_media_set_lyrics (GrlMedia *media, const gchar *lyrics);
 
 void grl_media_set_genre (GrlMedia *media, const gchar *genre);
@@ -358,6 +362,10 @@ const gchar *grl_media_get_mb_recording_id (GrlMedia *media);
 
 const gchar *grl_media_get_mb_track_id (GrlMedia *media);
 
+const gchar *grl_media_get_mb_release_id (GrlMedia *media);
+
+const gchar *grl_media_get_mb_release_group_id (GrlMedia *media);
+
 const gchar *grl_media_get_lyrics (GrlMedia *media);
 
 const gchar *grl_media_get_lyrics_nth (GrlMedia *media, guint index);
diff --git a/src/grl-metadata-key.c b/src/grl-metadata-key.c
index 99ba123..ce60105 100644
--- a/src/grl-metadata-key.c
+++ b/src/grl-metadata-key.c
@@ -648,6 +648,26 @@ grl_metadata_key_setup_system_keys (GrlRegistry *registry)
                                              GRL_METADATA_KEY_INVALID,
                                              NULL);
 
+  grl_registry_register_metadata_key_system (registry,
+                                             g_param_spec_string ("mb-release-id",
+                                                                  "MusicBrainz Release Id",
+                                                                  "Album release identifier in MusicBrainz",
+                                                                  NULL,
+                                                                  G_PARAM_STATIC_STRINGS | 
G_PARAM_READWRITE),
+                                             GRL_METADATA_KEY_MB_RELEASE_ID,
+                                             GRL_METADATA_KEY_INVALID,
+                                             NULL);
+
+  grl_registry_register_metadata_key_system (registry,
+                                             g_param_spec_string ("mb-release-group-id",
+                                                                  "MusicBrainz Release Group Id",
+                                                                  "Album release group identifier in 
MusicBrainz",
+                                                                  NULL,
+                                                                  G_PARAM_STATIC_STRINGS | 
G_PARAM_READWRITE),
+                                             GRL_METADATA_KEY_MB_RELEASE_GROUP_ID,
+                                             GRL_METADATA_KEY_INVALID,
+                                             NULL);
+
   grl_registry_register_metadata_key_system (registry,
                                              g_param_spec_int ("audio-track",
                                                                "Audio track",
diff --git a/src/grl-metadata-key.h b/src/grl-metadata-key.h
index c5b8935..81429aa 100644
--- a/src/grl-metadata-key.h
+++ b/src/grl-metadata-key.h
@@ -125,6 +125,8 @@ typedef enum {
 #define GRL_METADATA_KEY_ALBUM_DISC_NUMBER    58
 #define GRL_METADATA_KEY_COMPOSER             59
 #define GRL_METADATA_KEY_ALBUM_ARTIST         60
+#define GRL_METADATA_KEY_MB_RELEASE_ID        61
+#define GRL_METADATA_KEY_MB_RELEASE_GROUP_ID  62
 
 /* END CORE KEYS */
 


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