hackerWecker

package module
v0.0.0-...-54843fd Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: GPL-3.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

hackerWecker

A tool to wake up a hacker in the morning by creating some kind of radio show (reading computer related rss / atom news and weather data, playing some music / podcast)

Requirements

  • Go 1.13 or higher
  • Espeak (on a Raspberry Pi OS use espeak-ng)

Implementation

Although the tool runs on Linux, *BSD, macOS and Windows laptop or desktop I recommend implementing it on a Rasperry Pi.

Note that you need to add a better sound card via USB (e.g. delock) as the integrated one is not capable in playing music without hurting ones ears.

To make sure that the sound is really played on the second sound card added via USB edit or create the file /etc/asound.conf with the following content:

pcm.usb_snd_card { type hw card 1 device 0 }

ctl.usb_snd_card { type hw card 1 device 0 }

pcm.!default { type plug slave.pcm "usb_snd_card" }

To make the hackerWecker actually wake you up add a crontab line like the following. It will wake you up every workday on 6:30.

# crontab -e

30 6 * * 1-5 cd /home/pi/hackerWecker; /usr/bin/go run main/hackerWecker.go

Last but not least edit the configuration file hackerWecker.json to your needs and copy some MP3 files onto the Raspberry Pi.

Documentation

Overview

Read the JSON configuration

Handle RSS and Atom feeds

Play some music (mp3)

Text to speech

Get information about the weather

URL handling stuff

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchFeeds

func FetchFeeds(feeds map[string]map[string][]string, outputChan chan<- Feed)

func GetFeeds

func GetFeeds() map[string]map[string][]string

func GetMsg

func GetMsg(msg string) string

func GetPodcasts

func GetPodcasts() map[string]map[string][]string

func LogError

func LogError(msg string)

func LogFatal

func LogFatal(msg string)

func LogInfo

func LogInfo(msg string)

func NumFeeds

func NumFeeds() int

func NumPodcasts

func NumPodcasts() int

func PlayMusic

func PlayMusic()

func PlayPodcast

func PlayPodcast(feed Feed)

func ReadConfig

func ReadConfig(configFile string) error

func ReadFeed

func ReadFeed(feed Feed) int

func ReadWeather

func ReadWeather()

func SetupMixer

func SetupMixer()

func Speak

func Speak(text string)

Types

type Config

type Config struct {
	Feeds               map[string]map[string][]string
	FilterVars          map[string][]string
	MaxAgeOfFeedsInDays int
	Messages            map[string]string
	MusicDirs           []string
	NumberOfThreads     int
	NumberOfTracks      int
	MixerCmd            string
	MixerOpts           []string
	OpenWeatherAPIKey   string
	Podcasts            map[string]map[string][]string
	Shuffle             bool
	TtsCmd              string
	TtsParams           string
	WeatherLocation     string
	WeatherUnit         string
	UserAgent           string
}

type Feed

type Feed struct {
	Url   string
	Title string
	Items map[string]string
}

type Weather

type Weather struct {
	Description string
	Temp        int
	TempMin     int
	TempMax     int
	WindSpeed   int
	Rain        int
	Sunrise     int
	Sunset      int
	TempUnit    string
}

func GetWeather

func GetWeather() Weather

Directories

Path Synopsis
Wake up a hacker by reading news and play some music and podcast
Wake up a hacker by reading news and play some music and podcast

Jump to

Keyboard shortcuts

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