getsong

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: MIT Imports: 19 Imported by: 1

README

getsong

travis go report card coverage godocs

This is a simple library that utilizes the rylio/ytdl YouTube downloader and ffmpeg to get almost any mp3 of a song that you want to listen to. I wrote this so I could download mp3s of my favorite Spotify playlists.

Install

go get -u github.com/schollz/getsong/...

Usage

The aim of this library to have a low (or zero) false positive rate, so it works best when the entered title + artist are spelled correctly.

Use as a program
$ getsong 'Getting in Tune' 'The Who'
Downloading 'Getting in Tune by The Who (W6-3rnD7FSc).webm'...
 4.72 MiB / 4.72 MiB [==========================] 100.00% 37.97 KiB/s 2m7s
...converting to mp3...
Downloaded 'Getting in Tune by The Who (W6-3rnD7FSc).mp3'
Use as a library
// download "True" by "Spandau Ballet"
fname, err := getsong.GetSong("True", "Spandau Ballet")
if err == nil {
    fmt.Printf("Downloaded '%s'\n", fname)
}

Contributing

Pull requests are welcome. Feel free to...

  • Revise documentation
  • Add new features
  • Fix bugs
  • Suggest improvements

License

MIT

Documentation

Index

Constants

View Source
const CHUNK_SIZE = 524288

Variables

This section is empty.

Functions

func GetSong

func GetSong(title string, artist string, option ...Options) (savedFilename string, err error)

GetSong requires passing in the options which requires at least a title. If an Artist is provided, it will save it as Artist - Title.mp3 You can also pass in a duration, and it will try to find a video that is within 10 seconds of that duration.

Types

type Options

type Options struct {
	ShowProgress  bool
	Debug         bool
	DoNotDownload bool
}

Options allow you to set the artist, title and duration to find the right song. You can also set the progress and debugging for the program execution.

type YouTubeInfo

type YouTubeInfo struct {
	Title       string
	Description string
	ID          string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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