[Xfce4-commits] [apps/parole] 01/01: Fix Parole creating and not cleaning up thumbnails (bug #16026)
noreply at xfce.org
noreply at xfce.org
Sun Nov 10 13:23:05 CET 2019
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/parole.
commit 537ded1850e8802958bdd65697bdf61a33f0fd85
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sun Nov 10 07:22:59 2019 -0500
Fix Parole creating and not cleaning up thumbnails (bug #16026)
---
NEWS | 5 +++++
src/gst/parole-gst.c | 14 ++++++++++----
src/misc/parole-stream.c | 32 ++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 9a65c7c..bffa979 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+1.0.5 (UNRELEASED)
+=====
+- Bug Fixes
+ - Fix Parole creating and not cleaning up thumbnails (Bug #16026)
+
1.0.4
=====
- Bug Fixes
diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index c20baed..f6287d7 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -1112,6 +1112,7 @@ parole_gst_get_meta_data_file(ParoleGst *gst, GstTagList *tag) {
gchar *str;
GDate *date;
guint integer;
+ gboolean has_artwork;
GdkPixbuf *pixbuf;
@@ -1182,10 +1183,15 @@ parole_gst_get_meta_data_file(ParoleGst *gst, GstTagList *tag) {
NULL);
}
- pixbuf = parole_gst_tag_list_get_cover(gst, tag);
- if (pixbuf) {
- parole_stream_set_image(G_OBJECT(gst->priv->stream), pixbuf);
- g_object_unref(pixbuf);
+ g_object_get(G_OBJECT(gst->priv->stream),
+ "has_artwork", &has_artwork,
+ NULL);
+ if (!has_artwork) {
+ pixbuf = parole_gst_tag_list_get_cover(gst, tag);
+ if (pixbuf) {
+ parole_stream_set_image(G_OBJECT(gst->priv->stream), pixbuf);
+ g_object_unref(pixbuf);
+ }
}
g_object_set(G_OBJECT(gst->priv->stream),
diff --git a/src/misc/parole-stream.c b/src/misc/parole-stream.c
index 57c8818..63c8b96 100644
--- a/src/misc/parole-stream.c
+++ b/src/misc/parole-stream.c
@@ -50,6 +50,7 @@ struct _ParoleStreamPrivate {
gchar *subtitles;
gboolean has_audio;
gboolean has_video;
+ gboolean has_artwork;
gboolean live;
gboolean seekable;
gboolean tag_available;
@@ -82,6 +83,7 @@ enum {
PROP_MEDIA_TYPE,
PROP_HAS_AUDIO,
PROP_HAS_VIDEO,
+ PROP_HAS_ARTWORK,
PROP_SEEKABLE,
PROP_DISP_PAR_N,
PROP_DISP_PAR_D,
@@ -173,6 +175,9 @@ static void parole_stream_set_property(GObject *object,
case PROP_HAS_VIDEO:
stream->priv->has_video = g_value_get_boolean(value);
break;
+ case PROP_HAS_ARTWORK:
+ stream->priv->has_artwork = g_value_get_boolean(value);
+ break;
case PROP_SEEKABLE:
stream->priv->seekable = g_value_get_boolean(value);
break;
@@ -259,6 +264,9 @@ static void parole_stream_get_property(GObject *object,
case PROP_HAS_VIDEO:
g_value_set_boolean(value, stream->priv->has_video);
break;
+ case PROP_HAS_ARTWORK:
+ g_value_set_boolean(value, stream->priv->has_artwork);
+ break;
case PROP_SEEKABLE:
g_value_set_boolean(value, stream->priv->seekable);
break;
@@ -348,6 +356,11 @@ parole_stream_set_image(GObject *object, GdkPixbuf *pixbuf) {
if ( stream->priv->image )
g_object_unref(G_OBJECT(stream->priv->image));
+ if (stream->priv->previous_image) {
+ if (g_remove (stream->priv->previous_image) != 0)
+ g_warning("Failed to remove temporary artwork");
+ }
+
if (pixbuf) {
stream->priv->image = gdk_pixbuf_copy(pixbuf);
@@ -358,11 +371,13 @@ parole_stream_set_image(GObject *object, GdkPixbuf *pixbuf) {
stream->priv->previous_image = g_strdup(filename);
stream->priv->image_uri = g_strdup_printf("file://%s", filename);
+ stream->priv->has_artwork = TRUE;
g_free(filename);
} else {
stream->priv->image = NULL;
stream->priv->previous_image = NULL;
stream->priv->image_uri = g_strdup_printf("file://%s/no-cover.png", PIXMAPS_DIR);
+ stream->priv->has_artwork = FALSE;
}
}
@@ -445,6 +460,7 @@ parole_stream_class_init(ParoleStreamClass *klass) {
"Has audio",
FALSE,
G_PARAM_READWRITE));
+
/**
* ParoleStream:has-video:
*
@@ -461,6 +477,21 @@ parole_stream_class_init(ParoleStreamClass *klass) {
G_PARAM_READWRITE));
/**
+ * ParoleStream:has-artwork:
+ *
+ * Whether the stream has artwork.
+ *
+ * Since: 1.0.5
+ **/
+ g_object_class_install_property(object_class,
+ PROP_HAS_ARTWORK,
+ g_param_spec_boolean("has-artwork",
+ "Has artwork",
+ "Has artwork",
+ FALSE,
+ G_PARAM_READWRITE));
+
+ /**
* ParoleStream:live:
*
* Whether the stream is a live stream.
@@ -794,6 +825,7 @@ void parole_stream_init_properties(ParoleStream *stream) {
stream->priv->seekable = FALSE;
stream->priv->has_audio = FALSE;
stream->priv->has_video = FALSE;
+ stream->priv->has_artwork = FALSE;
stream->priv->absolute_duration = 0;
stream->priv->duration = 0;
stream->priv->tag_available = FALSE;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list