himawari 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62481fb8ecb232de59856604c05dea5b09f65ecc5b799892861548ff02d973dc
4
- data.tar.gz: 1572d43032c289465c7af40f119a94fd6e2837394daeff5bdd26d2b5b362401e
3
+ metadata.gz: 24e2776864e4a10f4b535404d68c4d8127591e09c8306adbbddf3af19b768127
4
+ data.tar.gz: e1ca4f76fef147be6ec75ab71ddacd907339671bb981c16d9c25387c366d70b5
5
5
  SHA512:
6
- metadata.gz: 4a8b27e15225991ee80a77117abc18b04939ee4870cf90b70b11a7160631097e00bfdf4dc4b61d6cc480e5743970f0e70c5d0634a5cce0d6c1cfd1a1ceb027af
7
- data.tar.gz: 9b52bad56dfc83a3edb2a5e255d9bd6d009072c607435e21239c53de5c61ae77dfb3568294d553a357b2e3e2e47946d10e4a1549c9c217b607cd1378cd315779
6
+ metadata.gz: 556fc58c1a432621795de4dfded079dfffa163a24624abee86aa45158105abae73caa1741f1c33583141712e83781e54a5a9e738ec7df613d84dc8045cba8e1f
7
+ data.tar.gz: 6c0e72388df69ce752e839d9d54eabf011c7a03b2c5f59767e9f7d3e3b3a452877fba2f2818139fda24677d1bfda340e7ff8941ff291ed80954fcea5abb667d4
@@ -0,0 +1,8 @@
1
+ # 0.1.1
2
+ - Updated Readme
3
+ - Added changelog
4
+ - Set a minimum Ruby version to >=2.5
5
+ - Removed *.png files from the gem to reduce its size
6
+
7
+ # 0.1.0
8
+ - Initial release
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- himawari (0.1.0)
4
+ himawari (0.1.1)
5
5
  httparty (~> 0.17.3)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,3 +1,12 @@
1
+ # TOC
2
+ - [about](#himawari)
3
+ - [installing](#installation)
4
+ - [using](#usage)
5
+ - [todo](#todo)
6
+ - [development](#development)
7
+ - [contributing](#contributing)
8
+ - [license](#license)
9
+
1
10
  # himawari
2
11
  Access images from the [himawari8 weather satellite](https://himawari8.nict.go.jp)] (courtesy of NICT) and compose near real-time desktop backgrounds of Earth or use the high-res images for other personal uses. For example....
3
12
  ![full globe](doc/img/h_2020-06-01T0100.png)
@@ -26,13 +35,13 @@ or Linux: run `bin/setup`
26
35
 
27
36
  # Usage
28
37
 
29
- You can use it as a CLI executable, or as a library.
38
+ You can use it as a stand alone CLI executable, or as a Library.
30
39
 
31
40
  *RUN EXAMPLE*: `himawari -w /home/User/himawari -d /home/User/Pictures/live -r 4 -f top -m day -v`
32
41
 
33
42
  To set cron (with all the supplied arguments):
34
43
  `himawari -w /home/User/himawari -d /home/User/Pictures/live -r 4 -f top -m day -v -c set`
35
- and then to remove it from cron:
44
+ and then to remove it from cron (please note the arguments must be the same as the ones used during `cron set`-ting, otherwise it won't be removed):
36
45
  `himawari -w /home/User/himawari -d /home/User/Pictures/live -r 4 -f top -m day -v -c clear`
37
46
 
38
47
  ### Details
@@ -40,12 +49,49 @@ and then to remove it from cron:
40
49
  ![a tile](doc/img/t_2020-12-01T0410-1_0.png)
41
50
  - Can change the resolution. Default is "2", smallest. Maximum is "20". It will produce an jpg of ~200MB in size for the full planet. The allowed steps are [2, 4, 8, 16, 20]. Resolution of 2 means that the image is composed of *2* tiles across, so the full image becomes 1100px wide/high. An image of resolution *factor 4* is then 550 * 4 = 2200px across. And the maximum one is 20 * 550 = 11000px X 11000px!!!!!
42
51
  - Since the images can be kinda big, we can customize which part of the planet we want to see: `top`, `full` planet, or bottom (`low`).
43
- - When using the `autorun` option (it's the method that command line utility uses), we save the last 48hrs in a folder (`working_dir`). We can then have 2 options: either show what is `now` outside, or! cycle the last complete 24 hours with a new background photo every 2 minutes? Because the images are all downloaded at once, and then an incremental download of one photo as needed, the internet traffic is relatively reasonable. Cycling the background photos doesn't need to access internet or download anything.
52
+ - When using the `autorun` option (it's the method that command line utility uses), we save the last 48hrs in a folder (`workdir`). We can then have 2 options: either show what is `now` outside, or! cycle the last complete 24 hours with a new background photo every 2 minutes? Because the images are all downloaded at once, and then an incremental download of one photo as needed, the internet traffic is relatively reasonable. Cycling the background photos doesn't need to access internet or download anything.
53
+ - An easy way to use the script: set the `himawari` into cron with whatever arguments you want it to use, and it will automatically update the photos in the destination folder every 2 minutes. Then, just use the OS's Desktop Settings to do a "desktop slideshow" using pictures in the `destination` folder.
54
+ - Another way to use it can be: download whichever images you like into the `workdir`, and set the System's Desktop Settings to do a slideshow desktop background from there. The tricky part here is that the OS does not always pick up new images that are downloaded into the `workdir` right away. (maybe until a restart or something.) Also, the slideshows are randomized by default, so the picture of the planet could be jumping to random time stamps.
44
55
 
45
56
  - 1. do NOT attempt to fetch data from black listed WiFis
46
57
  - 2. if no internet, just show last available data
47
58
  - 3. keep only 1 day's worth of images (~144 photos)
48
- - 4. check for `No Image` images and skip those (until? if?) they become available
59
+ - 4. check for `No Image` images and skip those (until? if? --so far, I haven't noticed that they ever get changed) they become available. (There are tricky tiles that are literally just black squares with the words "No Image" written on them. They probably happen due to the Sun being in the camera's view. Or maybe because of Aliens. Or evil Government cover ups? Either way, these tiles are not useful to us, and are skipped.)
60
+ ![no image](lib/himawari/no_image.png)
61
+
62
+ ### Full list of arguments for the command line
63
+ `himawari -h`
64
+ - `-f, --focus STRING` Which section of the planet to focus on? Valid values are `full`, `top`, `mid`, `low`. Default is `top`. The script takes a common monitor's aspect ratio (16x9) and does its best to keep the cropped image as close to that AR as possible. It will not, however, crop off parts of the downloaded tiles, so the final image usually ends up with a wider (more squarish) aspect ratio than 16x9. (But never narrower.)
65
+ - `-m, --mode STRING` Valid values are `day` (cycles pics to the `destination` folder from the most recent day) or `live` (copies the latest photo downloaded to `destination`) Default is `day`. Right now, it is hard-coded to switch the photo each 2 minutes in the `destination` folder. With 144 photos to choose from in a 24 hour period, this ends up cycling the view of the planet 5 times each day.
66
+ - `-r, --resolution INT` Adjust the resolution factor of the downloaded image. Valid numbers are 2, 4, 8, 16, 20. 20 is the highest resolution and 2 is the default. For a 4k-monitor a setting of 4 seems sufficient.
67
+ - `-d, --destination PATH` The folder where to copy a background image. If left blank, images will just be downloaded to `workdir`.
68
+ - `-w, --workdir PATH` The folder where to save all the downloaded pics. If left blank, images will be saved to the `./data` directory relative to your current path.(pwd)
69
+ - `-b, --blacklist STRING,STRING...` Blacklist SSIDs of networks from which we do not want to go online to download new images.
70
+ - `-c, --cron STRING` Can `set`/`clear` cron with the specified params, so we can update/download the images automatically
71
+ - `-v, --verbose` Increase verbosity: mostly for debugging
72
+ - `-s, --schedule` Flag for determining when the script is run by schedule/automatically. Don't worry about this one, it is set automatically when the script is added to cron.
73
+
74
+ ### Usage as a library
75
+ ```
76
+ require 'himawari'
77
+
78
+ # there are basically 2 useful methods exposed to play around with.
79
+ # To get 1 picture closest to the provided timestamp:
80
+ Himawari.get_pic(datetime: timestamp, workdir: '/home/user/himawari_pics')
81
+
82
+ # And to get a bunch of pics between 2 date-times:
83
+ params = { from: timestamp1, to: timestamp2, workdir: workdir }
84
+ Himawari.get_pics(params)
85
+ ```
86
+ - `timestamp` can be either a string (like '2020-06-01 12:30') or a `Time` object.
87
+ - pretty much all of the `params` are optional and will be filled in with some defaults (same as the ones mentioned above) if left blank.
88
+ - the timestamps' defaults are set like this: `round_down_to_nearest_10_minute_mark(now - 10.minutes)`. So, if it is `2020-12-01 14:19` right now, default timestamp would be `2020-12-01 14:00`)
89
+ - these methods return `true` on success, `false` on failure.
90
+ - Feel free to check out some other usages in the `./specs`
91
+
92
+ # TODO
93
+ - improve documentation
94
+ - add [Windows support](https://github.com/engura/himawari/issues/1)?
49
95
 
50
96
  # Development
51
97
  After checking out the repo, doing the steps in `installation` above and messing around with the code, run `rake test` and `rubocop` to use the tests and make sure everything is ok. To run a specific test, use `rake test TEST=spec/test_base.rb TESTOPTS="--name=test_bad_params --seed=1234"` and as for rubocop: `rubocop lib/himawari/base.rb`
@@ -2,22 +2,24 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'himawari'
5
- s.version = '0.1.0'
5
+ s.version = '0.1.1'
6
6
  s.date = '2020-12-15'
7
7
  s.summary = 'Grabs latest images from the himawari8 weather satellite'
8
- s.description = 'Makes pretty, high-res backgrounds from the real-time photos of Earth by Himawari8,' \
8
+ s.description = 'Makes pretty, high-res backgrounds from the real-time photos of Earth by Himawari8, ' \
9
9
  'or is intended for similar personal usage. Please see the readme for more!'
10
10
  s.authors = ['engura']
11
11
  s.email = ['engura@gmail.com']
12
12
  s.homepage = 'https://github.com/engura/himawari'
13
13
  s.license = 'MIT'
14
14
 
15
- s.files = `git ls-files`.split
15
+ s.files = `git ls-files -- . ':!:*.png'`.split
16
16
  s.bindir = 'exe'
17
17
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  s.test_files = s.files.grep(%r{^(tests|spec|features)/})
19
19
  s.require_paths = ['lib']
20
20
 
21
+ s.required_ruby_version = '>= 2.5'
22
+
21
23
  s.add_runtime_dependency 'httparty', '~> 0.17.3'
22
24
 
23
25
  s.add_development_dependency 'bundler', '~> 2.1.4'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: himawari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - engura
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: 13.0.1
83
83
  description: Makes pretty, high-res backgrounds from the real-time photos of Earth
84
- by Himawari8,or is intended for similar personal usage. Please see the readme for
84
+ by Himawari8, or is intended for similar personal usage. Please see the readme for
85
85
  more!
86
86
  email:
87
87
  - engura@gmail.com
@@ -92,22 +92,19 @@ extra_rdoc_files: []
92
92
  files:
93
93
  - ".gitignore"
94
94
  - ".rubocop.yml"
95
+ - CHANGELOG.md
95
96
  - Gemfile
96
97
  - Gemfile.lock
97
98
  - LICENSE
98
99
  - README.md
99
100
  - Rakefile
100
101
  - bin/setup
101
- - doc/img/h_2020-06-01T0100.png
102
- - doc/img/h_2020-11-29T0110.png
103
- - doc/img/t_2020-12-01T0410-1_0.png
104
102
  - exe/himawari
105
103
  - himawari.gemspec
106
104
  - lib/himawari.rb
107
105
  - lib/himawari/base.rb
108
106
  - lib/himawari/download.rb
109
107
  - lib/himawari/net_utils.rb
110
- - lib/himawari/no_image.png
111
108
  - lib/himawari/os_utils.rb
112
109
  - lib/himawari/process.rb
113
110
  - spec/test_base.rb
@@ -127,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
124
  requirements:
128
125
  - - ">="
129
126
  - !ruby/object:Gem::Version
130
- version: '0'
127
+ version: '2.5'
131
128
  required_rubygems_version: !ruby/object:Gem::Requirement
132
129
  requirements:
133
130
  - - ">="
Binary file