mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
Don't announce smart playlists with no items
This commit is contained in:
parent
fe16a9ca4e
commit
392f34bf85
@ -1295,7 +1295,9 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char **
|
|||||||
char **strval;
|
char **strval;
|
||||||
int nmeta;
|
int nmeta;
|
||||||
int npls;
|
int npls;
|
||||||
int32_t val;
|
int32_t plid;
|
||||||
|
int32_t pltype;
|
||||||
|
int32_t plitems;
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -1382,6 +1384,22 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char **
|
|||||||
npls = 0;
|
npls = 0;
|
||||||
while (((ret = db_query_fetch_pl(&qp, &dbpli)) == 0) && (dbpli.id))
|
while (((ret = db_query_fetch_pl(&qp, &dbpli)) == 0) && (dbpli.id))
|
||||||
{
|
{
|
||||||
|
plid = 1;
|
||||||
|
if (safe_atoi32(dbpli.id, &plid) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pltype = 0;
|
||||||
|
if (safe_atoi32(dbpli.type, &pltype) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
plitems = 0;
|
||||||
|
if (safe_atoi32(dbpli.items, &plitems) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Don't add empty smart playlists */
|
||||||
|
if ((plid > 1) && (pltype == 1) && (plitems == 0))
|
||||||
|
continue;
|
||||||
|
|
||||||
npls++;
|
npls++;
|
||||||
|
|
||||||
for (i = 0; i < nmeta; i++)
|
for (i = 0; i < nmeta; i++)
|
||||||
@ -1396,21 +1414,14 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char **
|
|||||||
/* com.apple.itunes.smart-playlist - type = 1 AND id != 1 */
|
/* com.apple.itunes.smart-playlist - type = 1 AND id != 1 */
|
||||||
if (dfm == &dfm_dmap_aeSP)
|
if (dfm == &dfm_dmap_aeSP)
|
||||||
{
|
{
|
||||||
val = 0;
|
if ((pltype == PL_SMART) && (plid != 1))
|
||||||
ret = safe_atoi32(dbpli.type, &val);
|
|
||||||
if ((ret == 0) && (val == PL_SMART))
|
|
||||||
{
|
{
|
||||||
val = 1;
|
int32_t aePS = 0;
|
||||||
ret = safe_atoi32(dbpli.id, &val);
|
dmap_add_char(playlist, "aeSP", 1);
|
||||||
if ((ret == 0) && (val != 1))
|
|
||||||
{
|
|
||||||
int32_t aePS = 0;
|
|
||||||
dmap_add_char(playlist, "aeSP", 1);
|
|
||||||
|
|
||||||
ret = safe_atoi32(dbpli.special_id, &aePS);
|
ret = safe_atoi32(dbpli.special_id, &aePS);
|
||||||
if ((ret == 0) && (aePS > 0))
|
if ((ret == 0) && (aePS > 0))
|
||||||
dmap_add_char(playlist, "aePS", aePS);
|
dmap_add_char(playlist, "aePS", aePS);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -1431,18 +1442,14 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char **
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Item count (mimc) */
|
/* Item count (mimc) */
|
||||||
val = 0;
|
if (plitems > 0)
|
||||||
ret = safe_atoi32(dbpli.items, &val);
|
dmap_add_int(playlist, "mimc", plitems);
|
||||||
if ((ret == 0) && (val > 0))
|
|
||||||
dmap_add_int(playlist, "mimc", val);
|
|
||||||
|
|
||||||
/* Container ID (mpco) */
|
/* Container ID (mpco) */
|
||||||
dmap_add_int(playlist, "mpco", 0);
|
dmap_add_int(playlist, "mpco", 0);
|
||||||
|
|
||||||
/* Base playlist (abpl), id = 1 */
|
/* Base playlist (abpl), id = 1 */
|
||||||
val = 0;
|
if (plid == 1)
|
||||||
ret = safe_atoi32(dbpli.id, &val);
|
|
||||||
if ((ret == 0) && (val == 1))
|
|
||||||
dmap_add_char(playlist, "abpl", 1);
|
dmap_add_char(playlist, "abpl", 1);
|
||||||
|
|
||||||
DPRINTF(E_DBG, L_DAAP, "Done with playlist\n");
|
DPRINTF(E_DBG, L_DAAP, "Done with playlist\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user