Skip to main content

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!

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

Post a Comment

Popular posts from this blog

XBee ZNet 2.5 Wireless Accelerometer

I managed to put together a wireless accelerometer the other night using my two new XBees, an Arduino XBee shield, an XBee Explorer USB, an ADXL330, and some Python. I struggled a bit with some of it, so here's what I learned:

First, a parts list.
XBee 2mW Series 2.5 Chip AntennaArduino XBee (with XBee Series 2.5 module)XBee Explorer USBADXL330I'm not sure exactly what the specs are on the XBee that comes with the Arduino shield. But, it is definitely a series 2.5.

The first thing to do is to configure and upgrade the firmware on your XBees. To do that, you'll need X-CTU (for the firmware upgrade at least, but it's also nice for configuration) which, unfortunately, is only available for Windows. But, it works fine from VMware. First up, the XBee we'll hook up to the computer to read incoming data from the accelerometer:
Plug one of the XBees into the Explorer (it's also possible to do this from the Arduino shield by shifting the two XBee/USB jumpers to USB and remo…
Read more

Android Recipes and Snippets

I've put together a small collection of Android recipes. For each of these recipes, this is an instance of Context (more specifically, Activity or Service) unless otherwise noted. Enjoy :)

Intents
One of the coolest things about Android is Intents. The two most common uses of Intents are starting an Activity (open an email, contact, etc.) and starting an Activity for a result (scan a barcode, take a picture to attach to an email, etc.). Intents are specified primarily using action strings and URIs. Here are some things you can do with the android.intent.action.VIEW action and startActivity().Intent intent = new Intent(Intent.ACTION_VIEW);
// Choose a value for uri from the following.
// Search Google Maps: geo:0,0?q=query
// Show contacts: content://contacts/people
// Show a URL: http://www.google.com
intent.setData(Uri.parse(uri));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);Other useful action/URI pairs include:Intent.ACTION_DIAL, tel://8675309Intent.ACTION_CALL…
Read more

Email Injection

Not so long ago, I ran a wiki called SecurePHP. On that wiki, there was one particular article about email injection that received a lot of attention. Naturally, with all the attention came lots of spam. As a result, I disabled editing of the wiki and content stagnated. Still, the email injection article remained popular. About a year later, the server that hosted SecurePHP died and I never had a chance to hook it all back up. I saved the article though and I'm reposting it now. It may be a bit old (I've been away from PHP for a long time), and I didn't write all of it, so feel free to leave comments about needed updates and corrections. Though this article focuses on PHP, it provides a lot of general information regarding email injection attacks.

The PHP mail() FunctionThere are a lot of ways to send anonymous emails, some use it to mass mail, some use it to spoof identity, and some (a few) use it to send email anonymously. Usually a web mailform using the mail() function …
Read more