Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd really like to communicate with rhythmbox with a web server so I can remotely change the music playing from my smartphone. Is there a command-line interface for rhythmbox to do things like the following (fictional) commands?

rhythmbox next
rhythmbox shuffle=false
rhythmbox change album='Dark Side of the Moon' artist='Pink Floyd' song='Time' 

Is there a socket or message-passing interface instead? Are there any substitute programs that could get the job done, like Banshee, or some other type of server?

share|improve this question
    
Possible duplicate? askubuntu.com/questions/21494/… – fossfreedom Sep 18 '13 at 18:03
    
Possible duplicate? askubuntu.com/questions/150790/… – fossfreedom Sep 18 '13 at 18:03
2  
@foss no, none of the questions has a similar answer as Geppetos. – Braiam Sep 23 '13 at 13:18
up vote 7 down vote accepted

Basically, the short answer is "Yes" and the complement of such answer will be "Use the rhythmbox-client command from a terminal in order to control your current running Rhythmbox, if it is not already loaded the first instance of your commands will invoke it."

In example: rhythmbox-client --play will make the current Rhythmbox session to start playing the current song (or the first song in the list). If Rhythmbox is closed then it will open it first in order to start playing.

Further information about the rhythmbox-client and its usage can be reached in the rhythmbox-client man page. I place here a portion of the manpage just for reference.

NAME
       rhythmbox-client - controls a running instance of rhythmbox

SYNOPSIS
       rhythmbox-client [option...][file...]

DESCRIPTION
       rhythmbox-client  is a tool for controlling an already running instance
       of  rhythmbox.   It's  useful  for  remote  control  scripting,  adding
       specific  files  to  the library from the shell, or printing details of
       what's playing. It also has an interactive mode, useful for controlling
       playback  remotely  via  ssh.  Any  files  specified  after  the option
       arguments will be added to the library.  If  the  --enqueue  option  is
       given, the files will also be added to the play queue.

OPTIONS
       -?,--help
              Show help options

       --debug
              Enable debug output

       --no-start
              Do not start a new instance of rhythmbox

       --quit Quit rhythmbox

       -i,--interactive
              Start  interactive  mode  --no-present Don't present an existing
              rhythmbox window

       --next Jump to next song

       --previous
              Jump to previous song

       --play Resume playback if currently paused

       --pause
              Pause playback if currently playing

       --play-pause
              Toggle play/pause mode

       --stop Stop playback if currently playing

       --play-uri=URI
              Play a specified URI, importing it if necessary

       --enqueue
              Add specified tracks already in the library to the play queue

       --clear-queue
              Empty the play queue before adding new tracks

       --print-playing
              Print the title and artist of the playing song

       --print-playing-format=format
              Print formatted details of the song (see FORMAT OPTIONS below).

       --set-volume
              Set the playback volume

       --volume-up
              Increase the playback volume

       --volume-down
              Decrease the playback volume

       --print-volume
              Print the current playback volume

       --select-source=URI
              Select the source corresponding to a URI (device or mount point)

       --activate-source=URI
              Select the source corresponding to a URI (device or mount point)
              and start playing from it if not already playing.

       --play-source=URI
              Select the source corresponding to a URI (device or mount point)
              and start playing from it.

FORMAT OPTIONS
       %at    album title

       %aa    album artist

       %aA    album artist (lowercase)

       %as    album artist sortname

       %aS    album artist sortname (lowercase)

       %ay    album year

       %ag    album genre

       %aG    album genre (lowercase)

       %an    album disc number

       %aN    album disc number, zero padded

       %st    stream title

       %tn    track number (i.e 8)

       %tN    track number, zero padded (i.e 08)

       %tt    track title

       %ta    track artist

       %tA    track artist (lowercase)

       %ts    track artist sortname

       %tS    track artist sortname (lowercase)

       %td    track duration

       %te    track elapsed time

       Variables can be combined using quotes. For example "%tn %aa %tt", will
       print  the  track  number  followed  by the artist and the title of the
       track.

AUTHOR
       This manual page was written by Sven Arvidsson  <sa@whiz.se>,  for  the
       Debian system (but may be used by others).

Edit

I got some interest on this subject so I ran a test with the next command:

dbus-send --print-reply --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek int64:60000000

From the original answer posted right here. Which indeed works for the task of seeking on current playing song, (based on the asker's comment).

Good luck!

share|improve this answer
    
Awesome! That saves me so much headache. Do you know if there's a --seek ability? It doesn't include it in the man pages. – Athan Clark Sep 18 '13 at 18:29
    
Unfortunately the rhythmbox-client options are limited. I have added the details to this answer for your convenience. – Geppettvs D'Constanzo Sep 18 '13 at 18:34
    
Take a look on this answer: unix.stackexchange.com/a/75680, the former --seek option seems to have been deprecated but it seems there is another solution. Please let us know if you succeed. Thank you. – Geppettvs D'Constanzo Sep 18 '13 at 18:38
    
Oh well... I dropped another edit for you. Good luck! – Geppettvs D'Constanzo Sep 18 '13 at 18:42
    
It turns out Banshee has the ability to both query for current player information (like track playing, cursor position, player state, etc.) and control playback! banshee --help 'splains it all! Thank you for your help though, I hope you have a great day! – Athan Clark Sep 18 '13 at 18:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.