From 2eebfd2bb5a78f583c59b86307c3b1f9b4a98e87 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Sat, 18 Oct 2014 20:19:10 +0200 Subject: rating tracks exits --- clerk | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/clerk b/clerk index d8bf56b..0190e83 100755 --- a/clerk +++ b/clerk @@ -76,9 +76,9 @@ playbackPrompt () { lastFM () { # Some Variables to clean up the code -mpds_check="$(ssh $ssh_host -q -t 'bash -c "pgrep mpdscribble"')" - if ((ssh_lastfm)); then + if [[ $ssh_lastfm == 1 ]]; then + mpds_check="$(ssh $ssh_host -q -t 'bash -c "pgrep mpdscribble"')" if [ -n "$mpds_check" ]; then ssh $ssh_host -q -t 'bash -c "killall mpdscribble"' && notify-send "MPD" "LastFM Scrobbling Disabled" @@ -95,6 +95,26 @@ mpds_check="$(ssh $ssh_host -q -t 'bash -c "pgrep mpdscribble"')" fi } +lastFMCheck () { +# Some Variables to clean up the code + + if ((ssh_lastfm)); then + mpds_check="$(ssh $ssh_host -q -t 'bash -c "pgrep mpdscribble"')" + if [ -n "$mpds_check" ]; then + echo "lastfm: off" + else + echo "lastfm: on" + fi + else + if pgrep mpdscribble + then + echo "lastfm: on" + else + echo "lastfm: off" + fi + fi +} + currentPrompt () { menu=("0 Return to Main Menu" @@ -621,7 +641,6 @@ rateTrack () { sed -i "/$(mpc current -f '%title%')/d" track.ratings echo "${rating}\\$(mpc current -f "%artist%\%track%\%title%\%date%\%album%")" >> track.ratings fi - ratingPrompt fi } @@ -1365,6 +1384,10 @@ elif [[ "$1" == "-playlists" ]]; then elif [[ "$1" == "-rcurrent" ]]; then export rating="$2" instantRateTrack +elif [[ "$1" == "-scrobbling" ]]; then + lastFM +elif [[ "$1" == "-checklfm" ]]; then + lastFMCheck else dplayPrompt fi -- cgit v1.2.3-24-g4f1b