Skip to content

Commit

Permalink
showing search menu when mpv can't play
Browse files Browse the repository at this point in the history
  • Loading branch information
shinokada committed Jul 17, 2021
1 parent b8e8dfa commit f379db2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Unix-like environment.
- [jq](https://stedolan.github.io/jq/) is a lightweight and flexible command-line JSON processor.
- [fzf](https://github.com/junegunn/fzf) is a general-purpose command-line fuzzy finder.
- [gh](https://cli.github.com/) is the GitHub CLI.
- curl: Most UNIX-like OS should have it.

## Features

Expand Down
5 changes: 4 additions & 1 deletion lib
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ _play() {
echo
yellowprint "Press q to quit."
echo
mpv "$1" || _graceful_exit "Play: Can't play mpv."
mpv "$1" || {
echo "Not able to play your station."
search_menu
}
}

_show_favlist() {
Expand Down
7 changes: 5 additions & 2 deletions search
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ _search_play() {
jq -r ".[$ANS-1]" <"$SEARCH_RESULTS" >"$TEMP_FILE"
URL_RESOLVED=$(jq -r ".[$ANS-1] |.url_resolved" <"$SEARCH_RESULTS")
if [[ -n $URL_RESOLVED ]]; then
mpv "$URL_RESOLVED" || _graceful_exit "Search: Can't play mpv."
mpv "$URL_RESOLVED" || {
echo "Not able to play your station."
search_menu
}
else
echo "url_resolved can't be found. Exiting ..."
exit 1
Expand Down Expand Up @@ -110,7 +113,7 @@ advanced_search() {

search_submenu() {
echo -ne "
$APP_NAME SEARCH SUB MENU:
$APP_NAME SEARCH SUBMENU:
$(greenprint '1)') Play
$(greenprint '2)') Save
$(greenprint '3)') Go back to the Search menu
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.7"
VERSION="0.3.8"
SCRIPT_DOT_DIR="$HOME/.config/tera"
# CACHE_DIR="$HOME/.cache"
FAVORITE_PATH="$SCRIPT_DOT_DIR/favorite"
Expand Down

0 comments on commit f379db2

Please sign in to comment.