NetworkManager C# Magic Foo

This afternoon JP asked if Banshee should not fetch CD metadata through MusicBrainz if there wasn’t an available network connection; Nat and I also discussed related ideas a few months ago, and I felt like taking a few hours to diverge from the normal code base this evening, so it was perfect timing to implement a nice, simple piece of “functional candy.”

I ended up writing some quick NetworkManager C# “bindings” using dbus-sharp and the NetworkManager DBus API. They’re mostly complete: no dialup support and no wireless network creation support. The manager, device, and network objects are supported, with only a select few method implementations missing on each. Signals work, though I’m pretty pissed at System.Reflection.EventInfo.GetRaiseMethod() (see NetworkManager.Manager.InvokeEvent(string) for juicy details in Manager.cs).

For those interested in viewing the code or even using it in your C# programs, it is checked in.

In Banshee there is a new class, Banshee.Base.NetworkDetect, which has an event to notify other classes that a connection is either up or down, and has a basic Connected property. If NetworkManager can’t be found, it’s always assumed that a connection is available. There should probably be some kind of non-NetworkManager fall back, but it’s not really that important. If you have NetworkManager, great, if not, oh well.

This now means that, for example, if you started Banshee and you were offline, and then inserted an audio CD, Banshee would not attempt to fetch the metadata from MusicBrainz. However, you then connect and are online, and NetworkManager fires a signal, Banshee propagates it to the audio CD object, and it fetches metadata automagically. How cute.

Banshee 0.10: Enjoy Sugar and Fire

Why yes, Banshee 0.10 is now available.

Lots of stuff has happened in under a week:

  • Finally merged the new import backend, fixes about 5 big bugs, and sprinkles lots of awesomeness on the app
  • iPod syncing is back in full force now that the DAP framework is really rocking
  • And to celebrate GStreamer 0.10, you can now build Banshee with experimental GStreamer 0.10 support

iPod: it's a fashion trend!
The iPod – it’s a fashion trend!

NJB support should be complete by the end of next week, along with generic USB mass storage DAP support. Thanks to everyone who has sent me DAP Probes. I have about 50 probe dumps in an IMAP folder. These will be very useful in getting the generic support in.

Regarding GStreamer 0.10: Currently only the playback engine has a 0.10 port. You can listen to music with GStreamer 0.10, but you can’t play or rip CDs, nor can you transcode files (for instance, CD burning and converting unsupported formats to iPod-supported formats). These backends will be ported over the next month. If you want to test the playback backend, pass --with-gstreamer-0-10 to Banshee configure. Congratulations to the GStreamer team on their great 0.10 release! Also, I promise our version numbers are purely a coincidence ;-)

And now for some sugar, crack, fire, whatever:

CD Burning, CD Ripping, Importing
iPod Syncing