[pipe/artwork] Support for artwork via Shairport metadata pipes

This implementation uses the cache for storage. Might change that to use a
tmpfile instead.
This commit is contained in:
ejurgensen
2019-09-09 21:39:25 +02:00
parent 2e149273e5
commit 69fafd873d
2 changed files with 68 additions and 1 deletions

View File

@@ -138,6 +138,7 @@ static int source_item_cache_get(struct artwork_ctx *ctx);
static int source_item_embedded_get(struct artwork_ctx *ctx);
static int source_item_own_get(struct artwork_ctx *ctx);
static int source_item_stream_get(struct artwork_ctx *ctx);
static int source_item_pipe_get(struct artwork_ctx *ctx);
static int source_item_spotify_get(struct artwork_ctx *ctx);
static int source_item_spotifywebapi_get(struct artwork_ctx *ctx);
static int source_item_ownpl_get(struct artwork_ctx *ctx);
@@ -196,6 +197,12 @@ static struct artwork_source artwork_item_source[] =
.data_kinds = (1 << DATA_KIND_HTTP),
.cache = NEVER,
},
{
.name = "pipe",
.handler = source_item_pipe_get,
.data_kinds = (1 << DATA_KIND_PIPE),
.cache = NEVER,
},
{
.name = "Spotify",
.handler = source_item_spotify_get,
@@ -836,6 +843,26 @@ source_item_stream_get(struct artwork_ctx *ctx)
return ret;
}
/*
* If we are playing a pipe and there is also a metadata pipe, then
* input/pipe.c may have saved the incoming artwork via cache_artwork_stash()
*
*/
static int
source_item_pipe_get(struct artwork_ctx *ctx)
{
int ret;
int format;
DPRINTF(E_SPAM, L_ART, "Trying pipe metadata from %s.metadata\n", ctx->dbmfi->path);
ret = cache_artwork_read(ctx->evbuf, "pipe://metadata", &format);
if (ret < 0)
return ART_E_NONE;
return format;
}
#ifdef HAVE_SPOTIFY_H
static int
source_item_spotify_get(struct artwork_ctx *ctx)