[totem/wip/hadess/filter-content-changes: 2/4] grilo: Make sure to only add videos to the library view




commit 5d2a54b085645440aadca370182147f2c0fb15eb
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Aug 21 19:36:12 2020 +0200

    grilo: Make sure to only add videos to the library view
    
    Don't handle changes related to non-video files in monitored grilo
    sources.

 src/totem-grilo.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index a3ab074ad..805d849e2 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -1169,11 +1169,16 @@ content_changed (TotemGrilo   *self,
        for (i = 0; i < changed_medias->len; i++) {
                GrlMedia *media = changed_medias->pdata[i];
                GtkTreeIter *iter;
-               char *str;
+               g_autofree char *str;
 
                str = grl_media_serialize (media);
+               if (!grl_media_is_video (media) &&
+                   !grl_media_is_container (media)) {
+                       g_debug ("Ignoring content changes for %s", str);
+                       continue;
+               }
+
                g_debug ("About to change %s in the store", str);
-               g_free (str);
 
                if (find_media (model, media, &iter)) {
                        update_media (GTK_TREE_STORE (model), iter, source, media);
@@ -1198,11 +1203,10 @@ content_removed (TotemGrilo   *self,
        for (i = 0; i < changed_medias->len; i++) {
                GrlMedia *media = changed_medias->pdata[i];
                GtkTreeIter *iter;
-               char *str;
+               g_autofree char *str;
 
                str = grl_media_serialize (media);
                g_debug ("About to remove %s from the store", str);
-               g_free (str);
 
                if (find_media (model, media, &iter)) {
                        gtk_tree_store_remove (GTK_TREE_STORE (model), iter);
@@ -1229,11 +1233,15 @@ content_added (TotemGrilo   *self,
 
        for (i = 0; i < changed_medias->len; i++) {
                GrlMedia *media = changed_medias->pdata[i];
-               char *str;
+               g_autofree char *str;
 
                str = grl_media_serialize (media);
+               if (!grl_media_is_video (media) &&
+                   !grl_media_is_container (media)) {
+                       g_debug ("Ignoring content added for %s", str);
+                       continue;
+               }
                g_debug ("About to add %s to the store", str);
-               g_free (str);
 
                add_local_metadata (self, source, media);
                add_media_to_model (GTK_TREE_STORE (model), NULL, source, media);


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