mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-27 16:00:58 -04:00
[artwork] Don't use group handlers if unknown group (artist/album)
This commit is contained in:
parent
de1b1c3805
commit
a6cb70fd66
@ -1362,7 +1362,6 @@ source_group_dir_get(struct artwork_ctx *ctx)
|
|||||||
char *dir;
|
char *dir;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Image is not in the artwork cache. Try directory artwork first */
|
|
||||||
memset(&qp, 0, sizeof(struct query_params));
|
memset(&qp, 0, sizeof(struct query_params));
|
||||||
|
|
||||||
qp.type = Q_GROUP_DIRS;
|
qp.type = Q_GROUP_DIRS;
|
||||||
@ -1850,6 +1849,8 @@ process_items(struct artwork_ctx *ctx, int item_mode)
|
|||||||
static int
|
static int
|
||||||
process_group(struct artwork_ctx *ctx)
|
process_group(struct artwork_ctx *ctx)
|
||||||
{
|
{
|
||||||
|
struct db_media_file_info dbmfi;
|
||||||
|
bool is_valid;
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -1860,6 +1861,22 @@ process_group(struct artwork_ctx *ctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the group is valid (exists and is not e.g. "Unknown album")
|
||||||
|
ret = db_query_start(&ctx->qp);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
DPRINTF(E_LOG, L_ART, "Could not start query to check if group is valid (persistentid = %" PRIi64 ")\n", ctx->qp.persistentid);
|
||||||
|
goto invalid_group;
|
||||||
|
}
|
||||||
|
|
||||||
|
is_valid = (db_query_fetch_file(&ctx->qp, &dbmfi) == 0 && dbmfi.id && strcmp(dbmfi.album, CFG_NAME_UNKNOWN_ALBUM) != 0 && strcmp(dbmfi.album_artist, CFG_NAME_UNKNOWN_ARTIST) != 0);
|
||||||
|
db_query_end(&ctx->qp);
|
||||||
|
if (!is_valid)
|
||||||
|
{
|
||||||
|
DPRINTF(E_SPAM, L_ART, "Skipping group sources due to unknown album or artist\n");
|
||||||
|
goto invalid_group;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; artwork_group_source[i].handler; i++)
|
for (i = 0; artwork_group_source[i].handler; i++)
|
||||||
{
|
{
|
||||||
// If just one handler says we should not cache a negative result then we obey that
|
// If just one handler says we should not cache a negative result then we obey that
|
||||||
@ -1888,9 +1905,8 @@ process_group(struct artwork_ctx *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = process_items(ctx, 0);
|
invalid_group:
|
||||||
|
return process_items(ctx, 0);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user