In Linux all the music player like Banshee / Rhythmbox music player has a dbus interface which provides us a means to control them from commandline like pause, play, next, previous, increase/decrease volume.
I wrote few alias to do so ...
Rhythmbox
alias pauseplay='dbus-send --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox/Player org.gnome.Rhythmbox.Player.playPause boolean:true'
alias next='dbus-send --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox/Player org.gnome.Rhythmbox.Player.next'
alias prev='dbus-send --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox/Player org.gnome.Rhythmbox.Player.previous'
alias incvolume='dbus-send --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox/Player org.gnome.Rhythmbox.Player.setVolumeRelative double:.1'
alias decvolume='dbus-send --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox/Player org.gnome.Rhythmbox.Player.setVolumeRelative double:-.1'
Banshee
alias pauseplay='dbus-send --type=method_call --dest=org.bansheeproject.Banshee /org/bansheeproject/Banshee/PlayerEngine org.bansheeproject.Banshee.PlayerEngine.TogglePlaying'
alias next='dbus-send --type=method_call --dest=org.bansheeproject.Banshee /org/bansheeproject/Banshee/PlaybackController org.bansheeproject.Banshee.PlaybackController.Next boolean:false'
alias prev='dbus-send --type=method_call --dest=org.bansheeproject.Banshee /org/bansheeproject/Banshee/PlaybackController org.bansheeproject.Banshee.PlaybackController.Previous boolean:false'
Place these alias in your .bashrc or .bash_aliases file. Now you can control rhythmbox from shell like
pauseplay - play or pause rhythmbox Music player
next - next track
prev - previous track
incvolume - increase volume
decvolume - decrease volume
Change the alias for your convenience ...
No comments:
Post a Comment