Skip to content

Commit

Permalink
Play from list bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
shinokada committed Aug 5, 2021
1 parent 18be5d2 commit 831d07b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ _play() {
echo
mpv "$1" || {
echo "Not able to play your station."
search_menu
return 1
}
}

Expand Down Expand Up @@ -124,7 +124,7 @@ _wget_simple_search() {
KEY="$2"
SEARCH_RESULTS="${TMP_PATH}/radio_searches.json"
greenprint "Searching ..."
echo "Key: $KEY and reply: $REPLY"
# echo "Key: $KEY and reply: $REPLY"
wget --post-data "$KEY=$REPLY" "$SEARCH_URL" -O "$SEARCH_RESULTS" 2>/tmp/tera_error || {
redprint "Something went wrong. Please see /tmp/tera_error"
exit
Expand Down
12 changes: 10 additions & 2 deletions play.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ fn_play() {
echo
printf "Type a number to play. "
read -r ANS
# echo "$ANS"
# get list path
# FAV_FULL=_station_list
# echo "LIST: $LIST"
# echo "$FAVORITE_PATH/$LIST.json"
LIST_PATH="$FAVORITE_PATH/$LIST.json"
# echo "${LIST[$ANS]}"
# find the $ANS line e.g. line 2
URL_RESOLVED=$(jq -r ".[$ANS-1] |.url_resolved" <"${FAVORITE_FULL}")
URL_RESOLVED=$(jq -r ".[$ANS-1] |.url_resolved" <"${LIST_PATH}")
# echo "url_resolved: $URL_RESOLVED"
if [[ -n $URL_RESOLVED ]]; then
_play "$URL_RESOLVED"
_play "$URL_RESOLVED" || menu
else
echo "url_resolved can't be found. Exiting ..."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion tera
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eu

# shellcheck disable=SC2034
VERSION="0.3.13"
VERSION="0.3.14"
SCRIPT_DOT_DIR="$HOME/.config/tera"
# CACHE_DIR="$HOME/.cache"
FAVORITE_PATH="$SCRIPT_DOT_DIR/favorite"
Expand Down

0 comments on commit 831d07b

Please sign in to comment.