Re: [Rhythmbox-devel] DACP (iTunes remote) support added
- From: Peter <rhythmbox-devel maubp freeserve co uk>
- To: "W. Michael Petullo" <mike flyn org>
- Cc: rhythmbox-devel gnome org, Alexandre Rosenfeld <alexandre rosenfeld gmail com>
- Subject: Re: [Rhythmbox-devel] DACP (iTunes remote) support added
- Date: Tue, 26 Oct 2010 00:21:39 +0100
On Mon, Oct 25, 2010 at 4:32 AM, W. Michael Petullo <mike flyn org> wrote:
>
>> The following stub entry in libdmapsharing to just say we don't
>> have covers (rather than not handling the request at all) seems
>> to solve the stale cover issue I was seeing in the Remote app:
>> ...
>
> Applied to libdmapsharing Git master. Please test.
Thank you Michael - that works for me.
With the latest libdmapsharing from git, the attached patch to
RB's DAAP/DACP plugin works nicely to support the now
playing artwork/cover in the Apple Remote application.
This includes the helpful comments from Bastien yesterday.
As discussed earlier, full over support via DACP will need
a new API call added to libdmapsharing.
Peter
diff --git a/plugins/daap/rb-dacp-player.c b/plugins/daap/rb-dacp-player.c
index f5d4875..ea66a03 100644
--- a/plugins/daap/rb-dacp-player.c
+++ b/plugins/daap/rb-dacp-player.c
@@ -47,6 +47,7 @@
struct _RBDACPPlayerPrivate {
RBShell *shell;
RBShellPlayer *shell_player;
+ RhythmDB *rdb;
};
static void rb_dacp_player_get_property (GObject *object, guint prop_id,
@@ -119,6 +120,7 @@ rb_dacp_player_finalize (GObject *object)
g_object_unref (player->priv->shell);
g_object_unref (player->priv->shell_player);
+ g_object_unref (player->priv->rdb);
G_OBJECT_CLASS (rb_dacp_player_parent_class)->finalize (object);
}
@@ -259,6 +261,9 @@ rb_dacp_player_new (RBShell *shell)
player = RB_DACP_PLAYER (g_object_new (RB_TYPE_DACP_PLAYER, NULL));
+ g_object_get (shell,
+ "db", &player->priv->rdb,
+ NULL);
player->priv->shell = g_object_ref (shell);
player->priv->shell_player = g_object_ref (rb_shell_get_player (shell));
g_signal_connect_object (player->priv->shell_player,
@@ -294,7 +299,32 @@ rb_dacp_player_now_playing_record (DACPPlayer *player)
static gchar *
rb_dacp_player_now_playing_artwork (DACPPlayer *player, guint width, guint height)
{
- return NULL;
+ /* We are told the requested size, but we can ignore it as
+ libdmapsharing will shrink the image for us */
+ GValue *md;
+ gchar *cover;
+ RhythmDBEntry *entry;
+ GFile *file;
+ const char *uri;
+
+ entry = rb_shell_player_get_playing_entry (RB_DACP_PLAYER (player)->priv->shell_player);
+ if (entry == NULL)
+ return NULL;
+
+ md = rhythmdb_entry_request_extra_metadata (RB_DACP_PLAYER (player)->priv->rdb, entry, RHYTHMDB_PROP_COVER_ART_URI);
+ rhythmdb_entry_unref (entry);
+
+ if (md == NULL)
+ return NULL;
+
+ uri = g_value_get_string (md);
+ g_debug("Now playing artwork for DACP remote: %s", uri);
+ file = g_file_new_for_uri (uri);
+ cover = g_file_get_path (file);
+ g_object_unref (file);
+ g_value_unset (md);
+ g_free (md);
+ return cover;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]