Amarok/Archives/RemoteControl

From KDE Community Wiki

IRman

Use the IRman Controller script.

Another easy way to get remote control on Amarok with IRman is to get a copy of uird, and use learn-mode to associate the keys you want with the Amarok DCOP Functions and save this as your uird.conf file.

This is very simple to set up (in fact, shockingly so). Here's the procedure:

Hook up your IRman to /dev/ttySxx Download the uird tar ball unpack the tar ball using: tar tzf uird-1.1.tgz cd uird; make ./uird -L -t /dev/ttySxx follow the prompts to teach uird what to do for your remote buttons using the Amarok DCOP documentation for a reference how to make Amarok do things for you. start up uird as ./uird -N -t /dev/ttySxx -f uird.conf -p NONE and test your remote control functions.


An annotated sample uird.conf file is shown below:

    #
    # NAD 450 remote control (came with their C470 receiver)
    #
    #       This control controls most NAD stereo components from a few years back.
    #       We map the buttons for the CD player and dual tape deck
    #       into Amarok things
    #
    #       CD player buttons
    225-62-82-173-0-0: dcop amarok player pause
    225-62-64-191-0-0: dcop amarok player stop
    225-62-128-127-0-0: dcop amarok player playPause
    225-62-96-159-0-0: dcop amarok player next
    225-62-160-95-0-0: dcop amarok player prev
    #       Map the "Next disc" button to toggle the playlist
    225-62-232-23-0-0: dcop amarok playlist togglePlaylist
    #
    #       Tape Deck A controls:
    #               Reverse Direction button - skip 5 seconds back
    225-62-42-213-0-0: dcop amarok player seekRelative -5
    #               Forward Direction button - skip 5 seconds forward
    225-62-202-53-0-0: dcop amarok player seekRelative 5
    #
    #       Tape Deck B controls:
    #               Reverse Direction button - skip 10 seconds back
    225-62-123-132-0-0: dcop amarok player seekRelative -10
    #               Forward Direction button - skip 10 seconds forward
    225-62-57-198-0-0: dcop amarok player seekRelative 10

Lirc

A homebrew IR-receiver box using the schematics from The LIRC Project will also work. What you'll need to do is to install lircd and setup your /etc/lircd.conf. This is described in the Lirc Documentation. Then you'll have to define what you want the remote to do. This is specified in your ${HOME}/.lircrc file.

Here is a section of my .lircrc file, it is designed to use the Hauppauge remote control, but you can change it to use whatever remote you got.

   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Play
    config = dcop amarok player play
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Stop
    config = dcop amarok player stop
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Pause
    config = dcop amarok player playPause
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Vol-
    repeat = 2
    config = dcop amarok player volumeDown 
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Vol+
    repeat = 2
    config = dcop amarok player volumeUp
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Forward
    repeat = 3
    config = dcop amarok player seekRelative 5
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Rewind 
    repeat = 3
    config = dcop amarok player seekRelative -5
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Blank
    config = dcop amarok playlist clearPlaylist
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Mute
    config = dcop amarok player mute
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Skip
    repeat = 3
    config = dcop amarok player next
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Replay
    repeat = 3
    config = dcop amarok player prev
   end
   begin
    prog = irexec
    remote = hauppauge_pvr
    button = Full
    repeat = 3
    config = dcop amarok player showOSD
    end

When all this is done you'll need to make sure that the lircd and irexec is running.

lircd is a system process and it is started with /etc/init.d/lircd (gentoo). irexec should not be run as root, the best thing is to autostart it with your desktop.

Here are a couple more interesting remote control recipes. The first one programs an Internet radio station to the remote control button "1"; substitute the name you've given to the radio stream in Amarok accordingly. The second recipe is for text-to-speech synthesis of the currently playing song using Festival -- useful for checking out the name of a good song when your monitor is off.

  begin
  remote = SONY
  button = 1
  prog = irexec
  config = dcop amarok playlistbrowser loadPlaylist '1. ETN.fm (Trance)'; sleep 3; dcop amarok player play
  end
  
  begin
  remote = SONY
  button = recall
  prog = irexec
  config = prev_volume=`dcop amarok player getVolume`; dcop amarok player setVolume `expr $prev_volume / 3`;    


  (dcop    amarok player artist; echo '  '; dcop amarok player title) | text2wave -F 44100 -scale 3  | aplay; dcop amarok    
  player     setVolume $prev_volume
  end

IRKick

To be completed