vaccine-spotter 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vaccine-spotter.rb +41 -4
- metadata +22 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef4472babd675e97bdda96d6a52bccee08799429753ea166542b34069c9ae150
|
4
|
+
data.tar.gz: ff3875ce3d6bef34cc1941e9990159ba7dffe048de981176b07163424a1f9fc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c2783d31fc893a1a192523b2fad3d32db6d2e44525a252a44665cb68371c57bb0a73fac999c513787f41c349857fe2ee082e786fdb63bd0ac1049c77022053b
|
7
|
+
data.tar.gz: 33c9366a86cdef1c192c2ff11598517400ba3177109a47763a27478cb6e904aec32f749fc57662763d4ce3abe7058b47a1589f0eb2bbd6f016fa6ff3115bf252
|
data/lib/vaccine-spotter.rb
CHANGED
@@ -11,6 +11,7 @@ require "toml"
|
|
11
11
|
require "tty-config"
|
12
12
|
require "tty-prompt"
|
13
13
|
require "launchy"
|
14
|
+
require "feep"
|
14
15
|
|
15
16
|
pastel = Pastel.new
|
16
17
|
config = TTY::Config.new
|
@@ -40,6 +41,12 @@ if !config.exist?
|
|
40
41
|
config.set(:vaccine_types, value: set_vaccine_types)
|
41
42
|
set_refresh_rate = prompt.ask("How often should the script check for updates? (seconds)", convert: :int, required: true)
|
42
43
|
config.set(:refresh_rate, value: set_refresh_rate)
|
44
|
+
set_play_sound = prompt.yes?("Would you like to play a sound when availability is found?", required: true)
|
45
|
+
config.set(:sound, :play, value: set_play_sound)
|
46
|
+
if set_play_sound
|
47
|
+
set_repeat_sound = prompt.ask("How many times should the sound repeat?", convert: :int, required: true)
|
48
|
+
config.set(:sound, :repeat, value: set_repeat_sound)
|
49
|
+
end
|
43
50
|
puts "Perfect; writing to `~/.config/vaccine-spotter.toml`…"
|
44
51
|
config.write
|
45
52
|
end
|
@@ -49,6 +56,27 @@ zips = config.read["zips"]
|
|
49
56
|
state = config.read["state"]
|
50
57
|
refresh_rate = config.read["refresh_rate"].to_i
|
51
58
|
vaccine_types = config.read["vaccine_types"]
|
59
|
+
play_sound = config.read["sound"]["play"]
|
60
|
+
repeat_sound = config.read["sound"]["repeat"].to_i
|
61
|
+
|
62
|
+
def pluralize(number, text)
|
63
|
+
return text + 's' if number != 1
|
64
|
+
text
|
65
|
+
end
|
66
|
+
|
67
|
+
def blues_scale
|
68
|
+
Feep::Base.new(
|
69
|
+
:freq_or_note => 'E4',
|
70
|
+
:scale => 'blues',
|
71
|
+
:waveform => 'triangle',
|
72
|
+
:volume => 0.8,
|
73
|
+
:duration => 100,
|
74
|
+
:save => false,
|
75
|
+
:verbose => false,
|
76
|
+
:visual_cue => false,
|
77
|
+
:usage => nil
|
78
|
+
)
|
79
|
+
end
|
52
80
|
|
53
81
|
puts
|
54
82
|
print pastel.bold "vaccinespotter.org CLI notifier thing"
|
@@ -61,6 +89,11 @@ puts pastel.dim ", by Jack MapelLentz (jltml.me)"
|
|
61
89
|
puts pastel.dim "This script uses the wonderful vaccinespotter.org, by Nick Muerdter (github.com/GUI)"
|
62
90
|
puts "Checking #{pastel.underline zips.length} zip codes in #{pastel.underline state} every #{pastel.underline refresh_rate} seconds"
|
63
91
|
puts "Filtering appointments for #{pastel.underline vaccine_types.to_s.tr("[]\"", "")}"
|
92
|
+
if play_sound
|
93
|
+
puts "Playing a sound #{pastel.underline repeat_sound} #{pluralize(repeat_sound, "time")} when availability is found"
|
94
|
+
else
|
95
|
+
puts "#{pastel.underline "Not"} playing a sound when availability is found"
|
96
|
+
end
|
64
97
|
puts pastel.dim "Press control-C to quit"
|
65
98
|
|
66
99
|
excluded = Array.new
|
@@ -85,15 +118,19 @@ loop do
|
|
85
118
|
puts "- #{pastel.green.bold current["city"]} #{pastel.green.bold current["provider_brand_name"]}: #{current["url"]}"
|
86
119
|
puts " - #{current["appointment_vaccine_types"]} as of #{Time.parse(current["appointments_last_fetched"]).localtime.strftime("%H:%M:%S")}"
|
87
120
|
TerminalNotifier.notify("#{current["provider_brand_name"]} - #{current["city"]}", :title => "vaccine-spotter", :open => "#{current["url"]}")
|
121
|
+
if play_sound
|
122
|
+
repeat_sound.times do
|
123
|
+
blues_scale
|
124
|
+
sleep 0.5
|
125
|
+
end
|
126
|
+
end
|
88
127
|
excluded.append current["id"].to_i
|
89
128
|
end
|
90
129
|
end
|
91
130
|
|
92
131
|
print pastel.dim "Checked at #{Time.now.strftime("%H:%M:%S")} on #{Time.now.strftime("%Y-%m-%d")}"
|
93
|
-
if number_excluded
|
94
|
-
print pastel.dim " (#{number_excluded} checked location excluded)"
|
95
|
-
elsif number_excluded != 0
|
96
|
-
print pastel.dim " (#{number_excluded} checked locations excluded)"
|
132
|
+
if number_excluded != 0
|
133
|
+
print pastel.dim " (#{number_excluded} checked #{pluralize(number_excluded, "location")} excluded)"
|
97
134
|
end
|
98
135
|
puts
|
99
136
|
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vaccine-spotter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack MapelLentz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2021-04-15 00:00:00.000000000 Z
|
@@ -108,12 +108,24 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.5'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: feep
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.2.2
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.2.2
|
111
125
|
description: This gem will notify you when COVID-19 vaccine appointments are available
|
112
|
-
matching certain criteria (a list of zip codes, type of vaccine, etc)
|
113
|
-
|
114
|
-
|
115
|
-
times.
|
116
|
-
email:
|
126
|
+
matching certain criteria (a list of zip codes, type of vaccine, etc) using the
|
127
|
+
very beta API from the absolutely wonderful vaccinespotter.org.
|
128
|
+
email:
|
117
129
|
executables:
|
118
130
|
- vaccine-spotter
|
119
131
|
extensions: []
|
@@ -125,7 +137,7 @@ homepage: https://github.com/jltml/vaccine-spotter-cli
|
|
125
137
|
licenses:
|
126
138
|
- MIT
|
127
139
|
metadata: {}
|
128
|
-
post_install_message:
|
140
|
+
post_install_message:
|
129
141
|
rdoc_options: []
|
130
142
|
require_paths:
|
131
143
|
- lib
|
@@ -140,8 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
152
|
- !ruby/object:Gem::Version
|
141
153
|
version: '0'
|
142
154
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
144
|
-
signing_key:
|
155
|
+
rubygems_version: 3.0.3
|
156
|
+
signing_key:
|
145
157
|
specification_version: 4
|
146
158
|
summary: Get notified of vaccine availability
|
147
159
|
test_files: []
|