Author Topic: lircrc - gmusicbrowser with remote control  (Read 4550 times)

plumocelot

  • Newbie
  • *
  • Posts: 2
    • View Profile
lircrc - gmusicbrowser with remote control
« on: November 22, 2009, 04:03:39 »
I'm using gmusicbrowser for a huge music library on my Scaleo E HTPC -
I have hashed together a configuration for LIRC for my Phillips MCE remote control:
In your editor open up ~/.lircrc
The red sections below are bash scripts for controlling volume with amixer

##Master Volume
begin
   prog = irexec
   button = VolUp
   config = ~/volume_up
   repeat = 1
end

begin
   prog = irexec
   button = VolDown
   config = ~/volume_dn
   repeat = 1
end

begin
   prog = irexec
   button = Mute
   config = ~/mute
end

## See the scripts below for adjusting master volume with amixer - I prefer this as it is more responsive:

#volume_up
#!/bin/bash
/usr/bin/amixer -c 0 sset Master,0 1+

#volume_down
#!/bin/bash
/usr/bin/amixer -c 0 sset Master,0 1-

#mute
#!/bin/bash
if [ "`/usr/bin/amixer -c 0 sget Master | grep off`" ]
then
    /usr/bin/amixer -q -c 0 sset Master unmute
else
    /usr/bin/amixer -q -c 0 sset Master mute
fi
####

## Make the three scripts here and remember to make them executable eg:
#chmod a+x volume_up
#chmod a+x volume_dn
#chmod a+x mute

## These scripts should reside in your home directory


begin
   prog = irexec
   button = Mute
   config = ~/mute
end

##gmusicbrowser - using irexec here to pass commands to a running copy of gmusicbrowser


begin
   prog = irexec
   button = Pause
   config = gmusicbrowser -remotecmd PlayPause
end

begin
   prog = irexec
   button = Skip
   config = gmusicbrowser -remotecmd NextSong
end

begin
        prog = irexec
        button = Replay
        config = gmusicbrowser -remotecmd PrevSong
end

begin
   prog = irexec
   button = Star
   config = gmusicbrowser -remotecmd TogArtistLock
   repeat = 0
end

begin
   prog = irexec
   button = Hash
   config = gmusicbrowser -remotecmd TogAlbumLock
   repeat = 0
end

##Uncomment below if you want to control gmusicbrowser volume directly with your remote

#begin
#       prog = irexec
#       button = VolUp
#       config = gmusicbrowser -remotecmd IncVolume
#       repeat = 1
#end

#begin
#      prog = irexec
#       button = VolDown
#       config = gmusicbrowser -remotecmd DecVolume
#       repeat = 1
#end


NOTES:
gmusicbrowser -listcmd

Lists the available commands that can be passed to the running gmusicbrowser
You can use this to assign the button of your choice to a command in a similar manner to the above.

irw

Will output the name of the key from your remote to the terminal if your LIRC is set up properly. I am using the Phillips MCE drivers from MythTv  so I can't map to other remotes.

Testing it all out:
Fire up gmusicbrowser

In a terminal:

killall irexec   <- Kill all running incidences of irexec
irexec -d  <-- Run irexec in demon mode

I do this from system>preferences>startup applications once I know it all works.

Now sit back and play.