[rhythmbox] grilo: use disc numbers if available



commit 611d26cb3d74f03e7c455f22f15112b65d8cfd2e
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sun Jan 30 22:17:27 2022 +1000

    grilo: use disc numbers if available
    
    The disc number metadata key was added in grilo 0.3.1, so we also have
    to bump the version requirement.

 meson.build                     |  2 +-
 plugins/grilo/rb-grilo-source.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 7a5df4182..882cd32f1 100644
--- a/meson.build
+++ b/meson.build
@@ -223,7 +223,7 @@ endif
 
 enable_grilo = false
 if get_option('grilo').allowed()
-  grilo = dependency('grilo-0.3', version: '>= 0.3.0', required: get_option('grilo'))
+  grilo = dependency('grilo-0.3', version: '>= 0.3.1', required: get_option('grilo'))
 
   if grilo.found()
     enable_grilo = true
diff --git a/plugins/grilo/rb-grilo-source.c b/plugins/grilo/rb-grilo-source.c
index d338c14f3..c381059c4 100644
--- a/plugins/grilo/rb-grilo-source.c
+++ b/plugins/grilo/rb-grilo-source.c
@@ -298,6 +298,10 @@ rb_grilo_source_constructed (GObject *object)
                source->priv->grilo_keys = g_list_prepend (source->priv->grilo_keys,
                                                           GUINT_TO_POINTER(GRL_METADATA_KEY_TRACK_NUMBER));
        }
+       if (g_list_find ((GList *)source_keys, GUINT_TO_POINTER(GRL_METADATA_KEY_ALBUM_DISC_NUMBER))) {
+               source->priv->grilo_keys = g_list_prepend (source->priv->grilo_keys,
+                                                          
GUINT_TO_POINTER(GRL_METADATA_KEY_ALBUM_DISC_NUMBER));
+       }
 
        if (g_list_find ((GList *)source_keys, GUINT_TO_POINTER(GRL_METADATA_KEY_TITLE))) {
                rb_entry_view_append_column (source->priv->entry_view, RB_ENTRY_VIEW_COL_TITLE, TRUE);
@@ -645,6 +649,14 @@ create_entry_for_media (RhythmDB *db, RhythmDBEntryType *entry_type, GrlData *da
                g_value_unset (&v);
        }
 
+       if (grl_data_has_key (data, GRL_METADATA_KEY_ALBUM_DISC_NUMBER)) {
+               GValue v = {0,};
+               g_value_init (&v, G_TYPE_ULONG);
+               g_value_set_ulong (&v, grl_data_get_int (data, GRL_METADATA_KEY_ALBUM_DISC_NUMBER));
+               rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_DISC_NUMBER, &v);
+               g_value_unset (&v);
+       }
+
        /* rating and play count? */
 
        entry_data = RHYTHMDB_ENTRY_GET_TYPE_DATA (entry, RBGriloEntryData);


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