<?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/"
	>

<channel>
	<title>Dual Elephants &#187; Scripts</title>
	<atom:link href="http://www.adebenham.com/tag/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adebenham.com</link>
	<description>Always keep a spare for redundancy</description>
	<lastBuildDate>Sun, 21 Feb 2010 22:18:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Console-based podcaster &#8211; updated</title>
		<link>http://www.adebenham.com/2010/02/console-based-podcaster-updated/</link>
		<comments>http://www.adebenham.com/2010/02/console-based-podcaster-updated/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 21:43:29 +0000</pubDate>
		<dc:creator>cjd</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[bashpodder]]></category>

		<guid isPermaLink="false">http://www.adebenham.com/?p=52</guid>
		<description><![CDATA[It has been a while since I first posted my version of bashpodder (a console-based podcaster in a single bash script)
Since then a bunch of small fixes have been added to the script to better handle &#8216;odd&#8217; rss feeds and also to clean up the output.
The configuration of the script now sits in the file [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I first posted my version of bashpodder (a console-based podcaster in a single bash script)</p>
<p>Since then a bunch of small fixes have been added to the script to better handle &#8216;odd&#8217; rss feeds and also to clean up the output.</p>
<p>The configuration of the script now sits in the file ~/.bashpodder  Inside this file you can specify where the logs go to and where the files download to (makes it easier to run the script automatically)</p>
<p>Thanks to <cite>Mobilediesel</cite> it now also doesn&#8217;t create the temporary xslt file and there is the option to use &#8216;-a feedurl [items]&#8216; to add a feed to the config file.  The [items] parameter is optional and when used will cause bashpodder to mark all items in the feed as already downloaded <strong>except</strong> the last <em>[items]</em> items.  This is useful when added a new feed so that it doesn&#8217;t try to download every item in the feed since day one <img src='http://www.adebenham.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The updated script can be downloaded as <a href="/files/bashpodder/bashpodder.sh">bashpodder.sh</a> and an example config file as <a href="/files/bashpodder/.bashpodder">.bashpodder</a></p>
<p>For more details on the script see the original post <a href="http://www.adebenham.com/2009/03/console-based-podcatcher/">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adebenham.com/2010/02/console-based-podcaster-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Console-based podcatcher</title>
		<link>http://www.adebenham.com/2009/03/console-based-podcatcher/</link>
		<comments>http://www.adebenham.com/2009/03/console-based-podcatcher/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 07:12:25 +0000</pubDate>
		<dc:creator>cjd</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[bashpodder]]></category>

		<guid isPermaLink="false">http://www.adebenham.com/blog/?p=8</guid>
		<description><![CDATA[A few days ago I installed a new disk in my laptop to replace the existing small one. Being the careful person I am I backed up the important data and then migrated the contents from the old disk to the new one via rsync.  Everything worked well and I was able to boot into [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I installed a new disk in my laptop to replace the existing small one. Being the careful person I am I backed up the important data and then migrated the contents from the old disk to the new one via rsync.  Everything worked well and I was able to boot into the new disk right away without issue.  That is until I went to update the podcasts I listen to.</p>
<p>I had forgotten that I keep my podcasts (and the script I used to grab them) on a ZFS partition that I accessed via zfs-fuse (since I access it from linux)  Being the careful person I am I had forgotten to backup that partition <img src='http://www.adebenham.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>As such I was faced with re-constructing the script from memory or rewriting from scratch &#8211; I chose option 2.</p>
<p>I remember a while back finding a simple bash-based podcatcher called <a href="http://lincgeek.org/bashpodder" target="_blank">BashPodder</a> that I figured would be a good base. But the problem was that BashPodder is designed for running from a cronjob on a daily basis and offers no real display of status, no parallelism etc but it did know how to parse a rss feed and that is what I most wanted.</p>
<p>I took that script and then re-designed it for usage as a console application.  It now will fork a sub-process for each feed and download all the feeds in parallel while providing a status screen showing how much is download, the percent finished, the download rate, the estimated download time remaining and the filename for each feed.</p>
<p>Here is a sample output:</p>
<pre>    Down|Perc| Rate| Remain|Filename
-----------------------------------------------------------------
195600K| 70%| 110K| 23m12s|tekzilla--0080--itunes--large.xvid.avi
154550K| 33%| 254K|  1h48m|diggnation--0194--SXSW2009--large.xvid.avi
188050K| 34%| 165K|  1h41m|trs--0104--2years--large.xvid.avi
163100K| 77%| 167K| 15m32s|scamschool--0053--strapped--large.xvid.avi
150700K| 66%| 113K|  27m6s|systm--0095--benchmark--large.xvid.avi
</pre>
<p>Since I don&#8217;t run this from a cronjob and I can&#8217;t guarantee all the downloads will finish before I have to go offline it also allows you to press &#8216;q&#8217; to quit &#8211; at which time it tells each sub-process (via a control file) to stop downloading.  When you next run the script it will continue the download from wherever they were up to.  As such I no longer download the podcasts into a different directory each day &#8211; rather they all end up in a common directory to allow continuing downloads the next day.</p>
<p>Thanks to another control-file &#8211; which contains a count of the number of active downloads &#8211; the script doesn&#8217;t exit until all the sub-processes are done or have exited.  This control file sits in ~/.bashpodder_logs (which also contains the wget logs for active downloads and the list of files already downloaded)</p>
<p>The script reads from a file called &#8216;.bashpodder&#8217; in your home directory containing the URL of each feed (comments are allowed) and logs which files have been downloaded to a seperate logfile for each feed (based on a md5 hash of the feedurl &#8211; saves having to parse the url to make it filename safe) so as to not re-download them later</p>
<p>Since I lost all my previous data there was no existing list of downloaded files and so the script would proceed to try and download everything in the feeds.  To stop this I added a &#8216;catchup&#8217; mode which can be accessed using the &#8216;-c&#8217; option.  In this mode the script wouldn&#8217;t actually download anything but would act as if it did (and so log that the files were already downloaded). After running the script in catchup mode once I edited each of the logfiles and removed the last one or two entries.  Then when I finally ran the script normally it started downloading those episodes.</p>
<p>And now I am finally returning to normal!</p>
<p>The script can be see at <a href="/files/bashpodder/bashpodder.sh">bashpodder.sh</a></p>
<p>Here is a sample <a href="/files/bashpodder/.bashpodder">.bashpodder</a><a href="/debenham/resource/bashpodder/bp.conf"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adebenham.com/2009/03/console-based-podcatcher/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
