bandcamp

package module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2019 License: MIT Imports: 6 Imported by: 0

README

bandcamp

Build Status GoDoc

This is a library that can do the following on Bandcamp:

  • Search
  • Lookup Tracks/Albums by URL
Usage

Add it to your Go project

go get github.com/undertideco/bandcamp
Code
package main

import (
  "github.com/undertideco/bandcamp"
)

func main() {
  bandcampClient := bandcamp.NewClient()

  results, err := bandcampClient.Search("Coldplay")
  if err != nil {
    log.Println(err)
  }

  track, err := bandcampClient.Lookup("https://spunoutofcontrol.bandcamp.com/track/infinite")
  if err != nil {
    log.Println(err)
  }

  album, err := bandcampClient.Lookup("https://coldplay.bandcamp.com/album/greatest-hits")
  if err != nil {
    log.Println(err)
  }
}

Documentation

Index

Constants

View Source
const (
	// MediaTypeAlbum represents an album
	MediaTypeAlbum = "album"

	// MediaTypeTrack represents a track
	MediaTypeTrack = "track"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
}

Client represents the request client

func NewClient

func NewClient() *Client

func (Client) Lookup

func (client Client) Lookup(url string) (Media, error)

Lookup look up for a resource

func (Client) Search

func (client Client) Search(term string) ([]Media, error)

Search search for music

type Media

type Media struct {
	Type        string     `json:"type"`
	ArtworkURL  string     `json:"artwork_url"`
	Title       string     `json:"title"`
	Album       string     `json:"album"`
	Artist      string     `json:"artist"`
	ReleaseDate *time.Time `json:"release_date"`
	URL         string     `json:"url"`
}

Media represents media

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL