Friday, January 11, 2013

Publish a Podcast from Your Local Mac

I've always had a slight interest in presenting onstage. I have coworkers who do presentations. I worked in a school, they sometimes presented the change to "present" in front of an audience. I now work with a company with a consultant who does many classes and presentations of a technical nature. Yet for reasons that don't relate to the topic at hand, I haven't really worked on stage to give a presentation.
I'm a little strange in that when I have an interest in something, I usually try to do due diligence. Namely, research. I have some books on the shelf I've yet to read on presentations, for example.

Then the other day I was talking to a coworker known for doing technical talks and mentioned the honing of presentation skills. He suggested a podcast that had a series of episodes about giving professional presentations, and forwarded me the link with the "presentation" tag filtering results.
The podcasts were filtered; it wasn't a podcast about giving presentations, but rather a few episodes out of several where the topic happened to be about giving presentations.

Instead of subscribing to the podcasts' main feed, I downloaded the MP3's. Now I had the podcasts I wanted to listen to, but only as audio files.

The easy way to listen to them would be to import them to iTunes as music, then create a playlist just for those audio files and then telling iTunes to sync that playlist with my iPhone for later listening on the go.

While this would work, it meant that the "songs" end up getting shuffled in with other songs as any other audio track, and it would be played separately from the rest of my podcasts. I was also bugged by the fact that this interrupted my usual podcast workflow; listening to the podcast audio wouldn't mark it for "deletion" so it would be taken out of the listening rotation.
I lamented this to the same coworker when he gave some brilliant advice. Just serve it from your local machine with an XML file.

Well, it takes a little more work than that, but here's how I did it on OS X 10.8.2.

First, it seems that iTunes needs to grab the files from a web server. OS X happens to come with a web server, but the old way of turning on "web sharing" has been removed. To enable a simple Apache setup, open a terminal and create a conf file for your user:

sudo nano /etc/apache2/users/username.conf

...where "username" is obviously your username. In that file add the following block.

<Directory "/Users/username/Sites/">
Options Indexes Multiviews
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
</Directory>


...where again the "username" is your username. Then start the web server.

sudo apachectl start

At this point opening your web browser and entering "http://127.0.0.1" in the address bar should give you an "it works" message. If you go to http://127.0.0.1/~username" it should give you a little intro ditty to web page serving. Neat, huh?

This is a very limited web server; no database stuff, no bells and whistles, just a very bare-bones configuration. But I'm not looking to host a world-class website. I just wanted to turn those podcast audio files into an RSS feed for iTunes.

Next I created a subdirectory in ~/Sites called presentation_mp3 and copied the MP3 files to it. Now opening http://127.0.0.1/~bsilver/presentation_mp3 in my browser gave me a list of MP3 files.

Now the fun part, XML! I created a file called ~/Sites/podcast.xml. In it, I placed the following:

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">

  <channel>

    <title>Podcast Presentations</title>
    <description>Tips and Tricks for Delivering Killer Presentations</description>
    <link>http://127.0.0.1/~username/presentation_mp3</link>
    <language>en-us</language>
    <copyright>Copyright 2013</copyright>
    <lastBuildDate>Wed, 9 Jan 2013 11:30:00 -0501</lastBuildDate>
    <pubDate>Wed, 9 Jan 2013 11:30:00 -0500</pubDate>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <webMaster>MyEmail@myemail.com</webMaster>

<item>
<title>Killer Presentations</title>
<link>http://127.0.0.1/~username</link>
<guid>http://127.0.0.1/~username/presentation_mp3/Killer_presentation.mp3</guid>
<description> How to give a killer presentation!</description>
<enclosure url="http://127.0.0.1/~username/presentation_mp3/Killer_presentation.mp3" length="24308496" type="audio/mpeg"/>
<category>Podcasts</category>
<pubDate>Wed, 9 Jan 2012 11:30:00 -0500</pubDate>
</item>

</channel>

</rss>


I based this off a template from this website, although for simplicity I didn't include the nice iTunes-compatible yet optional bits. I used the above as a template, adding a new <item> for each MP3 file, altering the "length" to correspond to the size of the file in the directory and the pubDate and description as necessary. You should be able to puzzle out from the above what things would need to be customized, at least to a point where it would work. The file was saved to ~/Sites/podcast.xml.

Once these were set, I opened iTunes and clicked File -> Subscribe to Podcast.

In the URL box I entered, "http://127.0.0.1/~username/podcast.xml", without the quotes.

Then I told iTunes to update the podcast and it downloaded them. Ta-da!

I should note that activating Apache means that others can connect to your machine's web server, so beware of taking it onto untrusted networks (if you're worried, use sudo apachectl stop to stop the server when going out.) Always keep your system up to date, kids! The open port 80 doesn't seem to show up under the sharing system preference, and it is accessible even with the firewall on. If you're worried, you may want to change the accessibility in the conf file.

In the off chance that someone else will read this and cringe at how horrible my XML file was, or get irritated that I didn't include particular options or any of a half-dozen other things I neglected to do properly, keep in mind that this was a quick-and-dirty way to get a series of audio files inserted into my podcast feed. If I were working on an actual podcast meant for public consumption I would have taken far more time prettifying everything and making each episode have more than a rudimentary description, not to mention hosting it on an actual podcast service.
That said, if there are improvements I should use feel free to leave suggestions. I was primarily looking for a quick and easy way to make iTunes act like a series of MP3's I downloaded were regular podcasts so I could listen to them in the same way I listen to other podcasts instead of squeezing them into music playlists, and ended up doing it by turning my laptop into a portable web server.

Any suggestions for improvements?

No comments:

Post a Comment