core

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeCenter  = wallpaper.Center
	ModeCrop    = wallpaper.Crop
	ModeFit     = wallpaper.Fit
	ModeSpan    = wallpaper.Span
	ModeStretch = wallpaper.Stretch
	ModeTile    = wallpaper.Tile
)
View Source
const AppName = "Bing Wallpaper Changer"

Variables

This section is empty.

Functions

func FromMock added in v1.0.5

func FromMock(t testing.TB) bool

FromMock returns true if the test is running in mock mode.

func GetWallpaper

func GetWallpaper() (string, error)

GetWallpaper returns the path to the current wallpaper.

func MockServers added in v1.0.5

func MockServers(t testing.TB)

MockServers sets up mock servers for the Bing and Hiragana API.

func SetWallpaper

func SetWallpaper(path string, mode Mode) error

SetWallpaper sets the wallpaper from the given path.

func ShowTray added in v1.0.14

func ShowTray(execute func(*Config) *Image, cfg *Config)

ShowTray shows the tray icon and menu

func WithFuriganaApiAppId added in v1.0.11

func WithFuriganaApiAppId(appId string) configOption

func WithGoogleAppCredentials added in v1.0.11

func WithGoogleAppCredentials(credentials string) configOption

func WithUseGoogleText2SpeechService added in v1.0.13

func WithUseGoogleText2SpeechService(use bool) configOption

Types

type Audio added in v1.0.13

type Audio struct {
	Encoding   string
	Source     io.Reader
	SampleRate int
}

func (*Audio) Close added in v1.0.13

func (a *Audio) Close() error

Implements the io.Closer interface.

func (*Audio) Dump added in v1.0.13

func (a *Audio) Dump(path string) error

Dump dumps the audio to the target path.

func (*Audio) Play added in v1.0.13

func (a *Audio) Play() error

Play the audio stream.

type Config added in v1.0.14

type Config struct {
	Day                         types.Day        `json:"day"`
	Region                      types.Region     `json:"region"`
	Resolution                  types.Resolution `json:"resolution"`
	DrawDescription             bool             `json:"drawDescription"`
	DrawQRCode                  bool             `json:"drawQRCode"`
	Watermark                   string           `json:"watermark"`
	DownloadOnly                bool             `json:"downloadOnly"`
	DownloadDirectory           string           `json:"downloadDirectory"`
	RotateCounterClockwise      bool             `json:"rotateCounterClockwise"`
	GoogleAppCredentials        string           `json:"googleAppCredentials"`
	FuriganaApiAppId            string           `json:"furiganaApiAppId"`
	UseGoogleText2SpeechService bool             `json:"useGoogleText2SpeechService"`
}

type Image

type Image struct {
	image.Image
	Audio       *Audio
	Description string
	SearchURL   string
	DownloadURL string
}

Image is a wrapper around the image.Image interface.

func DownloadAndDecode

func DownloadAndDecode(day types.Day, region types.Region, resolution types.Resolution, opts ...configOption) (*Image, error)

DownloadAndDecode fetches the Bing wallpaper and decodes it.

func SetupTestImage

func SetupTestImage(t testing.TB) *Image

SetupTestImage returns a test image

func (*Image) DrawDescription

func (img *Image) DrawDescription(position types.Position, fontName string) error

DrawDescription draws a title onto the given image.

func (*Image) DrawQRCode

func (img *Image) DrawQRCode(resolution types.Resolution, position types.Position) error

DrawQRCode draws a QR code onto the given image.

func (*Image) DrawWatermark

func (img *Image) DrawWatermark(watermarkFile string, rotateCounterClockwise bool) error

DrawWatermark draws a watermark onto the given image.

func (*Image) EncodeAndDump

func (img *Image) EncodeAndDump(targetDir string) (string, error)

EncodeAndDump encodes the image and dumps it to the target directory. If audio description is available, it will be dumped as well.

func (*Image) Equals

func (i *Image) Equals(other *Image) bool

Equals returns true if the given image is equal to the receiver.

type Mode added in v1.0.4

type Mode = wallpaper.Mode

Mode represents the wallpaper setting mode.

Jump to

Keyboard shortcuts

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