Skip to content

Latest commit

 

History

History
85 lines (56 loc) · 1.64 KB

README.md

File metadata and controls

85 lines (56 loc) · 1.64 KB

Xeno-Canto CLI

GoDoc License: MIT

go-xeno is a cli tool for integrating Xeno-Canto API V2.

Installation

Make sure you have Go installed. Then, run the following command:

go get -u github.com/siansiansu/go-xeno/cmd/xeno

This command will download the xeno tool to your Go workspace.

Use homebrew:

brew tap siansiansu/xeno
brew install xeno

Usage

To use xeno, run the following command:

Download all the audio recordings.

xeno "Eurasian Tree Sparrow"

Only download 1 audio recording.

xeno "Eurasian Tree Sparrow" --max-results 1

View help and available commands:

xeno help

Package

Here's an example demonstrating the usage of the go-xeno package in Go code:

package main

import (
  "context"
  "fmt"

  "github.com/siansiansu/go-xeno"
)

func main() {
  var ctx = context.Background()

  client, err := xeno.NewClient()
  if err != nil {
    panic(err)
  }

  r, err := client.Get(ctx, "Taiwan blue magpie", xeno.Page(1), xeno.NumPages(1))
  if err != nil {
    panic(err)
  }

  for _, e := range r.Recordings {
    fmt.Println(e.Rec, e.Loc, e.File)
  }
}

Contributing

Contributions are welcome! Report bugs or request features by opening an issue. If you want to contribute code, fork the repository and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.