feat: filter artist albums by type, default to album|ep|single

This commit is contained in:
Alexander
2026-05-07 17:22:59 +02:00
parent 80051396d8
commit 35ac167952
7 changed files with 79 additions and 19 deletions
+9
View File
@@ -137,12 +137,17 @@ func (c *client) lookup(ctx context.Context, entity, id string, inc []string) ([
}
func (c *client) browse(ctx context.Context, entity, linkedEntity, linkedID string, limit, offset int, inc []string) ([]byte, error) {
return c.browseWithTypes(ctx, entity, linkedEntity, linkedID, limit, offset, inc, nil)
}
func (c *client) browseWithTypes(ctx context.Context, entity, linkedEntity, linkedID string, limit, offset int, inc []string, types []string) ([]byte, error) {
zerolog.Ctx(ctx).Debug().
Str("entity", entity).
Str("linked_entity", linkedEntity).
Str("linked_id", linkedID).
Int("limit", limit).
Int("offset", offset).
Strs("types", types).
Msg("provider browse")
params := url.Values{}
@@ -154,6 +159,10 @@ func (c *client) browse(ctx context.Context, entity, linkedEntity, linkedID stri
params.Set("inc", joined)
}
if typeStr := strings.Join(types, "|"); typeStr != "" {
params.Set("type", typeStr)
}
return c.get(ctx, entity, params)
}