[bitbar] rm

pull/41/head
Alpha Chen 3 years ago
parent c66f0aff43
commit 43226c2936

2
bitbar/.gitignore vendored

@ -1,2 +0,0 @@
vendor
enabled

@ -1,30 +0,0 @@
#!/usr/bin/env ruby
require 'open-uri'
require 'rexml/document'
COLOR_MAP = {
arrivalStatusOnTime: :green,
arrivalStatusNoInfo: :black,
arrivalStatusEarly: :red,
arrivalStatusDelayed: :blue,
arrivalStatusDepartedOnTime: :green,
arrivalStatusDepartedNoInfo: :white,
arrivalStatusDepartedEarly: :red,
arrivalStatusDepartedDelayed: :blue,
arrivalStatusCancelled: :red,
}
html = open('http://pugetsound.onebusaway.org/where/standard/stop.action?id=1_17160').read
doc = REXML::Document.new(html)
status = doc.elements['//td[contains(@class, "arrivalsStatusEntry")]']
minutes = status.elements['.//span'].text
color = COLOR_MAP.fetch(status.attributes['class'].split(/\s+/).last.to_sym, :white)
times = doc.elements.to_a('//div[@class="arrivalsTimePanel"]')
puts "#{minutes} | color=#{color}"
puts '---'
times.each do |time|
puts "#{time[0].text} - #{time[2].text}"
end
Loading…
Cancel
Save