Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

Commit

Permalink
0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ungoldman committed Oct 4, 2016
0 parents commit 1621818
Show file tree
Hide file tree
Showing 12 changed files with 344 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- '6'
cache:
directories:
- node_modules
Binary file added assets/Icon-Template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Icon-Template@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const daemon = require('daemon')

if (process.argv.slice(2)[0] === '--debug') {
daemon({ stdout: 'inherit' })
} else {
daemon()
}

console.log(`Starting hi8 in daemon mode. PID: ${process.pid}`)

const spawn = require('child_process').spawn
const electron = require('electron')
const path = require('path')
const hi8 = path.join(__dirname, 'index.js')

let proc = spawn(electron, [ hi8 ], { stdio: 'inherit' })

proc.on('close', code => process.exit(code))
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# hi8 change log

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## 0.1.0

- alpha release (npm only)
54 changes: 54 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Contributing Guidelines

## Code of Conduct

This project is intended to be a safe, welcoming space for collaboration. All contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Thank you for being kind to each other!

## Contributions welcome!

**Before spending lots of time on something, ask for feedback on your idea first!**

Please search [issues](../../issues/) and [pull requests](../../pulls/) before adding something new! This helps avoid duplicating efforts and conversations.

This project welcomes any kind of contribution! Here are a few suggestions:

- **Ideas**: participate in an issue thread or start your own to have your voice heard.
- **Writing**: contribute your expertise in an area by helping expand the included content.
- **Copy editing**: fix typos, clarify language, and generally improve the quality of the content.
- **Formatting**: help keep content easy to read with consistent formatting.
- **Code**: help maintain and improve the project codebase.

## Code Style

[![standard][standard-image]][standard-url]

This repository uses [`standard`][standard-url] to maintain code style and consistency, and to avoid style arguments.

[standard-image]: https://cdn.rawgit.com/feross/standard/master/badge.svg
[standard-url]: https://github.com/feross/standard
[semistandard-image]: https://cdn.rawgit.com/flet/semistandard/master/badge.svg
[semistandard-url]: https://github.com/Flet/semistandard

## Project Governance

**This is an [OPEN Open Source Project](http://openopensource.org/).**

Individuals making significant and valuable contributions are given commit access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

### Rules

There are a few basic ground rules for collaborators:

1. **No `--force` pushes** or modifying the Git history in any way.
1. **Non-master branches** ought to be used for ongoing work.
1. **External API changes and significant modifications** ought to be subject to an **internal pull request** to solicit feedback from other contributors.
1. Internal pull requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor.
1. Contributors should attempt to adhere to the prevailing code style.

### Releases

Declaring formal releases remains the prerogative of the project maintainer.

### Changes to this arrangement

This is an experiment and feedback is welcome! This document may also be subject to pull requests or changes by contributors where you believe you have something valuable to add or change.
90 changes: 90 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
const { app, Menu, Tray } = require('electron')
const path = require('path')
const bg = require('himawari-bg')
const pkg = require('./package.json')

const second = 1000
const minute = second * 60

let tray = null
let timer = null
let shouldQuit = false

shouldQuit = app.makeSingleInstance((argv, wd) => {
console.log('Second app instance opened, but was prevented:', argv, wd)
})

if (shouldQuit) app.quit()
else app.on('ready', ready)

function ready () {
if (app.dock) app.dock.hide()

const iconPath = path.join(__dirname, 'assets', 'Icon-Template.png')

tray = new Tray(iconPath)

const contextMenu = Menu.buildFromTemplate([
{
label: `hi8 v${pkg.version}`,
enabled: false
},
{ type: 'separator' },
{
label: 'Update Desktop',
submenu: [
{
label: 'Now',
click: update
},
{ type: 'separator' },
{
label: 'Every 10 minutes',
type: 'radio',
click: update,
checked: true
},
{
label: 'Every hour',
type: 'radio',
click: update
},
{
label: 'Off',
type: 'radio',
click: update
}
]
},
{ type: 'separator' },
{
label: 'Quit',
click () { app.quit() }
}
])

tray.setToolTip('hi8')
tray.setContextMenu(contextMenu)
// setBackground()
resetTimer(minute * 10)
}

function update ({ label }) {
switch (label) {
case 'Now': setBackground(); break
case 'Every 10 minutes': resetTimer(minute * 10); break
case 'Every hour': resetTimer(minute * 60); break
default: resetTimer()
}
}

function resetTimer (ms) {
clearInterval(timer)
if (ms) timer = setInterval(setBackground, ms)
}

function setBackground () {
let outfile = path.join(app.getPath('pictures'), 'Himawari-8', `${Date.now()}.jpg`)

bg({ outfile })
}
7 changes: 7 additions & 0 deletions license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# [ISC License](https://spdx.org/licenses/ISC)

Copyright (c) 2016, Nate Goldman <ungoldman@gmail.com>

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
43 changes: 43 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "hi8",
"description": "See Earth from Himawari-8 on your desktop every 10 minutes.",
"version": "0.1.0",
"author": "Nate Goldman <ungoldman@gmail.com>",
"bin": {
"hi8": "./bin.js"
},
"bugs": {
"url": "https://github.com/ungoldman/hi8/issues"
},
"dependencies": {
"daemon": "^1.1.0",
"electron": "^1.4.2",
"himawari-bg": "^1.0.0"
},
"devDependencies": {
"standard": "^8.3.0"
},
"homepage": "https://github.com/ungoldman/hi8",
"keywords": [
"app",
"application",
"background",
"desktop",
"earth",
"himawari",
"himawari-8",
"image",
"satellite",
"wallpaper"
],
"license": "ISC",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/ungoldman/hi8.git"
},
"scripts": {
"start": "electron .",
"test": "standard"
}
}
89 changes: 89 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# hi8

See Earth from Himawari-8 on your desktop every 10 minutes.

[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]

[npm-image]: https://img.shields.io/npm/v/hi8.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/hi8
[travis-image]: https://img.shields.io/travis/ungoldman/hi8.svg?style=flat-square
[travis-url]: https://travis-ci.org/ungoldman/hi8
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard

## About

[Himawari 8](http://himawari8.nict.go.jp/) is a [geostationary](https://en.wikipedia.org/wiki/Geostationary_orbit) weather satellite deployed by the [Japan Meteorological Agency](http://www.jma.go.jp/jma/indexe.html). It takes photographs of Earth every 10 minutes.

`hi8` is a macOS menubar app that automatically sets the latest image from the Himawari 8 geostationary satellite as your desktop background every 10 minutes.

![screenshot](screenshot.jpg)

This project is alpha quality, please [report any bugs](../../issues)! (:grin: and maybe fix them! :grin:)

## Install

For now, you can install `hi8` via [`npm`](npmjs.com).

```
npm install -g hi8
```

In *the future*, `hi8` will be packaged as an app and downloadable via the [releases](../../releases) page.

**Warning: requires :zap: magick :zap:**

* [imagemagick](http://www.imagemagick.org/script/index.php)
* [graphicsmagick](http://www.graphicsmagick.org)

If you have [homebrew](http://brew.sh/) installed, you can `brew install imagemagick graphicsmagick`.

If you know of a better (dependency-free) way to process the images (or package `imagemagick` and `graphicsmagick` with the application), please [let me know](../../issues/new)!

## Usage

```
hi8
```

## Contributing

Contributions welcome! Please read the [contributing guidelines](contributing.md) first.

## Change Log

This project has a [change log](changelog.md)!

## Credit

Sunflower icon created by [Federico Panzano](https://thenounproject.com/panzano/) from [Noun Project](https://thenounproject.com/term/sunflower/120542/). Used under the [CC BY 3.0 US](https://creativecommons.org/licenses/by/3.0/us/) license.

## Resources

Here are some useful links if you're interested in learning more about the Himawari 8 satellite.

### Official

- [Himawari 8 Real-time Web](http://himawari8.nict.go.jp)
- [Himawari Data Guide](http://www.eorc.jaxa.jp/ptree/userguide.html)
- [Himawari 8/9 Standard Data User's Guide](http://www.data.jma.go.jp/mscweb/en/himawari89/space_segment/hsd_sample/HS_D_users_guide_en_v12.pdf)
- [JAXA account registration (for access to more data)](http://www.eorc.jaxa.jp/ptree/registration_top.html)

### Related Projects

- by [celoyd](https://github.com/celoyd):
- [Glittering Blue](http://glittering.blue)
- [celoyd/hi8](https://github.com/celoyd/hi8)
- [Himawari 8 animation tutorial](https://gist.github.com/celoyd/b92d0de6fae1f18791ef)
- [deband python script](https://gist.github.com/celoyd/a4dd9202fe5c7978b114)
- [makeaday bash script](https://gist.github.com/celoyd/c2293929ab3fe97ea597)
- [himawari.js](https://github.com/jakiestfu/himawari.js) by [jakiestfu](https://github.com/jakiestfu)
- [himawari-bg](https://github.com/ungoldman/himawari-bg) by [ungoldman](https://github.com/ungoldman)
- [himawari-urls](https://github.com/ungoldman/himawari-urls) by [ungoldman](https://github.com/ungoldman)
- [himawari-history](https://github.com/ungoldman/himawari-history) [ungoldman](https://github.com/ungoldman)

## License

[ISC](license.md)
Binary file added screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1621818

Please sign in to comment.