We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
suena / updater.fish
1
#!/usr/bin/env fish
2
3
function conv
4
echo $argv | iconv -f utf8 -t cp437
5
end
6
7
source updater.credentials.fish
8
9
set title x
10
set artist x
11
set album x
12
set playbackRate 0
13
14
while true
15
set ntitle (./nowplaying-cli get title)
16
set nartist (./nowplaying-cli get artist)
17
set nalbum (./nowplaying-cli get album)
18
set nplaybackRate (./nowplaying-cli get playbackRate)
19
20
if test "$ntitle" != "$title" -o "$nartist" != "$artist" -o "$nalbum" != "$album" -o "$nplaybackRate" != "$playbackRate"
21
set title "$ntitle"
22
set artist "$nartist"
23
set album "$nalbum"
24
set playbackRate "$nplaybackRate"
25
26
if test "$playbackRate" -eq 1
27
curl -v -XPOST $TARGET/$SECRET/suena -H'x-title: '(conv $title) -H'x-artist: '(conv $artist) -H'x-album: '(conv $album)
28
else
29
curl -v -XPOST $TARGET/$SECRET/no_suena -H'x-msg: '(cat msg)
30
end
31
end
32
33
sleep 5
34
end
35