-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PS: this uses the private "tidal-hifi" electron app that I am developing and should be released soon.
- Loading branch information
1 parent
0bf931d
commit 9714b2f
Showing
4 changed files
with
90 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
case $BLOCK_BUTTON in | ||
1) ~/.config/i3/scripts/tidal-cli.sh playpause ;; # left click | ||
4) ~/.config/i3/scripts/tidal-cli.sh next ;; # scroll up | ||
5) ~/.config/i3/scripts/tidal-cli.sh previous ;; # scroll down | ||
esac | ||
|
||
if ~/.config/i3/scripts/tidal-cli.sh status | grep 'paused' >/dev/null; then | ||
printf ' ' # fa-pause | ||
else | ||
printf ' ' # fa-play | ||
fi | ||
~/.config/i3/scripts/tidal-cli.sh info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
TIDAL_HOST="http://localhost:47836" | ||
|
||
function httpGet() { | ||
curl -s "$TIDAL_HOST/$1" | ||
} | ||
|
||
function httpSilentGet() { | ||
curl -s -o /dev/null "$TIDAL_HOST/$1" | ||
} | ||
|
||
case $1 in | ||
"play") | ||
httpSilentGet play | ||
;; | ||
"pause") | ||
httpSilentGet pause | ||
;; | ||
"playpause") | ||
httpSilentGet playpause | ||
;; | ||
"next") | ||
httpSilentGet next | ||
;; | ||
"previous") | ||
httpSilentGet previous | ||
;; | ||
"info") | ||
JSON=$(httpGet current) | ||
TITLE=$(echo "$JSON" | jq -r '.title') | ||
ARTISTS=$(echo "$JSON" | jq -r '.artist') | ||
INFO=$(echo "$TITLE - $ARTISTS") | ||
if [ ${#INFO} -le 3 ]; then | ||
echo "No music info available" | ||
else | ||
echo "$INFO" | ||
fi | ||
;; | ||
"status") | ||
if httpGet current | grep "paused" >/dev/null; then | ||
echo "paused" | ||
else | ||
echo "playing" | ||
fi | ||
;; | ||
*) | ||
echo "tidal-cli doesn't know this command" | ||
;; | ||
esac |