Tuesday, March 8, 2011

Remote rhythmbox playing...teeheehee


This is awesome. I already have a very good use for this method as you will soon see...waking up my house mates by ssh-ing to my home computer and turning on Rhythmbox, and turning it on loud!

So I really just wanted to be able to play music from the terminal. Mainly, so I can do this on a remote computer via ssh. I thought it was a crazy idea and not possible, but how wrong I was. I soon realised also, that Rhythmbox probably isn't the most process efficient program to run, but hey, it was straight forward, and did what I wanted it to do so I'll stick with it for now.

This is a guide to running a program on a remote machine over ssh.

Firstly, you'll need to ssh to the desired computer. Many docs on how to do this. I used a variant of the following command with no -X option.

ssh me@192.168.1.1

Enter the password for 'me' on the host. Then, type the command below, I lost the link to where I found it sorry.

export DISPLAY=:0.0

When you press enter, nothing will happen. However, you have just given ssh somewhere to direct programs that require a GUI. This command is also used if you want to direct the program to display on the local computer, but instead of using 0.0, another option is used. This is a little more complicated though and some files need to be edited.

Ok, so to test that you can get a program to start-up, try xeyes.

xeyes

Much easier to know if it works if the computer you are ssh-ing to is right beside you. So now that it works, we want to get rhythmbox working. The command is:

rhythmbox-client

This opens rhythmbox and then allows users to send commands to the client via terminal. To find a list of options, run:

rhythmbox-client --help

Lastly, point your terminal to the folder where all your songs are located, and queue them like so:

rhythmbox-client --enqueue FOLDER-NAME

Vuola! Use the --play and --next options to get to the songs you want to play. Of course they have to be in the playlist to play.

I will probably find an easier method for playing songs soon, but hey, this works for now. The only problem I've run into thus far, is if you add a folder, it adds all the files that are in that folder, documents, images etc. Possible solution, run an ls with a grep option to select only song files. It should work, will try it soon.

Thanks and have fun waking up your neighbours!

No comments:

Post a Comment