[artwork] Ignore streams with media kind != music in artwork sources

"stream", "discogs", "coverartarchive", "spotify"
This commit is contained in:
chme 2020-04-12 10:49:56 +02:00
parent 08b2eb8d4c
commit 14b4081769

View File

@ -1496,8 +1496,16 @@ source_item_stream_get(struct artwork_ctx *ctx)
char *url;
char *ext;
int len;
int media_kind;
int ret;
ret = safe_atoi32(ctx->dbmfi->media_kind, &media_kind);
if (ret != 0 || media_kind != MEDIA_KIND_MUSIC)
{
DPRINTF(E_SPAM, L_ART, "Ignoring internet stream artwork request for media_kind != music: %s\n", ctx->dbmfi->path);
return ART_E_NONE;
}
DPRINTF(E_SPAM, L_ART, "Trying internet stream artwork in %s\n", ctx->dbmfi->path);
ret = ART_E_NONE;
@ -1562,11 +1570,19 @@ static int
source_item_discogs_get(struct artwork_ctx *ctx)
{
char *url;
int media_kind;
int ret;
if (!online_source_is_enabled(&discogs_source))
return ART_E_NONE;
ret = safe_atoi32(ctx->dbmfi->media_kind, &media_kind);
if (ret != 0 || media_kind != MEDIA_KIND_MUSIC)
{
DPRINTF(E_SPAM, L_ART, "Ignoring internet stream artwork request for media_kind != music: %s\n", ctx->dbmfi->path);
return ART_E_NONE;
}
url = online_source_search(&discogs_source, ctx);
if (!url)
return ART_E_NONE;
@ -1583,11 +1599,19 @@ static int
source_item_coverartarchive_get(struct artwork_ctx *ctx)
{
char *url;
int media_kind;
int ret;
if (!online_source_is_enabled(&musicbrainz_source))
return ART_E_NONE;
ret = safe_atoi32(ctx->dbmfi->media_kind, &media_kind);
if (ret != 0 || media_kind != MEDIA_KIND_MUSIC)
{
DPRINTF(E_SPAM, L_ART, "Ignoring internet stream artwork request for media_kind != music: %s\n", ctx->dbmfi->path);
return ART_E_NONE;
}
// We search Musicbrainz to get the Musicbrainz ID, which we need to get the
// artwork from the Cover Art Archive
url = online_source_search(&musicbrainz_source, ctx);
@ -1627,11 +1651,19 @@ source_item_spotifywebapi_search_get(struct artwork_ctx *ctx)
{
struct spotifywebapi_access_token info;
char *url;
int media_kind;
int ret;
if (!online_source_is_enabled(&spotify_source))
return ART_E_NONE;
ret = safe_atoi32(ctx->dbmfi->media_kind, &media_kind);
if (ret != 0 || media_kind != MEDIA_KIND_MUSIC)
{
DPRINTF(E_SPAM, L_ART, "Ignoring internet stream artwork request for media_kind != music: %s\n", ctx->dbmfi->path);
return ART_E_NONE;
}
spotifywebapi_access_token_get(&info);
if (!info.token)
return ART_E_ERROR;