<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>maonet technotes &#187; podcast</title>
	<atom:link href="http://maonet.wordpress.com/category/podcast/feed/" rel="self" type="application/rss+xml" />
	<link>http://maonet.wordpress.com</link>
	<description>IOC(SM):MOC(RM):TDD(NU):SCC(TFS):ORM(L2S):JSL(Jq):CIS(CC)</description>
	<lastBuildDate>Thu, 31 Dec 2009 17:16:53 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='maonet.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/27569a47b055d3d0ff1d52cf3b0ce0d7?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>maonet technotes &#187; podcast</title>
		<link>http://maonet.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://maonet.wordpress.com/osd.xml" title="maonet technotes" />
		<item>
		<title>Add Cover picture to podcast</title>
		<link>http://maonet.wordpress.com/2009/03/09/add-cover-picture-to-podcast/</link>
		<comments>http://maonet.wordpress.com/2009/03/09/add-cover-picture-to-podcast/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 20:26:00 +0000</pubDate>
		<dc:creator>Frank Mao</dc:creator>
				<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://maonet.wordpress.com/?p=508</guid>
		<description><![CDATA[Checked the specs for podcast from apple, the image tag or itunes:image look only for the cover page for itunes store. Set it, I still can&#8217;t see pictures.
After 50 times re-tries, I suddenly realized that the image I&#8217;m looking for is called artwork of mp3, it&#8217;s not set by podcast feed at all, it&#8217;s right [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=maonet.wordpress.com&blog=431779&post=508&subd=maonet&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Checked the<a href="http://www.apple.com/itunes/whatson/podcasts/specs.html"> specs for podcast from apple</a>, the image tag or itunes:image look only for the cover page for itunes store. Set it, I still can&#8217;t see pictures.</p>
<p>After 50 times re-tries, I suddenly realized that the image I&#8217;m looking for is called artwork of mp3, it&#8217;s not set by podcast feed at all, it&#8217;s right in the mp3 file!!!</p>
<p>Scott H got <a href="http://www.hanselman.com/blog/AutomatingAddingITunesAlbumArtToMP3ID3TagsFromTheCommandLineInC.aspx">the solution</a> how to encode images into mp3. But for my case I need it running on linux.</p>
<p>Finally I found it, <a href="http://eyed3.nicfit.net/">eyeD3</a>,  a better help file can be found <a href="http://linux.die.net/man/1/eyed3">here</a>.</p>
<p>Had to using eyeD3 to upgrade idtag to v2.3 before add cover image for itunes display purpose.</p>
<p><a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">Putty</a> is way better than the sshclient I was using. Stable, copy&amp;paste support, and even more, colorful console!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/maonet.wordpress.com/508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/maonet.wordpress.com/508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/maonet.wordpress.com/508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/maonet.wordpress.com/508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/maonet.wordpress.com/508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/maonet.wordpress.com/508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/maonet.wordpress.com/508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/maonet.wordpress.com/508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/maonet.wordpress.com/508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/maonet.wordpress.com/508/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=maonet.wordpress.com&blog=431779&post=508&subd=maonet&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://maonet.wordpress.com/2009/03/09/add-cover-picture-to-podcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d41c3a25ca01f1e979e2bc86b8c4ed38?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">FMao</media:title>
		</media:content>
	</item>
		<item>
		<title>Some date standards in Ruby</title>
		<link>http://maonet.wordpress.com/2008/04/30/some-date-standards-in-ruby/</link>
		<comments>http://maonet.wordpress.com/2008/04/30/some-date-standards-in-ruby/#comments</comments>
		<pubDate>Thu, 01 May 2008 05:13:33 +0000</pubDate>
		<dc:creator>Frank Mao</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://maonet.wordpress.com/?p=113</guid>
		<description><![CDATA[
rfc822   &#8216;Tue, 1 Jul 2003 10:52:37 +0200&#8242;
rfc2616 (httpdate)  Tue, 05 Sep 2006 16:05:51 GMT
podcast use this.
d.strftime(&#8220;%a, %d %b %Y %H:%M:%S %z&#8221;)
iso8601 2001-04-17T19:23:17.201Z

code demo:
t = Time.at(1000000000) # =&#62; Sat Sep 08 21:46:40 EDT 2001
t.rfc822 # =&#62; &#8220;Sat, 08 Sep 2001 21:46:40 -0400&#8243;
t.httpdate # =&#62; &#8220;Sun, 09 Sep 2001 01:46:40 GMT&#8221;
t.iso8601 # =&#62; &#8220;2001-09-08T21:46:40-04:00&#8243;
Parse string to date
Say [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=maonet.wordpress.com&blog=431779&post=113&subd=maonet&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><ol>
<li>rfc822   &#8216;Tue, 1 Jul 2003 10:52:37 +0200&#8242;</li>
<li>rfc2616 (httpdate)  Tue, 05 Sep 2006 16:05:51 GMT<br />
podcast use this.<br />
d.strftime(&#8220;%a, %d %b %Y %H:%M:%S %z&#8221;)</li>
<li>iso8601 2001-04-17T19:23:17.201Z</li>
</ol>
<p>code demo:</p>
<blockquote><p>t = Time.at(1000000000) # =&gt; Sat Sep 08 21:46:40 EDT 2001<br />
t.rfc822 # =&gt; &#8220;Sat, 08 Sep 2001 21:46:40 -0400&#8243;<br />
t.httpdate # =&gt; &#8220;Sun, 09 Sep 2001 01:46:40 GMT&#8221;<br />
t.iso8601 # =&gt; &#8220;2001-09-08T21:46:40-04:00&#8243;</p></blockquote>
<p><strong>Parse string to date</strong></p>
<p>Say you have a string &#8216;080430&#8242;, you can not simply use</p>
<blockquote><p>Date::strptime(s, &#8216;%y/%m/%d&#8217;)</p></blockquote>
<p>to convert it to a Date type. (ArgumentError: 3 elements of civil date are necessary)</p>
<p>Had to split to to 3 parts, then do the convert.</p>
<p>s = &#8216;080204&#8242;<br />
s.sub!(/^(\d{2})(\d{2})(\d{2})$/, &#8216;\1/\2/\3&#8242;)<br />
d = Date::strptime(s, &#8216;%y/%m/%d&#8217;)<br />
How to convert a Date to Time?</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/maonet.wordpress.com/113/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/maonet.wordpress.com/113/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/maonet.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/maonet.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/maonet.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/maonet.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/maonet.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/maonet.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/maonet.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/maonet.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/maonet.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/maonet.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=maonet.wordpress.com&blog=431779&post=113&subd=maonet&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://maonet.wordpress.com/2008/04/30/some-date-standards-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d41c3a25ca01f1e979e2bc86b8c4ed38?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">FMao</media:title>
		</media:content>
	</item>
		<item>
		<title>Convert charset from GB2312 to Unicode in Ruby</title>
		<link>http://maonet.wordpress.com/2007/11/27/convert-charset-from-gb2312-to-unicode-in-ruby/</link>
		<comments>http://maonet.wordpress.com/2007/11/27/convert-charset-from-gb2312-to-unicode-in-ruby/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 05:47:04 +0000</pubDate>
		<dc:creator>Frank Mao</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://maonet.wordpress.com/2007/11/27/convert-charset-from-gb2312-to-unicode-in-ruby/</guid>
		<description><![CDATA[Every Moday, a radio station in Sigapore will upload a new epsiode of their Movie Review program, one of my favorate podcasts. Unfortunately, they only update the html page part, the podcast feed updating usually happens days later.
I can&#8217;t wait that long, so I wrote my Ruby program to rip their html page, get mp3 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=maonet.wordpress.com&blog=431779&post=49&subd=maonet&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Every Moday, a radio station in Sigapore will upload a new epsiode of their Movie Review program, one of my favorate podcasts. Unfortunately, they only update the <a href="http://www.rsi.sg/html/chinese/apodcast_updates/movie.htm">html page part,</a> <a href="http://www.podcast.sg/rsi_chinese/Movie_Reviews/movie_feed.xml">the podcast feed</a> updating usually happens days later.</p>
<p>I can&#8217;t wait that long, so I wrote my Ruby program to rip their html page, get mp3 url, and then, to generate a latest podcast feed used by my itunes.</p>
<blockquote><p>mc = MovieCafe.new<br />
mc.get_mp3_list</p>
<p>newitem = mc.mp3_list.first</p>
<p>if newitem.mp3_url != mc.rss.items.first.enclosure.url<br />
#item = RSS::Rss::Channel::Item.new<br />
item = mc.rss.items.first<br />
item.title = newitem.title<br />
item.enclosure.url = newitem.mp3_url</p>
<p>item.description = newitem.description<br />
item.pubDate = Time.now</p>
<p>mc.rss.items.push(item)</p>
<p>mc.rss.channel.lastBuildDate = Time.now<br />
endputs mc.generate_feed</p></blockquote>
<p>The problem I got was, the charset from html is gb2312, while the podcast feed is utf-8. I had to covert charset. Eventually, I made it:</p>
<blockquote><p>require &#8216;iconv&#8217;</p>
<p>title = Iconv.new(&#8220;UTF-8&#8243;,&#8221;gbk&#8221;).iconv(title)</p></blockquote>
<p>Here is <a href="http://feeds.feedburner.com/moviecafe">my podcast feed of Movie Review channel,</a> at least 2 days newer then its offical one.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/maonet.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/maonet.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/maonet.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/maonet.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/maonet.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/maonet.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/maonet.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/maonet.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/maonet.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/maonet.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/maonet.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/maonet.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=maonet.wordpress.com&blog=431779&post=49&subd=maonet&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://maonet.wordpress.com/2007/11/27/convert-charset-from-gb2312-to-unicode-in-ruby/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d41c3a25ca01f1e979e2bc86b8c4ed38?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">FMao</media:title>
		</media:content>
	</item>
		<item>
		<title>Parse and generate podcast rss feed using Ruby</title>
		<link>http://maonet.wordpress.com/2007/11/23/parse-and-generate-podcast-rss-feed-using-ruby/</link>
		<comments>http://maonet.wordpress.com/2007/11/23/parse-and-generate-podcast-rss-feed-using-ruby/#comments</comments>
		<pubDate>Fri, 23 Nov 2007 17:03:06 +0000</pubDate>
		<dc:creator>Frank Mao</dc:creator>
				<category><![CDATA[Rss]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://maonet.wordpress.com/2007/11/23/parse-and-generate-podcast-rss-feed-using-ruby/</guid>
		<description><![CDATA[I am a podcaster, audio only. The first thing after I wake up every morning is to sync my iPod/iShuffle. Recently, I noticed one of my favorite channels failed in update. Later I figured out the reason is the podcast owner put too many items in their rss feed. Even it was only 66 items, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=maonet.wordpress.com&blog=431779&post=47&subd=maonet&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I am a podcaster, audio only. The first thing after I wake up every morning is to sync my iPod/iShuffle. Recently, I noticed one of my favorite channels failed in update. Later I figured out the reason is the podcast owner put too many items in their rss feed. Even it was only 66 items, but due to the source is from Singapore, the slow network also kill the podcast sync.</p>
<p>I need to find a way to re-generate their podcast rss feed then.</p>
<p>Start thinking of php, then python, finally I chose Ruby. A few more resources than the other two. The example to parse and generate the regular rss feed using ruby is not hard to find. But, there is only <a href="http://www.subelsky.com/2007/08/roll-your-own-podcast-feed-with-rails.html">one demo</a> of how to generate itunes feed, which is using a rss lib created by <a href="http://www.cozmixng.org/~kou/download/">a Japanese guy,  須藤功平(Kouhei Sutou)</a>.</p>
<p>My re-generate code looks like this:</p>
<blockquote><p> require &#8216;rss/itunes&#8217;<br />
require &#8216;open-uri&#8217;</p>
<p># url of original rss feed<br />
source = &#8220;http://podcast.overseakids.com/moviecafe/index.xml&#8221;<br />
content = &#8220;&#8221; # raw content of rss feed will be loaded here</p>
<p># read rss feed<br />
open(source) do |s| content = s.read end<br />
rss = RSS::Parser.parse(content, false)</p>
<p># start re-genereat the podcast rss feed<br />
feed = RSS::Rss.new(&#8220;2.0&#8243;)</p>
<p>feed.channel = rss.channel</p>
<p># only keep the top 5 items, slice the rest of them<br />
feed.channel.items.slice!( 5 ,feed.channel.items.size &#8211; 1 )</p>
<p>puts feed.to_s</p></blockquote>
<p>When I tried to run this code on my DH share host,  it failed due to no rss lib installed. I don&#8217;t have root rights, then I found <a href="http://blog.nanorails.com/articles/2006/8/12/install-your-own-ruby-on-a-shared-host">another way</a> to install my own Ruby on DH.</p>
<p>One lesson I learn from last night is, after download lastest ruby bin package using wget and the following installation:</p>
<blockquote>
<pre><code>./configure prefix=[YOUR_OWN_RUBY_PREFIX]</code>
make
make install</pre>
</blockquote>
<p>I moved the ruby folder into another place I think it&#8217;s more appropriate. That extra action almost drove me nuts, I got &#8216;Unable to find rbconfig.rb&#8217; problem later when I tried to run any &#8217;setup.rb&#8217; code.</p>
<p>I looked into ruby/lib folder, there are some file with hard code path info in it. So I decided re-do my installation procedure. The problem went away.</p>
<p>To tell which ruby you are running, run: which ruby. What a natural command!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/maonet.wordpress.com/47/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/maonet.wordpress.com/47/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/maonet.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/maonet.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/maonet.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/maonet.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/maonet.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/maonet.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/maonet.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/maonet.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/maonet.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/maonet.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=maonet.wordpress.com&blog=431779&post=47&subd=maonet&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://maonet.wordpress.com/2007/11/23/parse-and-generate-podcast-rss-feed-using-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d41c3a25ca01f1e979e2bc86b8c4ed38?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">FMao</media:title>
		</media:content>
	</item>
	</channel>
</rss>