diff --git a/bitbar/.gitignore b/bitbar/.gitignore deleted file mode 100644 index 4c60de9..0000000 --- a/bitbar/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -vendor -enabled diff --git a/bitbar/.ruby-version b/bitbar/.ruby-version deleted file mode 100644 index 6cec934..0000000 --- a/bitbar/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby diff --git a/bitbar/onebusaway.30s.rb b/bitbar/onebusaway.30s.rb deleted file mode 100755 index 740aef1..0000000 --- a/bitbar/onebusaway.30s.rb +++ /dev/null @@ -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