Stop mediaplayer / radio with sleep or timer shell script

asked 2014-02-13 13:43:20 +0300

melg01 gravatar image

updated 2014-07-24 10:49:17 +0300

jiit gravatar image

While waiting for the a solution to the question https://together.jolla.com/question/3607/music-player-sleep-function-with-timer/ it would be useful to be able to stop or close the mediaplayer (music player) or the internet radio through a simple bash shell script.

Could someone please review and improve the following simple bash script? I called it "sleepaudio.sh", it runs as nemo user (perms 755) and just kills the mediaplayer/quickradio processes after a given sleeptime of X minutes. Would be nice, if I knew how to run this shell script from the GUI instead of starting it from the command line on the terminal. Any hint?

#!/bin/bash 
sleeptime=$((10*60))
if [ $# -eq 0 ] 
then 
   sleeptime=$(($1*60))
fi 
sleep $sleeptime 
killall -9 jolla-mediaplayer 
killall -9 harbour-quickradio
edit retag flag offensive close delete

Comments

Considering that you're both mentioning the other question here, and comment over there, I'd suggest you just close this "not really either a question or a suggestion" and just add it "as is" as an answer/suggestion over at the other question, "music player sleep function with timer".

phle ( 2014-02-16 00:56:29 +0300 )edit