[Xfce4-commits] <parole:master> Fix Genre
Sean Davis
noreply at xfce.org
Thu Dec 12 00:18:21 CET 2013
Updating branch refs/heads/master
to 026ed6b8ad4fd15293b00c2c47e83bfe4165b5e2 (commit)
from 28472fbc56401e120bdd9747c2cb1e703920b872 (commit)
commit 026ed6b8ad4fd15293b00c2c47e83bfe4165b5e2
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sun Nov 17 14:50:10 2013 -0500
Fix Genre
src/gst/parole-gst.c | 11 +++++++++++
src/misc/parole-stream.c | 24 ++++++++++++++++++++++++
src/plugins/mpris2/mpris2-provider.c | 6 ++++--
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index 3dc1191..e6528b0 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -1280,6 +1280,7 @@ parole_gst_get_meta_data_cdda (ParoleGst *gst, GstTagList *tag)
"year", NULL,
"album", _("Audio CD"),
"comment", NULL,
+ "genre", NULL,
NULL);
parole_stream_set_image (G_OBJECT (gst->priv->stream), NULL);
@@ -1349,6 +1350,15 @@ parole_gst_get_meta_data_local_file (ParoleGst *gst, GstTagList *tag)
g_free (str);
}
+ if ( gst_tag_list_get_string_index (tag, GST_TAG_GENRE, 0, &str) )
+ {
+ TRACE ("genre:%s", str);
+ g_object_set (G_OBJECT (gst->priv->stream),
+ "genre", str,
+ NULL);
+ g_free (str);
+ }
+
if ( gst_tag_list_get_uint (tag, GST_TAG_TRACK_NUMBER, &integer) )
{
TRACE ("track:%i", integer);
@@ -1380,6 +1390,7 @@ parole_gst_get_meta_data_unknown (ParoleGst *gst)
"year", NULL,
"album", NULL,
"comment", NULL,
+ "genre", NULL,
NULL);
parole_stream_set_image (G_OBJECT (gst->priv->stream), NULL);
diff --git a/src/misc/parole-stream.c b/src/misc/parole-stream.c
index 2c22120..2744f06 100644
--- a/src/misc/parole-stream.c
+++ b/src/misc/parole-stream.c
@@ -71,6 +71,7 @@ struct _ParoleStreamPrivate
gchar *year;
gchar *album;
gchar *comment;
+ gchar *genre;
GdkPixbuf *image;
gchar *image_uri, *previous_image;
@@ -101,6 +102,7 @@ enum
PROP_YEAR,
PROP_ALBUM,
PROP_COMMENT,
+ PROP_GENRE,
PROP_IMAGE_URI
};
@@ -225,6 +227,9 @@ static void parole_stream_set_property (GObject *object,
case PROP_COMMENT:
PAROLE_STREAM_DUP_GVALUE_STRING (PAROLE_STREAM_GET_PRIVATE (stream)->comment, value);
break;
+ case PROP_GENRE:
+ PAROLE_STREAM_DUP_GVALUE_STRING (PAROLE_STREAM_GET_PRIVATE (stream)->genre, value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -307,6 +312,9 @@ static void parole_stream_get_property (GObject *object,
case PROP_COMMENT:
g_value_set_string (value, PAROLE_STREAM_GET_PRIVATE (stream)->comment);
break;
+ case PROP_GENRE:
+ g_value_set_string (value, PAROLE_STREAM_GET_PRIVATE (stream)->genre);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -713,6 +721,21 @@ parole_stream_class_init (ParoleStreamClass *klass)
G_PARAM_READWRITE));
/**
+ * ParoleStream:genre:
+ *
+ * Genre.
+ *
+ * Since: 0.6
+ **/
+ g_object_class_install_property (object_class,
+ PROP_GENRE,
+ g_param_spec_string ("genre",
+ "Genre",
+ "Genre",
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
* ParoleStream:image_uri:
*
* URI for the currently playing album's artwork.
@@ -772,6 +795,7 @@ void parole_stream_init_properties (ParoleStream *stream)
PAROLE_STREAM_FREE_STR_PROP (priv->year);
PAROLE_STREAM_FREE_STR_PROP (priv->album);
PAROLE_STREAM_FREE_STR_PROP (priv->comment);
+ PAROLE_STREAM_FREE_STR_PROP (priv->genre);
PAROLE_STREAM_FREE_STR_PROP (priv->image_uri);
/* Remove the previous image if it exists */
diff --git a/src/plugins/mpris2/mpris2-provider.c b/src/plugins/mpris2/mpris2-provider.c
index 3a37389..58dbee4 100644
--- a/src/plugins/mpris2/mpris2-provider.c
+++ b/src/plugins/mpris2/mpris2-provider.c
@@ -441,7 +441,7 @@ static void handle_strings_request(GVariantBuilder *b, const gchar *tag, const g
static void handle_get_metadata (const ParoleStream *stream, GVariantBuilder *b)
{
- gchar *title, *album, *artist, *year, *comment, *stream_uri, *image_uri;
+ gchar *title, *album, *artist, *year, *comment, *stream_uri, *genre, *image_uri;
gint track_id;
gint64 duration;
@@ -453,6 +453,7 @@ static void handle_get_metadata (const ParoleStream *stream, GVariantBuilder *b)
"comment", &comment,
"duration", &duration,
"uri", &stream_uri,
+ "genre", &genre,
"image_uri", &image_uri,
"track", &track_id,
NULL);
@@ -468,7 +469,8 @@ static void handle_get_metadata (const ParoleStream *stream, GVariantBuilder *b)
handle_strings_request(b, "xesam:artist", artist);
g_variant_builder_add (b, "{sv}", "xesam:album",
g_variant_new_string(album));
- handle_strings_request(b, "xesam:genre", "unknown"); // GST_TAG_GENRE
+ g_variant_builder_add (b, "xesam:genre",
+ g_variant_new_string(genre));
g_variant_builder_add (b, "{sv}", "xesam:contentCreated",
g_variant_new_string(year));
g_variant_builder_add (b, "{sv}", "xesam:trackNumber",
More information about the Xfce4-commits
mailing list