Find the answer to your Linux question:
Results 1 to 3 of 3
Hi I know it is possible to setup lirc to send simple commands to mpd (play/pause, volume up/down, next/prev track) and bind these commands to the sutable media buttons on ...
  1. #1
    Just Joined!
    Join Date
    Feb 2007
    Posts
    3

    using lirc to control mpd and mythtv

    Hi

    I know it is possible to setup lirc to send simple commands to mpd (play/pause, volume up/down, next/prev track) and bind these commands to the sutable media buttons on my remote (play/pause to the play button etc...) the problem is that mythtv uses these buttons to control video etc when its playing.

    So im wondering is it possible to set it up so that when on the main mythtv menu (watch tv...media library...) the media buttons control mpd but when in video mode the media buttons control mythtv instead?

    thanks
    Chris

  2. #2
    Linux Guru waterhead's Avatar
    Join Date
    Jul 2004
    Location
    Franklin, Wisconsin
    Posts
    4,577
    To add remote control support to an application, you have to add the button mapping to your .lircrc file. The "dot" in front of the file means that it is hidden, so to show it you will need to check this box in the Nautilus file browser:

    View-->Show Hidden Files

    If you have a working remote in MythTV, then you should have a .lircrc file in your home folder.

    I don't know what the program mpd is, or if it has lirc support. Here is my .lircrc file, for my Microsoft Media Center remote. I got the original from the internet, and tweaked the settings. It has configurations for VLC, Mplayer, MythTV and Xine.

    It also has settings to use the remote with an Open Office Presentation. Since OO Presentation doesn't have native lirc support, it uses a small program called irxevent to control the application. If mpd doesn't have native lirc support, you may need to do it this way. You do need to run the irxevent program first.

    There are also key mappings for my remote's other buttons, using the irexec program. I don't use them, so they are commented out.
    Code:
    #Button mappings for VLC, Xine, Mplayer, MythTV and Open Office Presentation (using irxevent). For Microsoft Media Center remote.
    #VLC
    begin
        prog = vlc
        button = play
        config = key-play
    end
    
    begin
        prog = vlc
        button = pause
        config = key-pause
    end
    
    begin
        prog = vlc
        button = stop
        config = key-quit
    end
    
    begin
        prog = vlc
        button = chandown
        config = key-prev
    end
    
    begin
        prog = vlc
        button = chanup
        config = key-next
    end
        
    begin
        prog = vlc
        button = rewind
        config = key-slower
    end
    
    begin
        prog = vlc
        button = forward
        config = key-faster
    end
    
    begin
        prog = vlc
        button = VolDown
        config = key-vol-down
    end
    
    begin
        prog = vlc
        button = VolUp
        config = key-vol-up
    end
    
    begin
        prog = vlc
        button = mute
        config = key-vol-mute
    end
    
    begin
        prog = vlc
        button = left
        config = key-nav-left
    end
    
    begin
        prog = vlc
        button = right
        config = key-nav-right
    end
    
    begin
        prog = vlc
        button = down
        config = key-nav-down
    end
    
    begin
        prog = vlc
        button = up
        config = key-nav-up
    end
    
    begin
        prog = vlc
        button = ok
        config = key-nav-activate
    end
    
    begin
        prog = vlc
        button = dvd
        config = key-disc-menu
    end
    
    
    ######XINE############
    begin
        prog = xine
        button = back
        config = ToggleAspectRatio
    end
    
    begin
        prog = xine
        button = ok
        config = EventSelect
    end
    
    begin
        prog = xine
        button = info
        config = OSDStreamInfos
    end
    
    begin
        prog = xine
        button = VolUp
        config = Volume+
    end
    
    begin
        prog = xine
        button = VolDown
        config = Volume-
    end
    
    begin
        prog = xine
        button = forward
        config = SeekRelative+15
    end
    
    begin
        prog = xine
        button = rewind
        config = SeekRelative-15
    end
    
    
    begin
        prog = xine
        button = skip
        config = EventNext
    end
    
    begin
        prog = xine
        button = replay
        config = EventPrior
    end
    
    begin
        prog = xine
        button = pause
        config = Pause
    end
    
    begin
        prog = xine
        button = up
        config = EventUp
    end
    
    begin
        prog = xine
        button = right
        config = EventRight
    end
    
    begin
        prog = xine
        button = down
        config = EventDown
    end
    
    begin
        prog = xine
        button = left
        config = EventLeft
    end
    
    begin
        prog = xine
        button = enter
        config = Enter
    end
    
    begin
        prog = xine
        button = mute
        config = Mute  
    end
    
    begin
        prog = xine
        button = play
        config = Play  
    end
    
    begin
       prog = xine
       button = stop
       config = Quit
    end
    
    begin
       prog = xine
       button = home
       config = Menu
    end
    
    begin
       prog = xine
       button = dvd
       config = RootMenu
    end
    
    begin
       prog = xine
       button = rsurf
       config = RootMenu
    end
    
    #####MPLAYER#################
    begin
        prog = mplayer
        button = ok
        config = pause
    end
    
    begin
        prog = mplayer
        button = VolUp
        config = volume +1
    end
    
    begin
        prog = mplayer
        button = VolDown
        config = volume -1
    end
    
    begin
        prog = mplayer
        button = forward
        config = seek +30 0
    end
    
    begin
        prog = mplayer
        button = rewind
        config = seek -30 0
    end
    
    
    begin
        prog = mplayer
        button = skip
        config = seek +15 0
    end
    
    begin
        prog = mplayer
        button = replay
        config = seek -15 0
    end
    
    begin
        prog = mplayer
        button = pause
        config = pause
    end
    
    begin
        prog = mplayer
        button = up
        config = seek +60 0
    end
    
    begin
        prog = mplayer
        button = right
        config = seek +6 0
    end
    
    begin
        prog = mplayer
        button = down
        config = seek -60 0
    end
    
    begin
        prog = mplayer
        button = left
        config = seek -6 0
    end
    
    begin
        prog = mplayer
        button = enter
        config = pause
    end
    
    begin
        prog = mplayer
        button = mute
        config = mute
    end
    
    begin
        prog = mplayer
        button = play
        config = pause
    end
    
    begin
       prog = mplayer
       button = power
       config = quit
    end
    
    begin
       prog = mplayer
       button = stop
       config = quit
    end
    
    begin
       prog = mplayer
       button = home
       config = vo_fullscreen
    end
    
    begin
       prog = mplayer
       button = menu
       config = vo_fullscreen
    end
    
    ##########LAUNCHING BUTTONS#######################
    
    #Launch Myth
    #begin
    #    prog = irexec
    #    button = power
    #    delay= 6
    #    config = /home/supermario/.checkmythrunning.sh
    #end
    
    #Turn TV Off
    #begin
    #    prog = irexec
    #    button = power
    #    config = irsend -d /dev/lircd1 SEND_ONCE Samsung power
    #end
    
    #Put monitor into low power mode & turn off tv
    #begin
    #    prog = irexec
    #    button = back
    #    config = DISPLAY=:0 xset dpms force off; irsend -d /dev/lircd1 SEND_ONCE Samsung power
    #end
    
    #########MythTV######################
    begin 
        prog = mythtv
        button = chanup
        config = PgUp
    end
    
    begin
        prog = mythtv
        button = chandown
        config = PgDown
    end
    
    begin
        prog = mythtv
        button = ok
        config = Return
    end
    
    begin
        prog = mythtv
        button = home
        config = M
    end
    
    begin
        prog = mythtv
        button = menu
        config = M
    end
    
    begin
        prog = mythtv
        button = info
        config = I
    end
    
    begin
        prog = mythtv
        button = VolUp
        repeat = 3
        config = ]
    end
    
    begin
        prog = mythtv
        button = VolDown
        repeat = 3
        config = [
    end
    
    begin
        prog = mythtv
        button = forward
        repeat = 3
        config = >
    end
    
    begin
        prog = mythtv
        button = rewind
        repeat = 3
        config = <
    end
    
    begin
        prog = mythtv
        button = pause
        config = P
    end
    
    begin
        prog = mythtv
        button = up
        repeat = 3
        config = Up
    end
    
    begin
        prog = mythtv
        button = right
        repeat = 3
        config = Right
    end
    
    begin
        prog = mythtv
        button = down
        repeat = 3
        config = Down
    end
    
    begin
        prog = mythtv
        button = left
        repeat = 3
        config = Left
    end
    
    begin
        prog = mythtv
        button = enter
        config = Enter
    end
    
    begin
        prog = mythtv
        button = zero
        config = 0
    end
    
    begin
        prog = mythtv
        button = one
        config = 1
    end
    
    begin
        prog = mythtv
        button = two
        config = 2
    end
    
    begin
        prog = mythtv
        button = three
        config = 3
    end
    
    begin
        prog = mythtv
        button = four
        config = 4
    end
    
    begin
        prog = mythtv
        button = five
        config = 5
    end
    
    begin
        prog = mythtv
        button = six
        config = 6
    end
    
    begin
        prog = mythtv
        button = seven
        config = 7
    end
    
    begin
        prog = mythtv
        button = eight
        config = 8
    end
    
    begin
        prog = mythtv
        button = nine
        config = 9
    end
    
    begin
       prog = mythtv
       button = replay
    # Use for backwards commercial skip
        config = Q  
    end
    
    begin
       prog = mythtv
       button = skip
    # Use for forward commercial skip
        config = Z  
    end
    
    begin
       prog = mythtv
       button = exit
       config = D  
    end
    
    begin
        prog = mythtv
        button = mute
        config = |  
    end
    
    begin
        prog = mythtv
        button = guide
        config = S
    end
    
    begin
        prog = mythtv
        button = play
        config = P  
    end
    
    begin
        prog = mythtv
        button = livetv
        config = %
    end
    
    begin
      prog = mythtv
      button = record
      config = R  
    end
    
    begin
       prog = mythtv
       button = rectv
       config = &
    end
    
    begin
       prog = mythtv
       button = dvd
       config = #
    end
    
    begin
       prog = mythtv
       button = caption
       config = T
    end
    
    begin
       prog = mythtv
       button = power
       config = Escape
    end
    
    begin
       prog = mythtv
       button = stop
       config = Escape
    end
    
    begin
       prog = mythtv
       button = back
       config = W
    end
    
    ##############################################
    #### Evince y OpenOffice (Presentations) ####
    ##############################################
    
    begin
       prog = irxevent
       button = OK
       config = Key F5 CurrentWindow
       repeat = 0
    end
    
    begin
       prog = irxevent
       button = Back
       config = Key Escape CurrentWindow
       repeat = 0
    end
    
    begin
       prog = irxevent
       button = Down
       config = Key alt-Page_Up CurrentWindow
       repeat = 0
    end
    
    begin
       prog = irxevent
       button = Up
       config = Key alt-Page_Down CurrentWindow
       repeat = 0
    end
    
    begin
       prog = irxevent
       button = Right
       config = Key Next CurrentWindow
       #config = Key ctrl-plus CurrentWindow
       repeat = 0
    end
    
    begin
       prog = irxevent
       button = Left
       config = Key Prior CurrentWindow
       #config = Key ctrl-minus CurrentWindow
       repeat = 0
    end
    Paul

    Please do not send Private Messages to me with requests for help. I will not reply.

  3. #3
    Just Joined!
    Join Date
    Feb 2007
    Posts
    3
    Hi thanks for the reply

    mpd is simply a music playing deamon.

    I was planning on using irexec and mpc to pass commands to the mpd deamon.

    The problem is that mythfrontend is always running (my machine is just a media box with no desktop installed) but mpd is a deamon and is also always running.

    So I have the problem that I want to control both programs with the same buttons but they are both always running.

    Thats what got me to thinking, if possible is there a way to recive the command check if mythtv is on the main menu, if it is pass the command to irexec, if it isnt then pass the command to mythtv?

    That way I can have both programs running but control them both with the remote.

    I noticed mythtv has the ability to asign the same button to different tasks depending on were you are in the program. E.g (A to open weather report when in mythweather and A to play a video in mythvideo)

    Thanks
    Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...