Documentation ¶
Index ¶
- Constants
- func FromMock(t testing.TB) bool
- func GetWallpaper() (string, error)
- func MockServers(t testing.TB)
- func Run(execute func(*Config) *Image, cfg *Config)
- func SetWallpaper(path string, mode Mode) error
- func WithFuriganaApiAppId(appId string) crawlerConfigOption
- func WithGoogleAppCredentials(credentials string) crawlerConfigOption
- func WithUseGoogleText2SpeechService(use bool) crawlerConfigOption
- func WithUseGoogleTranslateService(use bool) crawlerConfigOption
- type Audio
- type Config
- type Image
- func (img *Image) DrawDescription(position types.Position, fontName string) error
- func (img *Image) DrawQRCode(resolution types.Resolution, position types.Position) error
- func (img *Image) DrawWatermark(watermarkFile string, rotateCounterClockwise bool) error
- func (img *Image) EncodeAndDump(targetDir string) (string, error)
- func (i *Image) Equals(other *Image) bool
- func (i *Image) Update(o *Image)
- type Mode
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 GetWallpaper ¶
GetWallpaper returns the path to the current wallpaper.
func MockServers ¶ added in v1.0.5
MockServers sets up mock servers for the Bing and Hiragana API.
func SetWallpaper ¶
SetWallpaper sets the wallpaper from the given path.
func WithFuriganaApiAppId ¶ added in v1.0.11
func WithFuriganaApiAppId(appId string) crawlerConfigOption
func WithGoogleAppCredentials ¶ added in v1.0.11
func WithGoogleAppCredentials(credentials string) crawlerConfigOption
func WithUseGoogleText2SpeechService ¶ added in v1.0.13
func WithUseGoogleText2SpeechService(use bool) crawlerConfigOption
func WithUseGoogleTranslateService ¶ added in v1.0.16
func WithUseGoogleTranslateService(use bool) crawlerConfigOption
Types ¶
type Audio ¶ added in v1.0.13
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"` UseGoogleTranslateService bool `json:"useGoogleTranslateService"` Daemon bool `json:"daemon"` Debug bool `json:"debug"` }
type Image ¶
type Image struct { image.Image Audio *Audio Description string SearchURL string DownloadURL string Location string }
Image is a wrapper around the image.Image interface.
func DownloadAndDecode ¶
func DownloadAndDecode(day types.Day, region types.Region, resolution types.Resolution, opts ...crawlerConfigOption) (*Image, error)
DownloadAndDecode fetches the Bing wallpaper and decodes it.
func (*Image) DrawDescription ¶
DrawDescription draws a title onto the given image.
func (*Image) DrawQRCode ¶
DrawQRCode draws a QR code onto the given image.
func (*Image) DrawWatermark ¶
DrawWatermark draws a watermark onto the given image.
func (*Image) EncodeAndDump ¶
EncodeAndDump encodes the image and dumps it to the target directory. If audio description is available, it will be dumped as well.
Click to show internal directories.
Click to hide internal directories.