Showing posts with label gpodder. Show all posts
Showing posts with label gpodder. Show all posts

Thursday, February 7, 2008

gPodder Configuration Editor

I've had the idea of implementing some kind of about:config-like configuration editor for gPodder for some time now. Not only does it give a nice live view of the current configuration settings, it also makes it possible to edit some configuration values that were previously only available by editing ~/.config/gpodder/gpodder.conf by hand.

Apart from that, we might be able to strip down the preferences dialog to only the really important settings and leave everything else in the "advanced" configuration editor :) I think the interface is quite nice and even looks nicer than the real about:config editor. As with Mozilla's about:config editor, this also marks the settings that have been modified from their default value in bold.

Monday, January 21, 2008

gPodder, the N800 and Bluetooth

I've just added support for Bluetooth File Transfer to the development version of gPodder. With this, you will be able to send (and convert) Video Podcasts from within gPodder directly to your Nokia Internet Tablet (or any other Bluetooth device). Of course, there is also support for converting videos before they are transferred over Bluetooth, so you will have good performance on the device, independent on which format the Video Podcast is in.

What you need:
After that, you simply configure your Bluetooth device in the preferences and select the "tablet-encode" script as a converter. Then, subscribe to some nice Video Podcast and transfer the downloaded episodes by right-clicking on the episode and choosing "Send to bluetooth device" from the popup menu.

Thursday, November 8, 2007

Episode selector dialog for gPodder

Today after University, I decided to hack a feature into gPodder that I have thought about for a while - the episode selector dialog. It should be used in several user interaction situations where a simple binary question is not specific enough ("delete old episodes?" vs "which of these old episodes do you really want to remove?"). So I set out implementing this neat little feature and when I looked at the watch and decided that I had to leave for math classes, most of the episodes selector has been implemented, with quite some fancy features and options. I used the last two hours to look through the my working copy diff to fix some obvious omissions, but as of now, the code of the new episode selector is already in SVN. I've attached some screenshots so you can see how it looks.

Thanks to lambda expressions, PyGTK coolness and getattr, i.e. accessing attributes by name, this dialog is now quite customizable and the code is still readable and (compared to what other languages would have yielded), small. If you are using gPodder, be sure to check out the current SVN trunk head.

One feature I used several times was enumerate() - you give an iterable as parameter, and get a generator that yields tuples with two elements - a zero-based index and the values you would normally get from the iterables directly. So, instead of writing code like this:
index = 0
for item in items:
print 'item %d is %s' % ( index, item )
index += 1
you can simply write
for index, item in enumerate( items):
print 'item %d is %s' % ( index, item )
which isn't only nicer, but you save two lines and the code is IMHO more readable (you instantly recognize "index" as being related to the for loop in the second code snippet).

Wednesday, September 26, 2007

PyGTK applications on Windows

One advantage that you automatically gain when writing Python programs is that they are portable to several other mainstream operating systems (although there are some problems with specific extensions, etc..).

So, after releasing gPodder 0.10.0, which has now only one strict dependency on a pure Python module (feedparser), I wanted to try out if I could get gPodder running on Windows (I have tried it once before, but back then I was spawning a wget process to do the actual downloading, which was kind of awkward on the Windows platform).

What you need to get this working is Alberto Ruiz' All-in-one PyGTK Win32 installer and a check-out of the current SVN trunk head of gPodder. To check out a working copy from a Subversion repository on Win32, you can use TortoiseSVN.


I've found some divide-by-zero errors that I didn't see happening on Linux, so I could quickly fix them in our Subversion repository. I also got rid of some old symlinking code that I didn't use anymore, because symlinks on Windows isn't really possible (except for Vista maybe). Other than that, there were just some minor problems with my code being Unix/X11-specific, for example I'm checking for the $DISPLAY variable in the main script, which isn't needed on Win32.

There were other minor annoyances which I haven't dealt with yet, but which don't interfere with the basic functionality of gPodder:
  • Running .mp3 or .avi files with the preferred media player (how do I do that on Win32?)
  • Getting a GTK Icon Theme into my GTK installation, so all icons in gPodder display properly
  • Removing the GUI for iPod synchronization (or get libgpod + Python bindings working on Win32)
  • Testing, testing testing :)
I wonder if it's possible to use Py2exe to create a nice, self-contained Win32 package of gPodder that has Python2.5, the GTK runtime, PyGTK and python-feedparser integrated and works without installing anything.

Sunday, August 26, 2007

Simplifying gPodder website navigation

Today, I've updated the gPodder website (navigation) to be more usable and easier to navigate. I've added stock Gnome icons and moved some previously top-level items into the "documentation" menu item or elsewhere. This makes navigation easier and the design also looks a bit more modern, have a look:



You can find the new gPodder website at the usual location: http://gpodder.berlios.de/. Oh, and by the way: I've just released a new version (0.9.5) today, so if you're using gPodder, be sure to check out the new release.

Sunday, August 5, 2007

Python Import Hell

Coming from a Java background to Python about two years ago, I suppose I confused Python packages and modules a bit (compare Java's packages and classes - it's a different thing!). Anyway, gPodder's current module and package structure is a bit uncoordinated, partly because I started out with the module layout early in my Python carreer and partly because I sometimes added classes where they shouldn't be placed, resulting in circular imports. I somehow managed to fix all import errors and it runs for quite a while with that layout now.

After Pierre-Luc Beaudoin informed me that his Sofa Media Center now uses gPodder as its podcast client/backend, and after looking at Pierre-Luc's code, I thought it would be good to provide some kind of gPodder API for other developers to build upon the gPodder functionality. This way, gPodder would be a modular app with a GUI, but it could also function as simple podcast client library (if needed).

So, yesterday, I started to restructure the gPodder package/module layout a bit. While doing this, I had some problems with circular imports. The problem was that I had a "gpodder" module in the "gpodder" package, and Python 2.4's "import" statement first searches the current package and then the "global" package/module path. I read about Python's built-in Package support that is available since Python 1.5. Great! But it already mentions that there could be problems with relative imports. Another article entited Importing Python Modules then explained the partly confusing import hell of Python. The article says one should "always use import X" (except for some special cases).

Circular imports can often easily be avoided by placing depended-on code in seperate modules. It's also good to see that this problem is partly solved by PEP 328, which is (optionally) available starting with python 2.5, throws a warning and 2.6 and will be the default in Python 2.7: Absolute imports. This way, naming a package-local module like a top-level package will not result in confusion. One can either use "import X" to do an absolute import or do "from . import X" to do a relative import. Currently (Python 2.4), "import X" will prefer the local module over a global package/module with the same name. Confusing, isn't it?

Wednesday, July 11, 2007

Subscribing to podcasts in gPodder

Until today, gPodder users were presented the same dialog for adding and editing "channels" (i.e. podcast subscriptions). When adding a channel, only the URL was needed, so all other UI elements were simply hidden in the dialog. As adding a channel only involves entering one URL, and as our new, shiny channel navigator adds some free space in the lower left corner of the window, I decided to re-work the GUI, inspired by Tasks's main window. Here's the difference:

Of course, with this change, I also had the chance to revise the channel edit dialog a bit (remember, it's the same dialog, used for both adding and editing). Apart from stripping out unneeded code and re-factoring the code, I've tried to make the dialog a bit more pleasant to use. For one, I've removed the cancel button and changed the "OK" button into a "Close" button.

I hope you like the changes and it makes using gPodder a little bit more pleasant. Time to roll another release some time soon..

Wednesday, July 4, 2007

gPodder gets new channel navigator

My PyGTK pet project, gPodder is currently receiving a bit of a face-lift for its main window. After Carlos Moffat has raised some concern about the usability when being subscribed to many channels and suggested a "sidebar".
So, I first added some unread episodes information to the channel drop down list, so one can easily see where new episodes are to be found. Two e-mails later, I thought I should improve this a bit more and added a gtk.TreeView and a gtk.HPaned onto the Podcasts tab, displaying the top gtk.ComboBox's contents (thanks to the reusability of Gtk's TreeModel structures) in the left pane.

The next step was adding a bit more design to the whole UI, and while fixing many bugs that cropped up while testing the new interface (and cleaning up the source code, for example unifying the new episodes algorithm into a single function), I finally had a nice-looking interface that gives the user much more information about the subscribed channels and new episodes. By using the channel's iTunes cover image (if available) as icon, a user can easily recognize specific podcast channels if the list is huge. Adding a bit of the channel's description below its title also gives a better overview over one's channels. The number in the sidebar tells us how many new podcast episodes are available for the channel. Here's how it looks currently:

The code should be available in gPodder's Subversion repository in the upcoming days after I've cleaned up the commit a bit. Enjoy :)