Giter Club home page Giter Club logo

dscovrpy's Introduction

dscovrpy

Download a recent image of earth close to the current time of day. Images by epic on discovr https://epic.gsfc.nasa.gov/.

Dependencies

  • python
    • tested on version 3.9.7
  • PIL
    • pip install pillow
  • numpy
    • pip install numpy
  • openCV
    • pip install opencv-python

Command Line Arguments

Argument Description
-o output_dir Path to the output directory
-n pics_per_day Pick a day with at least pics_per_day pictures. Higher values lead to pictures, which tend to be closer to the current time of day. Lower values lead to pictures closer to the time of year. There is a maximum value of 24.
-b background Path to the background image. The epic picture will be pasted onto the center of the background, resizing it, to be the same height. Dark, near black backgrounds work best.
-c Removes partially downloaded pictures from the output directory

Examples

Image source: https://epic.gsfc.nasa.gov/archive/natural/2018/07/19/png/epic_1b_20180719181319.png

Image with Background

Example background: https://www.pexels.com/photo/starry-sky-998641/

$ python ./dscovr.py -b example_background.jpg
epic_1b_20180719181319.png downloaded

Epic with background

Save to Output Directory

$ python ./dscovr.py -o ~/.cache/dscovr
epic_1b_20180719181319.png downloaded
$ ls ~/.cache/dscovr
epic.png  image_info.epic

Epic

Run in crontab

Images don't get downloaded twice. The scripts exits, if the image it tries to download is the one listed in image_info.epic.

# run every 10 minutes
10 * * * * ~/.local/share/dscovr/dscovr.py -o ~/.cache/dscovr -n 10 -b ~/.local/share/dscovr/dscovr_background.png -c

Windows

When running the script under Windows it creates an additional epic_copy.png in the output directory. This is because Windows doesn't update the wallpaper, if the source image changed. A workaround is a slideshow, which requires more than one image.

Conky

To use the conky lua script you need to set the PATH variable manually in the file. The script provides conky the function epic_date, which returns the date of the current picture in the local timezone. A lua datetime format can be set as an argument. Usage example in conky.conf:

conky.config = {
    ...
    lua_load = '/path/to/conky.lua',
    ...
}
...
${lua epic_date %d.%m.%y} # dd.mm.yyyy
${lua epic_date %X} # hh:MM:ss
...

dscovrpy's People

Contributors

just1number avatar

Watchers

James Cloos avatar  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.