tools

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLibsndfileVersion added in v1.2.0

func CheckLibsndfileVersion() (float64, error)

CheckLibsndfileVersion returns truncated libsndfile1-dev version.

func CheckRoot

func CheckRoot() bool

CheckRoot checks if user has root permissions.

func ConfigToMap added in v1.3.0

func ConfigToMap(cfg *config.SafeConfig) map[string]interface{}

ConfigToMap converts given config to map. Needs mutex locked!

func ExecCommand added in v1.3.0

func ExecCommand(name string, verbose bool, args ...string) error

ExecCommand is just exec.Command wrapper.

func GetLocalIP added in v1.3.0

func GetLocalIP() string

GetLocalIP returns saved local IP or fetches a new one.

func InitGPIO

func InitGPIO() error

InitGPIO opens connection for LEDs and buttons

func StopGPIO

func StopGPIO() error

StopGPIO closes connection for LEDs and buttons. This function crashes RPi, therefore is not used internally.

func TextToFile added in v1.3.0

func TextToFile(text string, filename string) error

TextToFile saves any given text to given file overwriting it.

Types

type AudioType added in v1.3.0

type AudioType string
var (
	SilenceType AudioType = "silence"
	StreamType  AudioType = "stream"
	FileType    AudioType = "audiofile"
)

type Params added in v1.3.0

type Params struct {
	Type  AudioType
	Audio string
	Cfg   *config.SafeConfig
}

type YouTubeAPIResult

type YouTubeAPIResult struct {
	Kind          string `json:"kind"`
	Etag          string `json:"etag"`
	NextPageToken string `json:"nextPageToken"`
	RegionCode    string `json:"regionCode"`
	PageInfo      struct {
		TotalResults   int `json:"totalResults"`
		ResultsPerPage int `json:"resultsPerPage"`
	} `json:"pageInfo"`
	Items []struct {
		Kind string `json:"kind"`
		Etag string `json:"etag"`
		ID   struct {
			Kind    string `json:"kind"`
			VideoID string `json:"videoId"`
		} `json:"id"`
		Snippet struct {
			PublishedAt time.Time `json:"publishedAt"`
			ChannelID   string    `json:"channelId"`
			Title       string    `json:"title"`
			Description string    `json:"description"`
			Thumbnails  struct {
				Default struct {
					URL    string `json:"url"`
					Width  int    `json:"width"`
					Height int    `json:"height"`
				} `json:"default"`
				Medium struct {
					URL    string `json:"url"`
					Width  int    `json:"width"`
					Height int    `json:"height"`
				} `json:"medium"`
				High struct {
					URL    string `json:"url"`
					Width  int    `json:"width"`
					Height int    `json:"height"`
				} `json:"high"`
			} `json:"thumbnails"`
			ChannelTitle         string    `json:"channelTitle"`
			LiveBroadcastContent string    `json:"liveBroadcastContent"`
			PublishTime          time.Time `json:"publishTime"`
		} `json:"snippet"`
	} `json:"items"`
}

YouTubeAPIResult is a structure of found videos from YouTube API

func SearchYouTube

func SearchYouTube(query string, apikey string) (YouTubeAPIResult, error)

SearchYouTube queries YouTube API and returns first found video

Jump to

Keyboard shortcuts

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