static gboolean grl_dpap_match (GrlMedia *media, gpointer val, gpointer user_data) { g_assert (grl_media_is_image (media)); if (user_data == NULL) return TRUE; const char *title = grl_media_get_title (media); return strstr (title, user_data) != NULL; }
static void mex_grilo_feed_constructed (GObject *object) { const gchar *title; MexGriloFeed *self = (MexGriloFeed *) object; MexGriloFeedPrivate *priv = self->priv; MexGriloFeedClass *klass = MEX_GRILO_FEED_GET_CLASS (object); if (G_OBJECT_CLASS (mex_grilo_feed_parent_class)->constructed) G_OBJECT_CLASS (mex_grilo_feed_parent_class)->constructed (object); if (priv->source == NULL) { g_warning ("No source supplied"); return; } /* Fill keys in case it's not already done at creation. */ if (priv->query_keys == NULL) { priv->query_keys = mex_grilo_program_get_default_keys (); } if (priv->metadata_keys == NULL) { priv->metadata_keys = g_list_copy (priv->query_keys); } title = NULL; if (priv->root) title = grl_media_get_title (priv->root); if (!title && GRL_IS_SOURCE (priv->source)) title = grl_source_get_name (GRL_SOURCE (priv->source)); if (title) g_object_set (object, "title", title, NULL); if (priv->source != NULL) { g_signal_handlers_disconnect_by_func (priv->source, G_CALLBACK (klass->content_updated), self); g_signal_connect (priv->source, "content-changed", G_CALLBACK (klass->content_updated), self); } }
static void resolve_cb (GrlSource *src, guint operation_id, GrlMedia *media, gpointer user_data, const GError *error) { g_assert_no_error (error); g_assert (media); const gchar *title = grl_media_get_title (media); const gchar *studio = grl_media_get_studio (media); printf ("Media: Title='%s', Studio='%s'\n", title, studio); if (director_key != 0) { const gchar *director = grl_data_get_string (GRL_DATA (media), director_key); printf (" Director=%s\n", director); } g_main_loop_quit (loop); }
static void element_browser (gpointer data, gpointer user_data) { GrlMedia *media = GRL_MEDIA (data); GrlSource *source = GRL_SOURCE (user_data); /* Check if we got a valid media object as some plugins may call the callback with a NULL media under certain circumstances (for example when they cannot estimate the number of remaining results and they find suddenly they don't have any more results to send) */ if (!media) { g_debug ("Media element is NULL!"); goto out; } const gchar *title = grl_media_get_title (media); /* If the media is a container, that means we will browse it again */ if (grl_media_is_container (media)) { guint childcount = grl_media_get_childcount (media); g_debug ("\t Got '%s' (container with %d elements)", title, childcount); source_browser (source, media); } else { const gchar *url = grl_media_get_url (media); const gchar *mime = grl_media_get_mime (media); GDateTime *date = grl_media_get_modification_date (media); time_t rawdate = g_date_time_to_unix(date); g_printf ("\t Got '%s', of type '%s', ctime is '%s'\n", title, mime, ctime(&rawdate)); g_printf ("\t\t URL: %s\n", url); } out: g_object_unref (media); }
static gboolean add_single_file (BgPicturesSource *bg_source, GFile *file, const gchar *content_type, guint64 mtime, GtkTreeRowReference **ret_row_ref) { CcBackgroundItem *item = NULL; CcBackgroundItemFlags flags = 0; GtkListStore *store; GtkTreeIter iter; GtkTreePath *path = NULL; GtkTreeRowReference *row_ref = NULL; cairo_surface_t *surface = NULL; char *source_uri = NULL; char *uri = NULL; gboolean needs_download; gboolean retval = FALSE; GFile *pictures_dir, *cache_dir; GrlMedia *media; /* find png and jpeg files */ if (!content_type) goto out; if (!in_content_types (content_type)) goto out; /* create a new CcBackgroundItem */ uri = g_file_get_uri (file); pictures_dir = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_PICTURES)); cache_dir = bg_pictures_source_get_cache_file (); needs_download = !g_file_has_parent (file, pictures_dir) && !g_file_has_parent (file, cache_dir); g_object_unref (pictures_dir); g_object_unref (cache_dir); if (!needs_download) { source_uri = g_strdup (uri); flags |= CC_BACKGROUND_ITEM_HAS_URI; } else { source_uri = uri; uri = NULL; } item = cc_background_item_new (uri); flags |= CC_BACKGROUND_ITEM_HAS_SHADING | CC_BACKGROUND_ITEM_HAS_PLACEMENT; g_object_set (G_OBJECT (item), "flags", flags, "shading", G_DESKTOP_BACKGROUND_SHADING_SOLID, "placement", G_DESKTOP_BACKGROUND_STYLE_ZOOM, "modified", mtime, "needs-download", needs_download, "source-url", source_uri, NULL); if (!ret_row_ref && in_screenshot_types (content_type)) goto read_file; surface = get_content_loading_icon (BG_SOURCE (bg_source)); store = bg_source_get_liststore (BG_SOURCE (bg_source)); /* insert the item into the liststore */ gtk_list_store_insert_with_values (store, &iter, -1, 0, surface, 1, item, -1); path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter); row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (store), path); g_object_set_data_full (G_OBJECT (item), "row-ref", row_ref, (GDestroyNotify) gtk_tree_row_reference_free); read_file: media = g_object_get_data (G_OBJECT (file), "grl-media"); if (media == NULL) { g_object_set_data_full (G_OBJECT (file), "item", g_object_ref (item), g_object_unref); g_file_read_async (file, G_PRIORITY_DEFAULT, bg_source->priv->cancellable, picture_opened_for_read, bg_source); } else { GFile *native_file; GFile *thumbnail_file = NULL; gchar *native_dir; gchar *native_path; const gchar *title; const gchar *thumbnail_uri; title = grl_media_get_title (media); g_object_set (G_OBJECT (item), "name", title, NULL); thumbnail_uri = grl_media_get_thumbnail (media); thumbnail_file = g_file_new_for_uri (thumbnail_uri); native_path = gnome_desktop_thumbnail_path_for_uri (source_uri, GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE); native_file = g_file_new_for_path (native_path); native_dir = g_path_get_dirname (native_path); g_mkdir_with_parents (native_dir, USER_DIR_MODE); g_object_set_data_full (G_OBJECT (thumbnail_file), "item", g_object_ref (item), g_object_unref); g_object_set_data_full (G_OBJECT (thumbnail_file), "native-file", g_object_ref (native_file), g_object_unref); g_file_copy_async (thumbnail_file, native_file, G_FILE_COPY_ALL_METADATA, G_PRIORITY_DEFAULT, bg_source->priv->cancellable, NULL, NULL, picture_copied_for_read, bg_source); g_clear_object (&thumbnail_file); g_object_unref (native_file); g_free (native_dir); g_free (native_path); } retval = TRUE; out: if (ret_row_ref) { if (row_ref && retval != FALSE) *ret_row_ref = gtk_tree_row_reference_copy (row_ref); else *ret_row_ref = NULL; } gtk_tree_path_free (path); g_clear_pointer (&surface, (GDestroyNotify) cairo_surface_destroy); g_clear_object (&item); g_object_unref (file); g_free (source_uri); g_free (uri); return retval; }
static void grilo_media_browse_cb (GrlSource *grilo_source, guint operation_id, GrlMedia *media, guint remaining, RBGriloSource *source, const GError *error) { if (operation_id != source->priv->media_browse_op) { return; } if (error != NULL) { /* do something? */ rb_debug ("got error for %s: %s", grl_source_get_name (grilo_source), error->message); return; } GDK_THREADS_ENTER (); if (media != NULL) { source->priv->media_browse_got_results = TRUE; source->priv->media_browse_position++; if (GRL_IS_MEDIA_AUDIO (media)) { RhythmDBEntry *entry; entry = create_entry_for_media (source->priv->db, source->priv->entry_type, GRL_DATA (media), GRL_DATA (source->priv->browse_container)); if (entry != NULL) { rhythmdb_query_model_add_entry (source->priv->query_model, entry, -1); } } else if (GRL_IS_MEDIA_BOX (media)) { source->priv->media_browse_got_containers = TRUE; } } if (remaining == 0) { source->priv->media_browse_op = 0; if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (source->priv->query_model), NULL) == 0 && source->priv->media_browse_position >= CONTAINER_GIVE_UP_POINT) { /* if we don't find any media within the first 100 or so results, * assume this container doesn't have any. otherwise we'd load * the entire thing when it got selected, which would suck. */ rb_debug ("didn't find any media in %s, giving up", grl_media_get_title (source->priv->media_browse_container)); gtk_tree_store_set (source->priv->browser_model, &source->priv->media_browse_container_iter, 2, CONTAINER_NO_MEDIA, -1); } else if (source->priv->media_browse_got_results) { if (source->priv->media_browse_position < source->priv->media_browse_limit) { media_browse_next (source); } else { char *text; text = g_strdup_printf (ngettext ("Only showing %d result", "Only showing %d results", source->priv->media_browse_position), source->priv->media_browse_position); gtk_label_set_text (GTK_LABEL (source->priv->info_bar_label), text); g_free (text); gtk_widget_show (source->priv->info_bar); } } else if (source->priv->media_browse_got_containers == FALSE && source->priv->media_browse_container != NULL) { /* make sure there's no marker row for this container */ delete_marker_row (source, &source->priv->media_browse_container_iter); } } GDK_THREADS_LEAVE (); }
static void grilo_browse_cb (GrlSource *grilo_source, guint operation_id, GrlMedia *media, guint remaining, RBGriloSource *source, const GError *error) { if (operation_id != source->priv->browse_op) { return; } if (error != NULL) { /* do something? */ rb_debug ("got error for %s: %s", grl_source_get_name (grilo_source), error->message); source->priv->browse_op = 0; return; } if (media != NULL) { source->priv->browse_got_results = TRUE; source->priv->browse_position++; } if (media && GRL_IS_MEDIA_BOX (media)) { GtkTreeIter new_row; if (source->priv->browse_container == NULL) { /* insert at the end */ gtk_tree_store_insert_with_values (source->priv->browser_model, &new_row, NULL, -1, 0, g_object_ref (media), 1, grl_media_get_title (media), 2, CONTAINER_UNKNOWN_MEDIA, 3, 0, -1); } else { int n; /* insert before the expand marker row */ n = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (source->priv->browser_model), &source->priv->browse_container_iter); gtk_tree_store_insert_with_values (source->priv->browser_model, &new_row, &source->priv->browse_container_iter, n - 1, 0, g_object_ref (media), 1, grl_media_get_title (media), 2, CONTAINER_UNKNOWN_MEDIA, 3, 0, -1); } /* and insert an expand marker below it too */ gtk_tree_store_insert_with_values (source->priv->browser_model, NULL, &new_row, -1, 0, NULL, 1, "...", /* needs to be translatable? */ 2, CONTAINER_NO_MEDIA, 3, 0, -1); } else if (media && GRL_IS_MEDIA_AUDIO (media)) { source->priv->browse_got_media = TRUE; } if (remaining == 0) { source->priv->browse_op = 0; if (source->priv->browse_got_results == FALSE && source->priv->browse_container != NULL) { /* no more results for this container, so delete the marker row */ delete_marker_row (source, &source->priv->browse_container_iter); set_container_type (source, &source->priv->browse_container_iter, source->priv->browse_got_media); gtk_tree_store_set (source->priv->browser_model, &source->priv->browse_container_iter, 3, -1, -1); } else if (source->priv->browse_container != NULL) { if (source->priv->browse_position >= CONTAINER_GIVE_UP_POINT && gtk_tree_model_iter_n_children (GTK_TREE_MODEL (source->priv->browser_model), &source->priv->browse_container_iter) == 1) { /* no containers yet, so remove the marker row */ delete_marker_row (source, &source->priv->browse_container_iter); } else { /* store browse position for next time we want more */ gtk_tree_store_set (source->priv->browser_model, &source->priv->browse_container_iter, 3, source->priv->browse_position, -1); maybe_expand_container (source); } } else if (source->priv->browse_got_results && source->priv->browse_container == NULL) { /* get all top-level containers */ browse_next (source); } } }
static void grl_tmdb_source_resolve (GrlSource *source, GrlSourceResolveSpec *rs) { ResolveClosure *closure; GrlTmdbRequest *request; const char *title = NULL; const char *str_movie_id; GrlTmdbSource *self = GRL_TMDB_SOURCE (source); guint64 movie_id = 0; GList *it; if (!grl_media_is_video (rs->media)) { /* We only entertain videos */ rs->callback (source, rs->operation_id, rs->media, rs->user_data, NULL); return; } /* If the media is a TV show, don't handle it */ if (grl_media_get_show (rs->media) != NULL) { rs->callback (source, rs->operation_id, rs->media, rs->user_data, NULL); return; } /* Prefer resolving by movie-id: This is more reliable and saves the search query. */ str_movie_id = grl_data_get_string (GRL_DATA (rs->media), GRL_TMDB_METADATA_KEY_TMDB_ID); if (str_movie_id) movie_id = strtoull (str_movie_id, NULL, 10); /* Try title if no movie-id could be found. */ if (movie_id == 0) title = grl_media_get_title (rs->media); if (movie_id == 0 && title == NULL) { /* Can't search for anything without a title or the movie-id ... */ rs->callback (source, rs->operation_id, rs->media, rs->user_data, NULL); return; } GRL_DEBUG ("grl_tmdb_source_resolve"); closure = g_slice_new0 (ResolveClosure); closure->self = g_object_ref (self); closure->rs = rs; closure->pending_requests = g_queue_new (); closure->keys = g_hash_table_new (g_direct_hash, g_direct_equal); closure->slow = FALSE; closure->id = movie_id; it = rs->keys; /* Copy keys to list for faster lookup */ while (it) { g_hash_table_add (closure->keys, it->data); /* Enable slow resolution if slow keys are requested */ closure->slow |= g_hash_table_contains (self->priv->slow_keys, it->data); it = it->next; } /* Disable slow resolution if slow keys where requested, but the operation * options explicitly ask for fast resolving only. */ if (grl_operation_options_get_resolution_flags (rs->options) & GRL_RESOLVE_FAST_ONLY) closure->slow = FALSE; /* We did not receive the config yet, queue request. Config callback will * take care of flushing the queue when ready. */ if (self->priv->configuration == NULL && self->priv->config_pending) { g_queue_push_tail (self->priv->pending_resolves, closure); return; } if (self->priv->configuration == NULL) { GRL_DEBUG ("Fetching TMDb configuration..."); /* We need to fetch TMDb's configuration for the image paths */ request = grl_tmdb_request_new_configuration (closure->self->priv->api_key); g_assert (g_queue_is_empty (closure->pending_requests)); queue_request (closure, request, on_configuration_ready); self->priv->config_pending = TRUE; } if (title) { GRL_DEBUG ("Running initial search for title \"%s\"...", title); request = grl_tmdb_request_new_search (closure->self->priv->api_key, title); queue_request (closure, request, on_search_ready); run_pending_requests (closure, 1); } else { GRL_DEBUG ("Running %s lookup for movie #%" G_GUINT64_FORMAT "...", closure->slow ? "slow" : "fast", movie_id); if (closure->slow) { resolve_slow_details (closure); } else { queue_detail_request (closure, GRL_TMDB_REQUEST_DETAIL_MOVIE); } run_pending_requests (closure, G_MAXINT); } }
static void store_bookmark (GrlBookmarksSource *bookmarks_source, GList **keylist, GrlMediaBox *parent, GrlMedia *bookmark, GError **error) { GomResource *resource; const gchar *title; const gchar *url; const gchar *desc; const gchar *thumb; GTimeVal now; gint64 parent_id; const gchar *mime; gchar *date; guint type; gint64 id; gchar *str_id; GError *local_error = NULL; gboolean ret; GRL_DEBUG ("store_bookmark"); title = grl_media_get_title (bookmark); url = grl_media_get_url (bookmark); thumb = grl_media_get_thumbnail (bookmark); desc = grl_media_get_description (bookmark); mime = grl_media_get_mime (bookmark); g_get_current_time (&now); date = g_time_val_to_iso8601 (&now); if (!parent) { parent_id = 0; } else { parent_id = g_ascii_strtoll (grl_media_get_id (GRL_MEDIA (parent)), NULL, 0); } if (parent_id < 0) { parent_id = 0; } GRL_DEBUG ("URL: '%s'", url); if (GRL_IS_MEDIA_BOX (bookmark)) { type = BOOKMARK_TYPE_CATEGORY; } else { type = BOOKMARK_TYPE_STREAM; } resource = g_object_new (BOOKMARKS_TYPE_RESOURCE, "repository", bookmarks_source->priv->repository, "parent", parent_id, "type", type, NULL); if (type == BOOKMARK_TYPE_STREAM) { g_object_set (G_OBJECT (resource), "url", url, NULL); *keylist = g_list_remove (*keylist, GRLKEYID_TO_POINTER (GRL_METADATA_KEY_URL)); } if (title) { g_object_set (G_OBJECT (resource), "title", title, NULL); *keylist = g_list_remove (*keylist, GRLKEYID_TO_POINTER (GRL_METADATA_KEY_TITLE)); } else if (url) { g_object_set (G_OBJECT (resource), "title", url, NULL); } else { g_object_set (G_OBJECT (resource), "title", "(unknown)", NULL); } if (date) { g_object_set (G_OBJECT (resource), "date", date, NULL); } if (mime) { g_object_set (G_OBJECT (resource), "mime", mime, NULL); *keylist = g_list_remove (*keylist, GRLKEYID_TO_POINTER (GRL_METADATA_KEY_MIME)); } if (desc) { g_object_set (G_OBJECT (resource), "desc", desc, NULL); *keylist = g_list_remove (*keylist, GRLKEYID_TO_POINTER (GRL_METADATA_KEY_DESCRIPTION)); } if (thumb) { g_object_set (G_OBJECT (resource), "thumbnail-url", desc, NULL); *keylist = g_list_remove (*keylist, GRLKEYID_TO_POINTER (GRL_METADATA_KEY_THUMBNAIL)); } ret = gom_resource_save_sync (resource, &local_error); if (!ret) { GRL_WARNING ("Failed to store bookmark '%s': %s", title, local_error->message); *error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_STORE_FAILED, _("Failed to store: %s"), local_error->message); g_error_free (local_error); g_object_unref (resource); return; } g_object_get (resource, "id", &id, NULL); str_id = g_strdup_printf ("%" G_GINT64_FORMAT, id); grl_media_set_id (bookmark, str_id); g_free (str_id); g_object_unref (resource); if (bookmarks_source->priv->notify_changes) { grl_source_notify_change (GRL_SOURCE (bookmarks_source), bookmark, GRL_CONTENT_ADDED, FALSE); } }
static void resolve_video (ResolveData *resolve_data, GrlKeyID key, resolution_flags_t flags) { gchar *title, *showname, *display_name; GDateTime *date; gint season, episode; GrlData *data = GRL_DATA (resolve_data->rs->media); resolution_flags_t miss_flags = 0, fill_flags; GRL_DEBUG ("%s",__FUNCTION__); resolve_data_start_operation (resolve_data, "video"); if (!(flags & (FLAG_VIDEO_TITLE | FLAG_VIDEO_SHOWNAME | FLAG_VIDEO_DATE | FLAG_VIDEO_SEASON | FLAG_VIDEO_EPISODE | FLAG_VIDEO_EPISODE_TITLE))) { resolve_data_finish_operation (resolve_data, "video", NULL); return; } if (grl_data_has_key (data, GRL_METADATA_KEY_TITLE)) { if (grl_data_get_boolean (data, GRL_METADATA_KEY_TITLE_FROM_FILENAME)) { miss_flags = FLAG_VIDEO_TITLE; } else miss_flags = 0; } else { miss_flags = FLAG_VIDEO_TITLE; } miss_flags |= grl_data_has_key (data, GRL_METADATA_KEY_SHOW) ? 0 : FLAG_VIDEO_SHOWNAME; miss_flags |= grl_data_has_key (data, GRL_METADATA_KEY_PUBLICATION_DATE) ? 0 : FLAG_VIDEO_DATE; miss_flags |= grl_data_has_key (data, GRL_METADATA_KEY_SEASON) ? 0 : FLAG_VIDEO_SEASON; miss_flags |= grl_data_has_key (data, GRL_METADATA_KEY_EPISODE) ? 0 : FLAG_VIDEO_EPISODE; miss_flags |= grl_data_has_key (data, GRL_METADATA_KEY_EPISODE_TITLE) ? 0 : FLAG_VIDEO_EPISODE_TITLE; fill_flags = flags & miss_flags; if (!fill_flags) { resolve_data_finish_operation (resolve_data, "video", NULL); return; } if (key == GRL_METADATA_KEY_URL) { GFile *file; file = g_file_new_for_uri (grl_media_get_url (resolve_data->rs->media)); display_name = g_file_get_basename (file); g_object_unref (file); } else { display_name = g_strdup (grl_media_get_title (resolve_data->rs->media)); } video_guess_values_from_display_name (display_name, &title, &showname, &date, &season, &episode); g_free (display_name); GRL_DEBUG ("\tfound title=%s/showname=%s/year=%i/season=%i/episode=%i", title, showname, date != NULL ? g_date_time_get_year (date) : 0, season, episode); if (showname) { if (fill_flags & FLAG_VIDEO_SHOWNAME) { grl_data_set_string (data, GRL_METADATA_KEY_SHOW, showname); } g_free (showname); if (fill_flags & FLAG_VIDEO_EPISODE_TITLE && title != NULL) { grl_data_set_string (data, GRL_METADATA_KEY_EPISODE_TITLE, title); } } else { /* As this is just a guess, don't erase already provided values, * unless GRL_METADATA_KEY_TITLE_FROM_FILENAME is set */ if (grl_data_get_boolean (data, GRL_METADATA_KEY_TITLE_FROM_FILENAME)) { if (fill_flags & FLAG_VIDEO_TITLE) { grl_data_set_string (data, GRL_METADATA_KEY_TITLE, title); } } } g_free (title); if (date) { if (fill_flags & FLAG_VIDEO_DATE) { grl_data_set_boxed (data, GRL_METADATA_KEY_PUBLICATION_DATE, date); } g_date_time_unref (date); } if (season && (fill_flags & FLAG_VIDEO_SEASON)) { grl_data_set_int (data, GRL_METADATA_KEY_SEASON, season); } if (episode && (fill_flags & FLAG_VIDEO_EPISODE)) { grl_data_set_int (data, GRL_METADATA_KEY_EPISODE, episode); } resolve_data_finish_operation (resolve_data, "video", NULL); }
static void fill_properties_table (MS2Server *server, GHashTable *properties_table, GList *keys, GrlMedia *media) { GList *prop; GrlKeyID key; const gchar *title; gchar *id; gchar *urls[2] = { 0 }; for (prop = keys; prop; prop = g_list_next (prop)) { key = GRLPOINTER_TO_KEYID (prop->data); if (key == GRL_METADATA_KEY_ID || grl_data_has_key (GRL_DATA (media), key)) { if (key == GRL_METADATA_KEY_ID) { id = serialize_media (media); if (id) { ms2_server_set_path (server, properties_table, id, grl_media_is_container (media)); g_free (id); } } else if (key == GRL_METADATA_KEY_TITLE) { /* Ensure we always insert a valid title */ title = grl_media_get_title (media); if (!title) { title = "Unknown"; } ms2_server_set_display_name (server, properties_table, title); } else if (key == GRL_METADATA_KEY_ALBUM) { ms2_server_set_album (server, properties_table, grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_ALBUM)); } else if (key == GRL_METADATA_KEY_ARTIST) { ms2_server_set_artist (server, properties_table, grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_ARTIST)); } else if (key == GRL_METADATA_KEY_GENRE) { ms2_server_set_genre (server, properties_table, grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_GENRE)); } else if (key == GRL_METADATA_KEY_MIME) { ms2_server_set_mime_type (server, properties_table, grl_media_get_mime (media)); } else if (key == GRL_METADATA_KEY_URL) { urls[0] = (gchar *) grl_media_get_url (media); ms2_server_set_urls (server, properties_table, urls); } else if (key == GRL_METADATA_KEY_BITRATE) { ms2_server_set_bitrate (server, properties_table, grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_BITRATE)); } else if (key == GRL_METADATA_KEY_DURATION) { ms2_server_set_duration (server, properties_table, grl_media_get_duration (media)); } else if (key == GRL_METADATA_KEY_HEIGHT) { ms2_server_set_height (server, properties_table, grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_HEIGHT)); } else if (key == GRL_METADATA_KEY_WIDTH) { ms2_server_set_width (server, properties_table, grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_WIDTH)); } else if (key == GRL_METADATA_KEY_GRILO_MS2_PARENT) { if (grl_media_get_id (media) == NULL) { ms2_server_set_parent (server, properties_table, MS2_ROOT); } else { ms2_server_set_parent (server, properties_table, grl_media_get_grilo_ms2_parent (media)); } } } } }