astropanel 2.5 → 2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/astropanel +23 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba68a8b88ebc1705f759ebf2b93bb0bfc8f13a0fc3ee75b8223e0c0f46f7e0d5
4
- data.tar.gz: 7cd712f5bbc7951d13c6b6f1394984950bc732970ce593b21a2d78d1d94f4ad4
3
+ metadata.gz: 939fa439565527c2c8b9f0ce4e1e13ab008bd3c23f153efd9e2e01d65a50fe45
4
+ data.tar.gz: 368bbb21a445bfff885cbf6a9b1f526fe11531cdb9be1ad0ad02760ca5818416
5
5
  SHA512:
6
- metadata.gz: 072c8766c42c619a0999c8aa715bfc35e696f3798c1db3f0124c76b8f3531059369c0826dde7b42745ba7c7dbf925c9edfddc543ad68f1e2301bc6146955b784
7
- data.tar.gz: 70cb74c006fc864713f93f67615339fef2cc90f8e4776b355797c79ea80bd0fd66feb02d4357b1f643025fa31cfde99df468337590cf900d287a383fcc62b069
6
+ metadata.gz: f393f7af8500905358502ef1a78b1e9c3808e883f8febc21bec01f84221b101fd00a305a5e7c6d522baf1fcf1343e9f9c42765fc542e2b673d925739880fa272
7
+ data.tar.gz: dd1447a1e2c3cc56f4e4d30e5284d0ceef71bc45e2dae203017b054789e4c3bbcb6ef826a682751bb39198a543c26203b03088571765ede52211e1fc1b5c5148
data/bin/astropanel CHANGED
@@ -14,7 +14,7 @@
14
14
  # for any damages resulting from its use. Further, I am under no
15
15
  # obligation to maintain or extend this software. It is provided
16
16
  # on an 'as is' basis without any expressed or implied warranty.
17
- # Version: 2.5: Bug fix
17
+ # Version: 2.6: Bug fix
18
18
 
19
19
  # LOAD MODULES {{{1
20
20
  require 'io/console'
@@ -760,10 +760,7 @@ class AstroPanelApp
760
760
  @footer.say(cmds.ljust(cols))
761
761
  end
762
762
 
763
- # Redraw the left‐pane list of weather + visibility blocks,
764
- # Redraw the left‐pane list of weather + visibility blocks,
765
- # safely handling missing planet data and converting rise/set to integers
766
- def update_left
763
+ def update_left # {{{2
767
764
  date_o = ''
768
765
  date_n = ''
769
766
 
@@ -930,8 +927,8 @@ class AstroPanelApp
930
927
  update_main
931
928
  end
932
929
 
933
- # Fetch weather from met.no, but never let network errors crash the app
934
- def get_weather
930
+ def get_weather # {{{2
931
+ # Fetch weather from met.no, but never let network errors crash the app
935
932
  uri = URI("https://api.met.no/weatherapi/locationforecast/2.0/complete?lat=#{@lat}&lon=#{@lon}")
936
933
  req = Net::HTTP::Get.new(uri)
937
934
  req['User-Agent'] = 'astropanel/1.0 g@isene.com'
@@ -1014,25 +1011,34 @@ class AstroPanelApp
1014
1011
  end
1015
1012
 
1016
1013
  def get_planets # {{{2
1014
+ # Build @planets entries for each unique date in @weather
1017
1015
  @planets.clear
1018
- 12.times do |i|
1019
- date = (Date.today + i).strftime('%F')
1020
- ep = Ephemeris.new(date,@lat,@lon,@tz.to_i)
1016
+
1017
+ # Collect exactly the dates we need (in first-seen order)
1018
+ dates = @weather.map { |w| w[:date] }.uniq
1019
+
1020
+ dates.each do |date|
1021
+ # Compute a fresh Ephemeris for that date
1022
+ ep = Ephemeris.new(date, @lat, @lon, @tz.to_i)
1023
+
1024
+ # Start with the printed table + moon phase info
1021
1025
  entry = {
1022
1026
  table: ep.print,
1023
- mphase: ep.mphase, # e.g. 67.4
1024
- mph_s: ep.mph_s # e.g. "Waxing gibbous"
1027
+ mphase: ep.mphase,
1028
+ mph_s: ep.mph_s
1025
1029
  }
1026
- Ephemeris::BODY_ORDER.each do |b|
1027
- arr = ep.send(b)
1028
- entry[:"#{b}_rise"] = arr[5]
1029
- entry[:"#{b}_set"] = arr[7]
1030
+
1031
+ # Add rise/set times for each body
1032
+ Ephemeris::BODY_ORDER.each do |body|
1033
+ arr = ep.send(body)
1034
+ entry[:"#{body}_rise"] = arr[5]
1035
+ entry[:"#{body}_set"] = arr[7]
1030
1036
  end
1037
+
1031
1038
  @planets[date] = entry
1032
1039
  end
1033
1040
  end
1034
1041
 
1035
-
1036
1042
  def get_events # {{{2
1037
1043
  @events.clear
1038
1044
  uri = URI(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astropanel
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.5'
4
+ version: '2.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -28,7 +28,7 @@ description: 'This program shows essential data in order to plan your observatio
28
28
  9 days weather forecast, full ephemeris for the Sun, the Moon and all major planets,
29
29
  complete with graphic representation of rise/set times, detailed info for each day
30
30
  with important astronomical events, star chart displayed in the terminal and more.
31
- New in 2.0: Full rewrite using rcurses (https://github.com/isene/rcurses). 2.5:
31
+ New in 2.0: Full rewrite using rcurses (https://github.com/isene/rcurses). 2.6:
32
32
  Bug fix.'
33
33
  email: g@isene.com
34
34
  executables: