vaccine-spotter 0.2.0 → 0.2.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vaccine-spotter.rb +41 -4
  3. metadata +22 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee6ea9690334fd97f64cccafb4d4a22a59d36ba4e6b999a52b77f5f4128d9cd8
4
- data.tar.gz: afd75efd6acd1ce70c8a73cbd7ed401e1cf4a2fe650efabec901c599a2a012fd
3
+ metadata.gz: ef4472babd675e97bdda96d6a52bccee08799429753ea166542b34069c9ae150
4
+ data.tar.gz: ff3875ce3d6bef34cc1941e9990159ba7dffe048de981176b07163424a1f9fc7
5
5
  SHA512:
6
- metadata.gz: 12ddd6dcf1befc1d1a2379e9b614e7508988194304016c80115788c546bab9d85f43c89f663dee02d85244abd9c2c2920d615e406529bf7c2b2c93b10c1a6127
7
- data.tar.gz: d7552b9a5621c004d52a21c8eff20cb3e2663a0139d6fe47126a460c82d85685a37b820ca72e910b540a4a8ee827cee36ba43cc09ed5b1e9bfd4bc271327c3d7
6
+ metadata.gz: 0c2783d31fc893a1a192523b2fad3d32db6d2e44525a252a44665cb68371c57bb0a73fac999c513787f41c349857fe2ee082e786fdb63bd0ac1049c77022053b
7
+ data.tar.gz: 33c9366a86cdef1c192c2ff11598517400ba3177109a47763a27478cb6e904aec32f749fc57662763d4ce3abe7058b47a1589f0eb2bbd6f016fa6ff3115bf252
@@ -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 == 1
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.0
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). It currently
113
- pretty much just wraps the very beta API from the absolutely wonderful vaccinespotter.org,
114
- though I hope to add my own website scraping soon too so as to improve response
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.2.16
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: []