Giter VIP home page Giter VIP logo

wally's Introduction

wally

This is a fork of Go Si Mac, initially created by 1995parham. It extends Go Si Mac with images from reddit and is capable of setting a random background image for you.

GitHub Workflow Status GitHub release (latest SemVer) GitHub Release Date

AUR package

Introduction

wally downloads Bing's daily wallpapers, Unsplash's and Reddit's hot random images for you to have a beautiful wallpaper on your desktop whenever you want.

Installation

brew

brew install 1995parham/tap/gosimac

Usage

wally rev-4cbe101-dirty
Fetch the wallpaper from Bing, Reddit, Unsplash...

Usage:
  wally [command]

Available Commands:
  bing        fetches images from https://bing.com
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  unsplash    fetches images from https://unsplash.org
  reddit      fetches images from https://www.reddit.com/r/wallpaper/hot

Flags:
  -h, --help          help for wally
  -n, --number int    The number of photos to return (default 10)
  -p, --path string   A path to store the photos (default "$HOME/Pictures/wally")
  -v, --version       version for wally

As an example, the following command downloads 10 images from unsplash while using deer as a search query.

wally u -q deer -n 10

By default, wally stores images in $HOME/Pictures/wally.

Contribution

The Init method is called on initiation and returns number of available images to download. Then for each image Fetch is called and the result is stored at the user specific location. By implementing this interface you can create new sources for wally.

For adding new source you only need to create a new sub-command in cmd package and then calling your new source with provided path. Also for saving images you can use the following helper function:

func (u *Unsplash) Store(name string, content io.ReadCloser) {
        path := path.Join(
                u.Path,
                fmt.Sprintf("%s-%s.jpg", u.Prefix, name),
        )

        if _, err := os.Stat(path); err == nil {
                pterm.Warning.Printf("%s is already exists\n", path)

                return
        }

        file, err := os.Create(path)
        if err != nil {
                pterm.Error.Printf("os.Create: %v\n", err)

                return
        }

        bytes, err := io.Copy(file, content)
        if err != nil {
                pterm.Error.Printf("io.Copy (%d bytes): %v\n", bytes, err)
        }

        if err := file.Close(); err != nil {
                pterm.Error.Printf("(*os.File).Close: %v", err)
        }

        if err := content.Close(); err != nil {
                pterm.Error.Printf("(*io.ReadCloser).Close: %v", err)
        }
}

wally's People

Contributors

1995parham avatar dependabot[bot] avatar quickstar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.