[grilo-plugins] upnp: use GrlData funcs to set metadata properties rather than subtypes
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] upnp: use GrlData funcs to set metadata properties rather than subtypes
- Date: Tue, 22 Feb 2011 08:08:16 +0000 (UTC)
commit 49e0e0c21d740b6fde800c98332f2291fb72ed3b
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date: Mon Feb 21 17:48:56 2011 +0000
upnp: use GrlData funcs to set metadata properties rather than subtypes
Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
src/upnp/grl-upnp.c | 30 ++++++++----------------------
1 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/src/upnp/grl-upnp.c b/src/upnp/grl-upnp.c
index 4860b14..f024b53 100644
--- a/src/upnp/grl-upnp.c
+++ b/src/upnp/grl-upnp.c
@@ -814,33 +814,19 @@ get_value_for_key (GrlKeyID key_id,
}
static void
-set_metadata_value (GrlMedia *media,
+set_metadata_value (GrlData *data,
GrlKeyID key_id,
const gchar *value)
{
- if (key_id == GRL_METADATA_KEY_TITLE) {
- grl_media_set_title (media, value);
- } else if (key_id == GRL_METADATA_KEY_ARTIST) {
- grl_media_audio_set_artist (GRL_MEDIA_AUDIO(media), value);
- } else if (key_id == GRL_METADATA_KEY_ALBUM) {
- grl_media_audio_set_album (GRL_MEDIA_AUDIO(media), value);
- } else if (key_id == GRL_METADATA_KEY_GENRE) {
- grl_media_audio_set_genre (GRL_MEDIA_AUDIO(media), value);
- } else if (key_id == GRL_METADATA_KEY_URL) {
- grl_media_set_url (media, value);
- } else if (key_id == GRL_METADATA_KEY_MIME) {
- grl_media_set_mime (media, value);
- } else if (key_id == GRL_METADATA_KEY_DATE) {
- grl_media_set_date (media, value);
- } else if (key_id == GRL_METADATA_KEY_DURATION) {
+ if (key_id == GRL_METADATA_KEY_DURATION) {
gint duration = didl_h_mm_ss_to_int (value);
if (duration >= 0) {
- grl_media_set_duration (media, duration);
+ grl_data_set_int (data, GRL_METADATA_KEY_DURATION, duration);
}
- } else if (key_id == GRL_METADATA_KEY_CHILDCOUNT && value && GRL_IS_MEDIA_BOX (media)) {
- grl_media_box_set_childcount (GRL_MEDIA_BOX (media), atoi (value));
- } else if (key_id == GRL_METADATA_KEY_THUMBNAIL) {
- grl_media_set_thumbnail (media, value);
+ } else if (key_id == GRL_METADATA_KEY_CHILDCOUNT && value) {
+ grl_data_set_int (data, GRL_METADATA_KEY_CHILDCOUNT, atoi (value));
+ } else {
+ grl_data_set_string (data, key_id, value);
}
}
@@ -898,7 +884,7 @@ build_media_from_didl (GrlMedia *content,
while (iter) {
gchar *value = get_value_for_key (iter->data, didl_node, didl_props);
if (value) {
- set_metadata_value (media, iter->data, value);
+ set_metadata_value (GRL_DATA (media), iter->data, value);
}
iter = g_list_next (iter);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]