Differentiate between http and https.
This commit is contained in:
parent
70fa77dc9d
commit
62d2cd93c4
1 changed files with 10 additions and 2 deletions
12
spradio.liq
12
spradio.liq
|
@ -63,7 +63,11 @@ def next_song() =
|
||||||
log = log(label="next_song")
|
log = log(label="next_song")
|
||||||
|
|
||||||
log("Requesting the next song from #{url_next}")
|
log("Requesting the next song from #{url_next}")
|
||||||
let (status, _, data) = http.get(headers=api_headers_next, url_next)
|
if string.contains(prefix='https') then
|
||||||
|
let (status, _, data) = https.get(headers=api_headers_next, url_next)
|
||||||
|
else
|
||||||
|
let (status, _, data) = http.get(headers=api_headers_next, url_next)
|
||||||
|
end
|
||||||
let (_, status_code, _) = status
|
let (_, status_code, _) = status
|
||||||
|
|
||||||
log(data)
|
log(data)
|
||||||
|
@ -99,7 +103,11 @@ def just_played(m) =
|
||||||
if m["req_id"] != "" then
|
if m["req_id"] != "" then
|
||||||
log('Letting server know we played request ID #{m["req_id"]} here: #{url_played}')
|
log('Letting server know we played request ID #{m["req_id"]} here: #{url_played}')
|
||||||
played_song = json_of(compact=true, [("song_request", int_of_string(m["req_id"]))])
|
played_song = json_of(compact=true, [("song_request", int_of_string(m["req_id"]))])
|
||||||
let (status, _, data) = http.post(headers=api_headers_played, data=played_song, url_played)
|
if string.contains(prefix='https') then
|
||||||
|
let (status, _, data) = https.post(headers=api_headers_played, data=played_song, url_played)
|
||||||
|
else
|
||||||
|
let (status, _, data) = http.post(headers=api_headers_played, data=played_song, url_played)
|
||||||
|
end
|
||||||
let (_, status_code, _) = status
|
let (_, status_code, _) = status
|
||||||
|
|
||||||
if status_code == 204 then
|
if status_code == 204 then
|
||||||
|
|
Loading…
Reference in a new issue