Send Command to XBMC to Start Music

You can use the following command to remotely start music playing on XBMC. The examples below were sent while I was SSH’ed into the XBMC machine. As you’ll notice from the music paths, I am using some of the ‘special’ paths which call up the LastFM tags of Rap and Alternative.

Start the LastFM Rap tag playing:

xbmc-send -a "PlayMedia(lastfm://globaltags/rap)"

Start the LastFM Alternative tag playing:

xbmc-send -a "PlayMedia(lastfm://globaltags/alternative)"

To play a tag that contains a space in it’s name, you must URL encode the space in your request (eg. replace all the spaces with %20). For example:

Start the LastFM ‘Classic Rock’ tag playing:

xbmc-send -a "PlayMedia(lastfm://globaltags/classic%20rock)"

I should note that each LastFM request is mutually exclusive of the other. Meaning each time you send a new PlayMedia request, the old genre/tag will stop playing and the new one will start playing.

I’ll add to this later when I start documenting some of the various URLs and functions that can be used to start playing music. A list of functions that can be sent can be found on the XBMC wiki.


In order to use the above commands, you must be on a machine that has network access to the XBMC machine and you must have remote commands enabled in your XBMC settings. The alternative method of sending these commands remotely is to do as I do and SSH into the XBMC machine remotely, then send the commands locally.

Also, you must have the XBMC-Send client installed on the machine that is sending the request. To do this with aptitude (on Ubuntu / XBMC-Live), use the following commands:

Update the Aptitude local repository:

sudo apt-get update

Enter the password for the super user if prompted (the default is ‘xbmc’).

Install the xbmc-send client:

sudo aptitude install xbmc-eventclients-xbmc-send

Enter the password for the super user if prompted (the default is ‘xbmc’).

Press Y to continue when prompted.

(Optional) Test out a command:

xbmc-send -a "Notification(Testing,XBMC Command Success.)"

You should see a quick notification box popup on your XBMC installation as soon as you press enter on the above command.





3 responses to “Send Command to XBMC to Start Music”

  1. Stephen Avatar

    I only discovered this blog a few days ago and I love all the XBMC stuff. The command line stuff is brilliant. Definitely gonna have a good look around!

  2. lolfwiw Avatar

    As a note regarding the actual content of this post, it’s worth noting that you should not add a trailing “/” on the end of lastfm:// urls in XBMC.

    works :
    lastfm://globaltags/under 2000 listeners
    doesn’t work :
    lastfm://globaltags/under 2000 listeners/

    Thanks for the blog post!

  3. lolfwiw Avatar

    bleh, the above ate the % 20s in my example urls. anyway you get the picture.

Leave a Reply

Your email address will not be published. Required fields are marked *