[artwork] Remove old artwork_get_xxx in favor of new which has a format arg

This commit is contained in:
ejurgensen 2020-11-18 23:23:05 +01:00
parent a9e6497be2
commit 695927de2a
8 changed files with 15 additions and 31 deletions

View File

@ -1903,13 +1903,7 @@ process_group(struct artwork_ctx *ctx)
/* ------------------------------ ARTWORK API ------------------------------ */
int
artwork_get_item(struct evbuffer *evbuf, int id, int max_w, int max_h)
{
return artwork_get_item2(evbuf, id, max_w, max_h, 0);
}
int
artwork_get_item2(struct evbuffer *evbuf, int id, int max_w, int max_h, int format)
artwork_get_item(struct evbuffer *evbuf, int id, int max_w, int max_h, int format)
{
struct artwork_ctx ctx;
char filter[32];
@ -1970,13 +1964,7 @@ artwork_get_item2(struct evbuffer *evbuf, int id, int max_w, int max_h, int form
}
int
artwork_get_group(struct evbuffer *evbuf, int id, int max_w, int max_h)
{
return artwork_get_group2(evbuf, id, max_w, max_h, 0);
}
int
artwork_get_group2(struct evbuffer *evbuf, int id, int max_w, int max_h, int format)
artwork_get_group(struct evbuffer *evbuf, int id, int max_w, int max_h, int format)
{
struct artwork_ctx ctx;
int ret;

View File

@ -19,13 +19,11 @@
* @in id The mfi item id
* @in max_w Requested maximum image width (may not be obeyed)
* @in max_h Requested maximum image height (may not be obeyed)
* @in format Requested format (may not be obeyed)
* @in format Requested format (may not be obeyed), 0 for default
* @return ART_FMT_* on success, -1 on error or no artwork found
*/
int
artwork_get_item(struct evbuffer *evbuf, int id, int max_w, int max_h);
int
artwork_get_item2(struct evbuffer *evbuf, int id, int max_w, int max_h, int format);
artwork_get_item(struct evbuffer *evbuf, int id, int max_w, int max_h, int format);
/*
* Get the artwork image for a group (an album or an artist)
@ -34,13 +32,11 @@ artwork_get_item2(struct evbuffer *evbuf, int id, int max_w, int max_h, int form
* @in id The group id (not the persistentid)
* @in max_w Requested maximum image width (may not be obeyed)
* @in max_h Requested maximum image height (may not be obeyed)
* @in format Requested format (may not be obeyed)
* @in format Requested format (may not be obeyed), 0 for default
* @return ART_FMT_* on success, -1 on error or no artwork found
*/
int
artwork_get_group(struct evbuffer *evbuf, int id, int max_w, int max_h);
int
artwork_get_group2(struct evbuffer *evbuf, int id, int max_w, int max_h, int format);
artwork_get_group(struct evbuffer *evbuf, int id, int max_w, int max_h, int format);
/*
* Checks if the file is an artwork file (based on user config)

View File

@ -92,7 +92,7 @@ artworkapi_reply_nowplaying(struct httpd_request *hreq)
if (ret != 0)
return HTTP_NOTFOUND;
ret = artwork_get_item(hreq->reply, id, max_w, max_h);
ret = artwork_get_item(hreq->reply, id, max_w, max_h, 0);
return response_process(hreq, ret);
}
@ -113,7 +113,7 @@ artworkapi_reply_item(struct httpd_request *hreq)
if (ret != 0)
return HTTP_BADREQUEST;
ret = artwork_get_item(hreq->reply, id, max_w, max_h);
ret = artwork_get_item(hreq->reply, id, max_w, max_h, 0);
return response_process(hreq, ret);
}
@ -134,7 +134,7 @@ artworkapi_reply_group(struct httpd_request *hreq)
if (ret != 0)
return HTTP_BADREQUEST;
ret = artwork_get_group(hreq->reply, id, max_w, max_h);
ret = artwork_get_group(hreq->reply, id, max_w, max_h, 0);
return response_process(hreq, ret);
}

View File

@ -2020,9 +2020,9 @@ daap_reply_extra_data(struct httpd_request *hreq)
}
if (strcmp(hreq->uri_parsed->path_parts[2], "groups") == 0)
ret = artwork_get_group(hreq->reply, id, max_w, max_h);
ret = artwork_get_group(hreq->reply, id, max_w, max_h, 0);
else if (strcmp(hreq->uri_parsed->path_parts[2], "items") == 0)
ret = artwork_get_item(hreq->reply, id, max_w, max_h);
ret = artwork_get_item(hreq->reply, id, max_w, max_h, 0);
len = evbuffer_get_length(hreq->reply);

View File

@ -2363,7 +2363,7 @@ dacp_reply_nowplayingartwork(struct httpd_request *hreq)
if (ret < 0)
goto no_artwork;
ret = artwork_get_item(hreq->reply, id, max_w, max_h);
ret = artwork_get_item(hreq->reply, id, max_w, max_h, 0);
len = evbuffer_get_length(hreq->reply);
switch (ret)

View File

@ -4694,7 +4694,7 @@ artwork_cb(struct evhttp_request *req, void *arg)
return;
}
format = artwork_get_item(evbuffer, itemid, ART_DEFAULT_WIDTH, ART_DEFAULT_HEIGHT);
format = artwork_get_item(evbuffer, itemid, ART_DEFAULT_WIDTH, ART_DEFAULT_HEIGHT, 0);
if (format < 0)
{
httpd_send_error(req, HTTP_NOTFOUND, "Document was not found");

View File

@ -2387,7 +2387,7 @@ cast_metadata_prepare(struct output_metadata *metadata)
CHECK_NULL(L_CAST, cmd = calloc(1, sizeof(struct cast_metadata)));
CHECK_NULL(L_CAST, cmd->artwork = evbuffer_new());
ret = artwork_get_item2(cmd->artwork, queue_item->file_id, ART_DEFAULT_WIDTH, ART_DEFAULT_HEIGHT, ART_FMT_VP8);
ret = artwork_get_item(cmd->artwork, queue_item->file_id, ART_DEFAULT_WIDTH, ART_DEFAULT_HEIGHT, ART_FMT_VP8);
if (ret < 0)
{
DPRINTF(E_INFO, L_CAST, "Failed to retrieve artwork for file '%s'; no artwork will be sent\n", queue_item->path);

View File

@ -2201,7 +2201,7 @@ raop_metadata_prepare(struct output_metadata *metadata)
CHECK_NULL(L_RAOP, rmd->metadata = evbuffer_new());
CHECK_NULL(L_RAOP, tmp = evbuffer_new());
ret = artwork_get_item(rmd->artwork, queue_item->file_id, ART_DEFAULT_WIDTH, ART_DEFAULT_HEIGHT);
ret = artwork_get_item(rmd->artwork, queue_item->file_id, ART_DEFAULT_WIDTH, ART_DEFAULT_HEIGHT, 0);
if (ret < 0)
{
DPRINTF(E_INFO, L_RAOP, "Failed to retrieve artwork for file '%s'; no artwork will be sent\n", queue_item->path);