The road to Penguicon

Penguicon is coming up soon — starting on April 22nd in Novi, Michigan. I finally got my tickets booked today (after fighting with the hotel for a week about the conference rate). I’m really excited to see the ArsLinux crew again.

Some of the programming for Penguicon is disappointing this year (okay, more than some). As such, we decided to have some of our own panels, tapping on the resources from #linux. Here comes ArsLinuxCon2005. We’ve got a really talented little community, so it should be a fairly educational weekend.

More libnautilus-pr0n

I made some nice progress on libnautilus-pr0n today. I have it reading the width and height from each image (more or less). I have to see why some images aren’t checked (I suspect my code that detects if a file is an image). I need to make the extension work asyncronously, and have it cache the results so it doesn’t have to re-read the file every time.

libnautilus-pr0n

Kinda cool. It doesn’t sort as perfectly as I’d like. For example, if you were to sort from smallest to largest, an “800×600” image would appear after a “1600×1200” image, because “8” is greater than “1”. I’m not sure if I can take control of that through an extension, so that might require some hacking of Nautilus itself. I could also seperate width and height into their own columns, but I think that would get too messy.

I also started looking at libexif today, so I can add exif columns to nautilus.

libnautilus-pr0n

One of the biggest annoyances I have with Nautilus, and with image viewers/managers in general, is the distinct lack of the ability to sort by image properties such as geometry (width/height), bits per pixel (aka color depth), and aspect ratio.

I started to look at ways I could extend Nautilus to add the features I want and I stumbled across Dave Camp’s blog on Nautilus extensions and providers. As chance would have it, the same night I discovered this Jorge met Dave at Linux World in Boston. Small world.

I grabbed the libnautilus-vcs module from GNOME CVS, which served as a good example of how a Nautilus extension worked, and I now have the functional framework of libnautilus-pr0n (named lovely after the geek term for porn). I want to add a collection of media-related features to Nautilus. The most important feature to me is the ability to sort based on aspect ratio, since I have two wide-screen displays and hunting through unsorted images for ones that will fit a 16:9 display can be a pain. Once I started thinking about it I realized how many other cool things I could add. The ability to sort by color depth (useful for finding black & white photos), perhaps even exif data. Maybe even extend it to audio and video, so you can sort by track length or video dimensions. the possibilities are endless.

Heck, maybe I can even get it included with Nautilus at some point (though I have no idea where to begin with that process).

Here’s a little screenshot of the Visible Columns dialog in Nautilus, with two of my columns included. I still need to write the code to display the data but I have the hooks in place for them.

Mono, DBus, and Hal – Help

Here’s the story. I’m trying to hook into Hal to detect when a device (specifically an iPod) is attached. I can do this in C, Perl, and Python, but I can’t get the C# version to work.

The code should be fairly straightforward. I’m using the definition of HalManager from hal-sharp, which as far as I know is current to the latest Hal spec. DBus 0.23, which is working just fine. My next step is to do some debugging in dbus-sharp and see if I can identify what’s failing and why, but maybe someone has already run into this. I can’t be the only person trying to access the Hal Manager via C#.

The exception:

Unhandled Exception: DBus.DBusException: Disconnected prior to receiving a reply
in <0x0015a> DBus.Message:SendWithReplyAndBlock ()
in <0x0007c> HalManager.Proxy:GetAllDevices ()
in <0x00087> podlet:Main (string[])

The code:

[code]
// Compile with: mcs -target:exe -out:”podlet.exe” -pkg:gtk-sharp -pkg:dbus-sharp ./Main.cs ./AssemblyInfo.cs
using System;
using System.Collections;
using Gtk;
using DBus;

[Interface(“org.freedesktop.Hal.Manager”)]
public class HalManager
{
public delegate void DeviceAddedHandler(string udi);
[Signal]
public event DeviceAddedHandler DeviceAdded;

public delegate void DeviceRemovedHandler(string udi);
[Signal]
public event DeviceRemovedHandler DeviceRemoved;

public delegate void NewCapabilityHandler(string udi, string capability);
[Signal]
public event NewCapabilityHandler NewCapability;

[Method]
public virtual string[] GetAllDevices()
{
return null;
}

[Method]
public virtual bool DeviceExists(string udi)
{
return false;
}

[Method]
public virtual string[] FindDeviceStringMatch(string key, string value)
{
return null;
}

[Method]
public virtual string[] FindDeviceByCapability(string capability)
{
return null;
}
}

class podlet
{
public static void Main(string[] args)
{
Connection connection;
connection = Bus.GetSystemBus();
Service service = Service.Get(connection, “org.freedesktop.Hal”);

HalManager manager = (HalManager)service.GetObject (typeof(HalManager),
“org.freedesktop.Hal.Manager”);

foreach (string device in manager.GetAllDevices()) {
System.Console.WriteLine(device);
}
}
}
[/code]

EMP 0.1.2

EMP 0.1.2 is ready for testing. Grab the fresh tarball here.

Aside from some bug fixes, I rewrote the entire GStreamer backend code, borrowing heavily from Rhythmbox’s player/rb-player-gst.c. It’s my first time using GObjects. I highly recommend this tutorial. It made me realize why using GObjects are important.

If you have any problems building EMP, try this before you file a bug (assuming you’re using Debian):

sudo apt-get install libgstreamer-gconf0.8-dev gstreamer-gconf gstreamer0.8-plugins

For those of you running Fedora Core 3 (thanks to Soko):

yum install gstreamer
yum install gstreamer-plugins
yum install GConf
yum install GConf-devel
yum install gstreamer-devel
yum install gstreamer-plugins-devel

I’m working on creating Debian packages for EMP, possibly for the 0.2 release.

GStreamer, GLib, and Gnome-VFS oh my

I’m getting closer to the 0.1 release of EMP. I finished writing the code to import music this morning. There are some optimizations I’d like to make (mostly, spinning off the reading metadata off to a worker thread), but right now it takes just over six seconds to scan and import 248 songs. Some of the speed may be the drive in my laptop, and a large chunk the reading of metadata. It’s quick enough for the 0.1 release though. My next step is to integrate this with the UI, and then it’s time to finish the main player UI and get this first release out the door. I’m aiming to have 0.1 released around the turning of the new year.

The import code was pretty fun to write. One of the complaints I (and others) had about other music players, especially those using GStreamer, is that it tends to be slow importing, or hang trying to import. With that in mind, I’ve taken a two-step approach to music detection. First, I use Gnome-VFS to check the mime type of a file. I ignore anything that isn’t “audio/*”, then feed the file through GStreamer’s typefinder and checking its found mime type against a static list of playable mime types (essentially ogg, mp3, flac, mod, and wav). Only then do I add a song to the library. From my testing, it does a good job of only adding audio and not hanging on miscellaneous files (Flash seems to be a big problem for GStreamer).

EMP is now in my CVS, and the import code is currently living in test/import.c, if anyone wants to see an example of recursively scanning directories and GStreamer.

emp – easy music player

I’ve talked about other music players in the past. I’ve done some hacking on Rhythmbox and worked on some iPod-related stuff. I’ve tried many different players and found myself wanting something more. I like bits and pieces of each player, but none that I think are great (no offense).

I decide that I’d write my own. Big surprise there, eh? I also wanted to brush up my C skills and get a better handle on GTK. This is a win-win.

There are some key features that I want:

  • Playlists, Playlists, and more Playlists
  • Smart Playlists
  • DAAP support (both as a client and server)
  • Album artwork integration
  • Streaming Radio support
  • Fast loading of music library
  • Minimal, clean playback interface – simple is good
  • iPod support
  • Stability
  • Whatever else I think makes sense

Okay, one could argue that X, Y, and Z players do this and more. Other players do these things, but not necessarily well (or my interpretation of well). So, in a sense I am re-inventing the wheel but with good intentions. If anything, I’ll have a music player to fit my tastes and I’ll have brushed up a few of my technical skills.

I’m using gstreamer for music playback, and shared libraries when possible and feasible. Write them when necessary (like libipod). Make it easy to use, hence the name.

Enough of the boring stuff. I’m still a bit away from a release, but I’ve got a nice screenshot of the playlist manager to show off.

Playlist Manager

Create a playlist, add your music (drag and drop, or a context menu to add to playlist) and you’re ready to rock and roll.

Playlist Manager w/advanced filter

Can’t find what you’re looking for? The advanced filter lets you dig down deeper and do a more refined search.

Okay, so a pretty window doesn’t mean much if it doesn’t do anything. I still have much work ahead of me. I have gstreamer functioning. I have an xml document containing my music library (lots of cut and paste of AC/DC in there), and that’s loading into memory just fine. I’m making a little progress every day, so a 0.1 release will be coming by Christmas.

gterrar

I wrote this several months back, but apparently didn’t blog about it. Today, RML blogged about the applet he wrote to do the same thing. I like the applet concept — a lot. What would be really cool would be a merge of RMLs applet with my gterrar. I’d love to have the color-coded panel applet, but click on it to get the floating terror display.

The original version of gterrar is still online. I haven’t touched it in a while, but it still works.

P.S. Props to greenfly, who wrote the original gterrar in perl.

aterm

Looking for an alternative to the bloat of gnome-terminal? I was. I tend to use multiple terminals (I have 5 open right now) and I’m not a fan of tabbed terminals. I vaguely remembered using aterm once upon a time, so I fired it up. By default, aterm is quite ugly but uses much less resources than it’s GNOME counterpart.

Because aterm was built as an xterm replacement, it will honor Xresource settings for xterm, as well as it’s own Xresource settings. You can also customize it from the command line, which is what I did.

stone@moradin:~$ more ~/bin/aterm
/usr/bin/aterm -title ‘Terminal’ -bg black -shading 30 -fade 90 -fg #cecece -tr +sb -sr -si -sk

I’m pretty pleased with the results. I nice, clean terminal and considerably less memory usage. What more could a boy ask for?

podlet: syncronization and Gnome2::VFS

I’m making good progress on podlet. I started working on the syncronization logic. There are a few important things to take into consideration before copying files to the iPod:

  • What files need to be copied?
  • Does the target have enough free space?
  • Do we need to prepare the music before copying it?

ped recursively through my music folder, I found a few non-music items that I wouldn’t want to sync. I need to figure out a way to limit what files get syncronized. I can check file extention or mime type (assuming that checking the mime type does more than look at the extension). I also want to only syncronize music formats that the iPod support.

Checking that there is enough is critical, and there should be some kind of resolution progress if I’m trying to sync more data than the device can hold. I’m considering some kind of ‘conflict resolution’ dialog, so that if I can’t copy all of the music, the user can opt to not transfer files to the iPod, or let them open the iPod browser to remove some files.

Lastly, is there any processing we need to do on the file before we transfer it. This is more of a future enhancement (once the gstreamer-perl bindings are ready). Say you have an iPod mini that you use while jogging. For this, you’re more concerned with the quantity of music, rather than the quality. This option would let you to downgrade your music to a different format/bitrate so that you can fit more on a device.

I’ve found the Gnome2::VFS call to get the free space on the device. Once I decide on how check the file type (and I’m leaning towards mime type), I can calculate the needed space and then handle resolving any conflicts.

I’m working towards a 0.10 release sometime in the next week or so. I want to get the basics of syncronization working, so that I can get a few people to test that out while I start to add the bells and whistles like the iPod browser.