Rhythmbox shout2send Plugin

As promised, here is my Rhythmbox plugin for streaming whatever is currently playing. To install, just extract it in ~/.gnome2/rhythmbox/plugins. I use the following alias to start playing the stream on my Chumby.
alias chumbystream="ssh root@chumby btplay --output=alsa:plug:dmixer http://server:8000/stream.ogg"
I also have a few troubleshooting tips.
  • Make sure you haven't muted Rhythmbox. You can control the volume of the stream output using the volume control in Rhythmbox.
  • Make sure your Icecast server is running.
  • If Rhythmbox behaves oddly, try disabling the plugin, restarting Rhythmbox, and re-enable the plugin.
If you're interested in writing Python plugins for Rhythmbox, the source code for this plugin is pretty simple. It may serve as a good starting point. Also, see the Rhythmbox plugin writing guide.

This is not only my first Rhythmbox plugin, but also my first use of GTK, Glade, and GConf. I already had a little experience with GStreamer on the OLPC. Overall, the process was amazingly painless. Props to the Rhythmbox team for making the process of writing plugins so easy!

14 comments:

  1. damonkohler,

    I am unable to switch songs with this plugin. If I let the songs switch by themselves (let the current song finish, auto-play the next song) then it works. But if I wish to begin playing a new song while one is already playing, then all sound output from rhythmbox ceases. Is there any possible way to fix this?

    ReplyDelete
  2. Well, the good news is, I can reproduce the issue. The bad news is, I have no idea what the problem is. If anyone has suggestions, I'm all ears!

    ReplyDelete
  3. Damon: did you find a fix?

    ReplyDelete
  4. A potential fix:
    http://pastebin.com/f51b561ff

    Use this patch and set your stream receiving player (eg. VLC) to loop the song.

    ReplyDelete
  5. Wow, I didn't realize VLC can stream!!

    - file
    - http
    - mmsh
    - rtp
    - icecast!

    ReplyDelete
  6. I would like to improve this plugin but there is a lack of documentation for the API's you used on it. Now I'm trying to make the streaming continuously play various files from my local music library to a icecast2 server, but every time the track is over all clients stops to receive streaming.

    Any tips about this?

    ReplyDelete
  7. @Marcelo Unfortunately, no. I have the same problem. I've received a few suggestions/patches from other readers but they did not fix the issue. The lack of documentation is disappointing indeed. I scraped together what I did from other examples, Rhythmbox's wiki, GStreamer docs, and poking at the Python API directly.

    ReplyDelete
  8. @Damon I was reading about GstBin and found this:

    A GstBin internally intercepts every GstMessage posted by its children and implements the following default behaviour for each of them:

    GST_MESSAGE_EOS
    This message is only posted by sinks in the PLAYING state. If all sinks posted the EOS message, this bin will post and EOS message upwards.

    http://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstBin.html#id330251

    ReplyDelete
  9. I have been toying with the idea of retransmitting the music stream we are using in a small "milonga" (tango dance event) around here. So I had to debug some problems, and found that something like:

    LANG=C GST_DEBUG=1 gst-launch-0.10 -mv file:///tmp/insurreccion0.mp3 ! mad half=true ! audioconvert ! audioresample ! lame vbr=4 vbr-max-bitrate=40 ! shout2send sync=true password=mypass mount=live2 2>&1 | less

    works, and the GST_DEBUG env var helps finding what goes on. Have you found any further success with the use of gstreamer in rhythmbox?

    ReplyDelete
  10. actually with "export GST_DEBUG=2" and then calling rhythmbox from command line, I get a warning which seems to be related with the plugin stopping when the song changes:

    0:07:53.426588852 19787 0xab47a18 WARN vorbisenc vorbisenc.c:1197:gst_vorbis_enc_chain: Buffer is older than previous timestamp + duration (0:01:40.632000000< 0:04:40.272000000), cannot handle. Clipping buffer.

    (4:40 was the duration of the first song played, 1:40 is the time the second song has been running since)

    ReplyDelete
  11. Definitely, this problem was the cause: substituting "lame vbr=4 vbr-max-bitrate=40" in place of "vorbisenc ! oggmux" makes it work, and tolerate song changes, etc.

    ReplyDelete
  12. To save newbie Debian users 5 seconds - extract the plugin into /usr/lib/rhythmbox/plugins/

    ReplyDelete
  13. This is great, but too bad it doesn't work. It keeps rejecting the password. And yes I'm 100% sure it's correct.

    2011-01-11 17:49:14 I msg:[src 192.168.2.3:47049 sid=1] SHOUTcast source connection.
    2011-01-11 17:49:14 E msg:[src 192.168.2.3:47049 sid=1] connection denied. Bad password.

    ReplyDelete