Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Audacious Multi Tool
- #
- # Can start and control audacious (play/pause, stop, prev, next, volume)
- #
- # Dependencies: audacious
- #
- # Author: Michael Koch (Emkay443) (m<DOT>koch<AT>emkay443<DOT>de)
- # Version: 2013-08-31
- # License: GNU General Public License v3 (http://www.gnu.de/documents/gpl-3.0.en.html)
- ###################
- ## CONFIGURATION ##
- ###################
- # Command line option names
- option_playpause="playpause"
- option_stop="stop"
- option_prev="prev"
- option_next="next"
- option_volup="volup"
- option_voldown="voldown"
- option_mute="mute"
- # Audacious and audtool commands
- audacious_cmd="/usr/bin/audacious"
- audtool_cmd="/usr/bin/audtool"
- #########################################################################################
- # WARNING: You should be careful when changing any code below. Modify at your own risk! #
- #########################################################################################
- ##################
- ## MAIN PROGRAM ##
- ##################
- # Start audacious with file if there's one provided (second parameter)
- if [ ! -z "$2" ]; then
- audacious -p "$2" &
- else
- # If audacious is not running, start it
- if [ ! "$(pidof audacious)" ]; then
- $audacious_cmd -p &
- else
- case "$1" in
- "$option_playpause")
- $audtool_cmd --playback-playpause
- ;;
- "$option_stop")
- $audtool_cmd --playback-stop
- ;;
- "$option_prev")
- $audtool_cmd --playlist-reverse
- ;;
- "$option_next")
- $audtool_cmd --playlist-advance
- ;;
- "$option_voldown")
- if [ -e "/tmp/audmultitool_lastvol" ]; then
- $audtool_cmd --set-volume $(cat /tmp/audmultitool_lastvol)
- rm /tmp/audmultitool_lastvol
- else
- $audtool_cmd --set-volume $(echo $($audtool_cmd --get-volume)-5 | bc)
- fi
- ;;
- "$option_volup")
- if [ -e "/tmp/audmultitool_lastvol" ]; then
- $audtool_cmd --set-volume $(cat /tmp/audmultitool_lastvol)
- rm /tmp/audmultitool_lastvol
- else
- $audtool_cmd --set-volume $(echo $($audtool_cmd --get-volume)+5 | bc)
- fi
- ;;
- "$option_mute")
- if [ -e "/tmp/audmultitool_lastvol" ]; then
- $audtool_cmd --set-volume $(cat /tmp/audmultitool_lastvol)
- rm /tmp/audmultitool_lastvol
- else
- $audtool_cmd --get-volume > /tmp/audmultitool_lastvol
- $audtool_cmd --set-volume 0
- fi
- ;;
- *)
- echo "Available options are:"
- echo "$option_playpause, $option_stop, $option_prev, $option_next,"
- echo "$option_voldown, $option_volup, $option_mute"
- exit 1
- ;;
- esac
- fi
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement