Skip to content

Commit

Permalink
efa: Show more departures
Browse files Browse the repository at this point in the history
Also, don't display "min".
  • Loading branch information
YtvwlD committed Mar 12, 2024
1 parent a4238c6 commit 6a48451
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/jobs/efa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
require("net/http")
require("json")

uri = URI('https://vrrf.finalrewind.org/D%C3%BCsseldorf/Kruppstr.json?no_lines=4')
uri = URI('https://vrrf.finalrewind.org/D%C3%BCsseldorf/Kruppstr.json?no_lines=6')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)

def json_to_data(data)
return {
:time => data[2],
:time => data[2].gsub("sofort", "0 min").gsub("min", ""),
:line => data[0],
:dest => data[1].gsub("D-", "") # remove "D-"
}
Expand All @@ -33,9 +33,11 @@ def create_error_data(message)
:t2 => json_to_data(pre[1]),
:t3 => json_to_data(pre[2]),
:t4 => json_to_data(pre[3]),
:t5 => json_to_data(pre[4]),
:t6 => json_to_data(pre[5]),
:status => "normal"
}
if data[:t4][:time] == ""
if data[:t6][:time] == ""
data[:status] = "warning"
end
send_event('efa', data)
Expand Down
10 changes: 10 additions & 0 deletions src/widgets/efa/efa.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ <h1 class="title" data-bind="title"></h1>
<span data-bind="t4.dest" class="efa-dest"></span>
<span data-bind="t4.time" class="efa-time"></span>
</p>
<p class="efa-train">
<span data-bind="t5.line" class="efa-line"></span>
<span data-bind="t5.dest" class="efa-dest"></span>
<span data-bind="t5.time" class="efa-time"></span>
</p>
<p class="efa-train">
<span data-bind="t6.line" class="efa-line"></span>
<span data-bind="t6.dest" class="efa-dest"></span>
<span data-bind="t6.time" class="efa-time"></span>
</p>
<br />
</div>
<br />
Expand Down
1 change: 1 addition & 0 deletions src/widgets/efa/efa.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $moreinfo-color: rgba(255, 255, 255, 0.7);;
.efa-train {
display: table-row;
color: $title-color;
text-align: left;
}

.efa-time {
Expand Down

0 comments on commit 6a48451

Please sign in to comment.