feat: download single tracks (#5)
Introduces the `godeez download track <ID>` command, allowing users to download individual songs directly. Single tracks are saved into a "Singles" folder by default to keep them organized. The README has been updated with documentation and examples for this new functionality.
This commit is contained in:
@@ -45,6 +45,8 @@ func (c *Client) FetchResource(ctx context.Context, resource Resource, id string
|
||||
payload["alb_id"] = id
|
||||
case *Artist:
|
||||
payload["art_id"] = id
|
||||
case *Track:
|
||||
payload["sng_id"] = id
|
||||
default:
|
||||
return fmt.Errorf("unsupported resource type: %T", r)
|
||||
}
|
||||
@@ -84,6 +86,9 @@ func (c *Client) FetchResource(ctx context.Context, resource Resource, id string
|
||||
if strings.Contains(string(body), `"DATA_ERROR":"artist::getData"`) {
|
||||
return fmt.Errorf("invalid artist ID")
|
||||
}
|
||||
if strings.Contains(string(body), `"DATA_ERROR":"song::getData"`) {
|
||||
return fmt.Errorf("invalid track ID")
|
||||
}
|
||||
if strings.Contains(string(body), `"results":{}`) {
|
||||
return fmt.Errorf("unexpected response")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user