Click here to Skip to main content
6,822,613 members and growing! (20,468 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Windows Presentation Foundation » General     Intermediate License: The Code Project Open License (CPOL)

The WPF Podcatcher Series - Part 1 (Introducing Podder)

By Josh Smith

The first article in a series devoted to a WPF application that plays streaming podcasts off the Internet.
C# (C#3.0), .NET (.NET3.5), Visual-Studio (VS2008), XAML, WPF, LINQ, Architect, Dev
Posted:6 Jan 2008
Updated:6 Jan 2008
Views:45,638
Bookmarked:80 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
22 votes for this article.
Popularity: 6.34 Rating: 4.73 out of 5

1

2
1 vote, 4.5%
3
3 votes, 13.6%
4
18 votes, 81.8%
5
Podder_Screenshot.png

Introduction

Welcome to the first article in a series devoted to a WPF application I wrote, called Podder. Podder allows you to listen to podcasts streamed over the Web. The aim of this article is to introduce Podder and let people around the world start enjoying it. The goal of this entire series, however, is to review interesting aspects of Podder�s design and implementation.

At the time of this writing, the application is incomplete. There are still many features, both big and small, that I intend to add to Podder. However, it is far enough along at this point to get this series off the ground, so I decided that sooner is better than later. The file downloads, located at the top of this article, will most likely change every time there is a new article in the series. Podder is a living project.

Background

A podcast is like a radio show; it is a series of episodes recorded by the same person or people about some particular topic. It can contain any audio content, since it is just a regular audio file, such as MP3. An episode can contain interviews, monologues, music, the sound of one hand clapping, etc. Almost every podcast has an RSS feed associated with it, so that you can easily find all episodes in the podcast, and discover newly released episodes.

A podcatcher is a program that allows you to play podcast episodes. Most podcatchers allow you to subscribe to various podcast RSS feeds, and will automatically notify you when a new episode is available. Podder allows you to maintain a list of podcast RSS feeds, but does not yet provide any notifications when new episodes exist.

The Podder application was created after I had built two simple podcatcher prototypes; the first was in Silverlight and the other in WPF. Podder is much more sophisticated and feature-rich than those two prototypes, but they were excellent learning experiences necessary for me to figure out how to design Podder correctly.

Technologies Used

  • VS2008 & .NET 3.5
  • WPF
  • XLinq
  • C# 3.0

Podder Features

The application has the core features one might expect in a podcatcher, and a few extra bells and whistles that I enjoy using. Here is what you will find in Podder:

  • Store a list of podcast RSS feeds and view all available episodes
  • Stream episodes for immediate playback
  • Standard play, pause, and stop functionality
  • Seek through a podcast, like fast-forward and rewind
  • Indicate which episodes are your favorite, and view them in a �My Favorites� list. That list is persisted between runs of the application.
  • Remember which episodes you have already listened to because they are marked as �finished� when they complete. The list of finished episodes is persisted between runs.
  • Optionally play every episode in a podcast in an endless loop
  • Refresh the list of episodes in a podcast, which is useful for frequently updated podcast feeds
  • Open an episode in an external program (either a Web browser or an MP3 player, depending on the podcast)
  • Tooltip over episode item in ListView displays extra information such as publication date and file size
  • Window sizes, states, and positions persist between runs of the application
  • Various user interface settings persist between runs of the application
  • Pre-loaded with some podcasts, so new users can immediately start listening to episodes
  • Podder will eventually allow you to apply completely different user interfaces at runtime (a.k.a. �structural skinning�)

Picture Gallery

Here are some screenshots of Podder, using the default skin (at this point, it is the only skin). The first image shows the list of favorite episodes and a tooltip over an episode, displaying extra information about it.

Podder_Favorites.png

The next image shows the list of podcasts I have entered into Podder. Notice that the first item in the dropdown allows you to view the list of favorite episodes.

Podder_Podcasts.png

The screenshot below shows the context menu that appears when you right-click on an item in the ListView. The menu item allows you to open an episode in a Web browser or MP3 player, based on the URL provided in the podcast RSS feed�s <link> element. If it is a Web page URL, the page will open in your default browser. If it points directly to an audio file, it will open in your default audio player (such as Windows Media Player).

Podder_OpenInExternalProgram.png

The last image shows the dialog box used to add and remove podcasts to the application�s list of podcast RSS feeds. At the time of this writing, this dialog box does not provide any validation, but it will in a subsequent release.

Podder_ManagePodcasts.png

Points of Interest

There are many interesting things to explore in Podder. This section lists some of them, and the next articles in the series explore some of them in detail.

Structural Skinning

Podder supports what I call �structural skinning�. Structural skinning allows you to apply a completely new user interface to the application at runtime. You can replace all of the controls in the UI, as well as the color schemes, fonts, etc. It uses the Model-View-Controller (MVC) pattern, routed commands, collection views, and dynamic resource references to make this possible. A future article in this series will review this topic in depth. As of this writing, Podder does not have any additional skins, but it will soon.

EpisodePlayer

The application uses WPF�s MediaPlayer class to play episode MP3 files. I subclassed MediaPlayer to create EpisodePlayer, which encapsulates MediaPlayer manipulation and workaround for its quirks. A disproportionately large amount of my development effort was spent on working around strange behavior of MediaPlayer. I have ironed out all the issues, as best as I can.

Reading an RSS Feed with XLinq

A podcast�s RSS feed is just like any RSS feed, it is just an XML document. Since Podder was written against the .NET 3.5 Framework, I used XLinq to transform an RSS feed into instances of my Episode class. Using XLinq made the XML processing much easier.

Serializable Data Model

Podder does not use a database or XML file to save its data. When the window closes, it serializes the data model using BinaryFormatter and saves that binary stream to disk. When the application opens again, it deserializes the data in that file and the application then uses those objects.

The application�s domain classes are in the PodderLib project. Most of those classes derive from my BindableObject base class, which provides an implementation of INotifyPropertyChanged, amongst other things.

Persisted Window Settings

Both the main window and the �Manage Podcasts� dialog box remember their size, state, and location between runs of the app. They both derive from my ConfigurableWindow base class to gain that functionality for free. That class was built specifically for Podder, but can be used in any WPF program.

So Much More�

It is difficult to create a list of �interesting� aspects of an application�s code base, because everyone sees things differently. If you are interested in seeing what else Podder has to offer, I suggest you download the source code and explore it on your own. If you have any questions, feel free to leave a question or comment on this article�s message board.

Not Yet Implemented

  • Ability to dynamically discover and apply external skins
  • Awareness of an active Internet connection, or lack thereof
  • An improved Podcast management dialog
  • User-friendly error handling
  • An aesthetically pleasing UI
  • Notifications of when a new episode exists in one of your feeds
  • A whole lot more!

Special Thanks

Craig Shoemaker, the host of Polymorphic Podcast, provided a lot of helpful feedback, insightful suggestions, and encouragement.

Karl Shifflett helped a lot with testing and submitting bug reports. He also gave some tasteful feature requests.

Sacha Barber indirectly assisted because his article about XLinq helped me get up to speed with XLinq enough so that I could use it to parse RSS feeds.

Revision History

  • January 6, 2008 - Created the article

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Josh Smith


Member
Josh creates software, mostly with C# and XAML.

He works at IdentityMine as a Senior UX Developer.

He plays the music of J.S. Bach on the piano, but has started branching into other composers recently.

Get his runtime debugging and scripting tool, called Crack.NET, right here[^].

Download his WPF.JoshSmith library here[^]

You can check out his WPF blog here[^].

You can take his guided tour of WPF here[^].

You can check out a powerful debugger visualizer he worked on called Mole for Visual Studio here[^].

His Microsoft MVP profile can be viewed here[^].
Occupation: Software Developer (Senior)
Company: IdentityMine, Inc.
Location: United States United States

Other popular Windows Presentation Foundation articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 35 (Total in Forum: 35) (Refresh)FirstPrevNext
General[Message Removed] Pinmembernompel15:57 20 Sep '08  
NewsPodder v2 Has Been Released! PinmvpJosh Smith10:26 6 Mar '08  
GeneralQuestion on Data Binding Usage [modified] Pinmemberaerospaceboy10:37 3 Feb '08  
GeneralRe: Question on Data Binding Usage PinmvpJosh Smith11:01 3 Feb '08  
GeneralCool.... Pinmembermarlongrech12:33 7 Jan '08  
GeneralRe: Cool.... PinmvpJosh Smith12:42 7 Jan '08  
GeneralRe: Cool.... Pinmembermarlongrech13:03 7 Jan '08  
GeneralNice but... PinmemberRama Krishna Vavilala4:47 7 Jan '08  
GeneralRe: Nice but... [modified] PinmvpKarl Shifflett6:20 7 Jan '08  
GeneralRe: Nice but... PinmvpJosh Smith6:57 7 Jan '08  
GeneralI like the bindable object idea PinmvpSacha Barber8:29 7 Jan '08  
GeneralRe: I like the bindable object idea PinmvpJosh Smith8:50 7 Jan '08  
GeneralRe: I like the bindable object idea PinmvpSacha Barber10:14 7 Jan '08  
GeneralRe: I like the bindable object idea Pinmemberroland rodriguez12:06 7 Jan '08  
GeneralRe: I like the bindable object idea PinmvpJosh Smith12:14 7 Jan '08  
GeneralRe: I like the bindable object idea Pinmemberroland rodriguez12:19 7 Jan '08  
GeneralRe: I like the bindable object idea PinmvpJosh Smith12:25 7 Jan '08  
GeneralRe: I like the bindable object idea PinmemberMaximilian Hänel10:13 12 Apr '08  
GeneralRe: I like the bindable object idea PinmvpJosh Smith10:18 12 Apr '08  
GeneralRe: I like the bindable object idea PinmemberMaximilian Hänel2:28 14 Apr '08  
GeneralRe: I like the bindable object idea PinmvpJosh Smith6:06 15 Apr '08  
GeneralRe: I like the bindable object idea PinmemberMaximilian Hänel6:09 15 Apr '08  
GeneralRe: Nice but... PinmemberRama Krishna Vavilala10:23 7 Jan '08  
GeneralRe: Nice but... PinmvpJosh Smith10:35 7 Jan '08  
GeneralRe: Nice but... PinmemberRama Krishna Vavilala10:51 7 Jan '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.

PermaLink | Privacy | Terms of Use
Last Updated: 6 Jan 2008
Editor: Deeksha Shenoy
Copyright 2008 by Josh Smith
Everything else Copyright © CodeProject, 1999-2010
Web21 | Advertise on the Code Project