astropanel 4.1.0 → 4.1.1
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.
- checksums.yaml +4 -4
- data/bin/astropanel +51 -18
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d9868bc13e6a6ee12c977d549646731414134fa1a3efcc369011f4ab905ac19e
|
|
4
|
+
data.tar.gz: eeecdb2b16dafa1d5fb7c7eed003786ade001843be356051ccaa3d9093e19c4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f63cb7786331c386cb05cf098fb70f6e22722e2ec56c020d84fac57840769420342d16f36cd4335e199044bb1aa70d3f8880e97c3a9496509659c28d0b56fed0
|
|
7
|
+
data.tar.gz: 3363eab644b0fde17f2dbf0c4f5b9d2982e48527edb9355510ae3fc5c2566d90cedbec9fd76fb84719cdc733bd11a73d8042ad46e81b7758d52242720defd94e
|
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: 4.1.
|
|
17
|
+
# Version: 4.1.1: Add network error handling & input validation
|
|
18
18
|
# for Ruby 3.4+ compatibility
|
|
19
19
|
|
|
20
20
|
# LOAD MODULES {{{1
|
|
@@ -559,19 +559,19 @@ class AstroPanelApp
|
|
|
559
559
|
end
|
|
560
560
|
end
|
|
561
561
|
|
|
562
|
-
# 8) Bortle scale (
|
|
562
|
+
# 8) Bortle scale (1..9) {{{3
|
|
563
563
|
loop do
|
|
564
|
-
input = @footer.ask("Bortle scale (
|
|
564
|
+
input = @footer.ask("Bortle scale (1..9): ", "")
|
|
565
565
|
if input.strip.empty?
|
|
566
566
|
@footer.say("Bortle value is required")
|
|
567
567
|
next
|
|
568
568
|
end
|
|
569
569
|
val = input.to_f
|
|
570
|
-
if (
|
|
570
|
+
if (1.0..9.0).include?(val)
|
|
571
571
|
@bortle = val
|
|
572
572
|
break
|
|
573
573
|
else
|
|
574
|
-
@footer.say("Enter a number between
|
|
574
|
+
@footer.say("Enter a number between 1 and 9")
|
|
575
575
|
end
|
|
576
576
|
end
|
|
577
577
|
end
|
|
@@ -667,7 +667,7 @@ class AstroPanelApp
|
|
|
667
667
|
# Display new image using termpix (same positioning as original)
|
|
668
668
|
@termpix.show(file,
|
|
669
669
|
x: @main.x - 1,
|
|
670
|
-
y:
|
|
670
|
+
y: 27,
|
|
671
671
|
max_width: @main.w - 3,
|
|
672
672
|
max_height: rows - 26)
|
|
673
673
|
@current_image = file
|
|
@@ -719,9 +719,15 @@ class AstroPanelApp
|
|
|
719
719
|
end
|
|
720
720
|
|
|
721
721
|
def apod # {{{2
|
|
722
|
-
|
|
722
|
+
begin
|
|
723
|
+
html = Net::HTTP.get(URI('https://apod.nasa.gov/apod/astropix.html'))
|
|
724
|
+
rescue SocketError, Socket::ResolutionError, Timeout::Error,
|
|
725
|
+
Net::OpenTimeout, Net::ReadTimeout, Errno::ECONNREFUSED,
|
|
726
|
+
Errno::EHOSTUNREACH, Errno::ENETUNREACH, OpenURI::HTTPError => e
|
|
727
|
+
return @footer.say("APOD unavailable (network error: #{e.class})")
|
|
728
|
+
end
|
|
723
729
|
img = html[/IMG SRC="(.*?)"/,1]
|
|
724
|
-
return @footer.say("
|
|
730
|
+
return @footer.say("Could not parse APOD URL") unless img
|
|
725
731
|
|
|
726
732
|
full = "https://apod.nasa.gov/apod/#{img}"
|
|
727
733
|
tmp = "/tmp/apod.jpg"
|
|
@@ -731,10 +737,10 @@ class AstroPanelApp
|
|
|
731
737
|
@current_image = tmp
|
|
732
738
|
show_image(@current_image)
|
|
733
739
|
else
|
|
734
|
-
@footer.say("
|
|
740
|
+
@footer.say("Empty apod.jpg")
|
|
735
741
|
end
|
|
736
742
|
else
|
|
737
|
-
@footer.say("
|
|
743
|
+
@footer.say("APOD download failed")
|
|
738
744
|
end
|
|
739
745
|
end
|
|
740
746
|
|
|
@@ -844,8 +850,9 @@ class AstroPanelApp
|
|
|
844
850
|
if @main.update
|
|
845
851
|
update_main
|
|
846
852
|
@main.update = false
|
|
853
|
+
show_image(@current_image) if @current_image
|
|
847
854
|
end
|
|
848
|
-
|
|
855
|
+
|
|
849
856
|
update_titles # Always update titles as they're lightweight
|
|
850
857
|
end
|
|
851
858
|
|
|
@@ -1056,13 +1063,31 @@ class AstroPanelApp
|
|
|
1056
1063
|
when 'END' then @index = @weather.size - 1
|
|
1057
1064
|
when '?' then @main.say(HELP); getchr; @main.update = true
|
|
1058
1065
|
when 'l' then @loc = @footer.ask('Loc? ', @loc); @header.update = @footer.update = true
|
|
1059
|
-
when 'a'
|
|
1060
|
-
|
|
1066
|
+
when 'a'
|
|
1067
|
+
val = @footer.ask('Lat? (-90..90) ', @lat.to_s).to_f
|
|
1068
|
+
if (-90.0..90.0).include?(val)
|
|
1069
|
+
@lat = val; @header.update = @footer.update = true
|
|
1070
|
+
else
|
|
1071
|
+
@footer.say("Latitude must be -90..90"); @footer.update = true
|
|
1072
|
+
end
|
|
1073
|
+
when 'o'
|
|
1074
|
+
val = @footer.ask('Lon? (-180..180) ', @lon.to_s).to_f
|
|
1075
|
+
if (-180.0..180.0).include?(val)
|
|
1076
|
+
@lon = val; @header.update = @footer.update = true
|
|
1077
|
+
else
|
|
1078
|
+
@footer.say("Longitude must be -180..180"); @footer.update = true
|
|
1079
|
+
end
|
|
1061
1080
|
when 'c' then @cloudlimit = @footer.ask('Maximum Cloud coverage? ', @cloudlimit.to_s).to_i; @footer.update = true
|
|
1062
1081
|
when 'h' then @humiditylimit = @footer.ask('Maximum Humidity? ', @humiditylimit.to_s).to_i; @footer.update = true
|
|
1063
1082
|
when 't' then @templimit = @footer.ask('Minimum Temperature? ', @templimit.to_s).to_i; @footer.update = true
|
|
1064
1083
|
when 'w' then @windlimit = @footer.ask('Maximum Wind? ', @windlimit.to_s).to_i; @footer.update = true
|
|
1065
|
-
when 'b'
|
|
1084
|
+
when 'b'
|
|
1085
|
+
val = @footer.ask('Bortle? (1..9) ', @bortle.to_s).to_f
|
|
1086
|
+
if (1.0..9.0).include?(val)
|
|
1087
|
+
@bortle = val; @footer.update = true
|
|
1088
|
+
else
|
|
1089
|
+
@footer.say("Bortle must be 1..9"); @footer.update = true
|
|
1090
|
+
end
|
|
1066
1091
|
when 'e' then show_all_events; @main.update = true
|
|
1067
1092
|
when 's' then starchart; @main.update = true
|
|
1068
1093
|
when 'S' then system("xdg-open /tmp/starchart.jpg &")
|
|
@@ -1197,7 +1222,14 @@ class AstroPanelApp
|
|
|
1197
1222
|
"https://in-the-sky.org/rss.php?feed=dfan"\
|
|
1198
1223
|
"&latitude=#{@lat}&longitude=#{@lon}&timezone=#{@loc}"
|
|
1199
1224
|
)
|
|
1200
|
-
|
|
1225
|
+
begin
|
|
1226
|
+
raw = Net::HTTP.get(uri)
|
|
1227
|
+
rescue SocketError, Socket::ResolutionError, Timeout::Error,
|
|
1228
|
+
Net::OpenTimeout, Net::ReadTimeout, Errno::ECONNREFUSED,
|
|
1229
|
+
Errno::EHOSTUNREACH, Errno::ENETUNREACH, OpenURI::HTTPError => e
|
|
1230
|
+
@footer.say("Events unavailable (network error: #{e.class})")
|
|
1231
|
+
return
|
|
1232
|
+
end
|
|
1201
1233
|
|
|
1202
1234
|
raw.scan(/<item>(.*?)<\/item>/m).each do |match|
|
|
1203
1235
|
item = match.first
|
|
@@ -1233,9 +1265,10 @@ end
|
|
|
1233
1265
|
# START PROGRAM {{{1
|
|
1234
1266
|
begin
|
|
1235
1267
|
# a single quick DNS + TCP check
|
|
1236
|
-
TCPSocket.new('api.met.no', 443).close
|
|
1237
|
-
rescue SocketError, Socket::ResolutionError
|
|
1238
|
-
|
|
1268
|
+
Timeout.timeout(5) { TCPSocket.new('api.met.no', 443).close }
|
|
1269
|
+
rescue SocketError, Socket::ResolutionError, Timeout::Error,
|
|
1270
|
+
Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ENETUNREACH => e
|
|
1271
|
+
$stderr.puts "Cannot reach api.met.no, network appears down (#{e.class}: #{e.message})"
|
|
1239
1272
|
$stdin.cooked!
|
|
1240
1273
|
$stdin.echo = true
|
|
1241
1274
|
exit!
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: astropanel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.1.
|
|
4
|
+
version: 4.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geir Isene
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rcurses
|
|
@@ -38,7 +38,7 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0.1'
|
|
41
|
-
description: 'AstroPanel v4.1.
|
|
41
|
+
description: 'AstroPanel v4.1.1: Modern image display using termpix gem with Sixel
|
|
42
42
|
and w3m protocol support. This program shows essential data in order to plan your
|
|
43
43
|
observations: 9 days weather forecast, full ephemeris for the Sun, the Moon and
|
|
44
44
|
all major planets, complete with graphic representation of rise/set times, detailed
|