<?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>blog.autopsy.se &#187; iPhone</title>
	<atom:link href="http://blog.autopsy.se/tag/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.autopsy.se</link>
	<description>basically; it sucks. everything sucks. but.. in a good way..</description>
	<lastBuildDate>Mon, 02 Aug 2010 16:14:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Converting audiobooks to m4b sucks!</title>
		<link>http://blog.autopsy.se/2009/02/converting-audiobooks-to-m4b-sucks/</link>
		<comments>http://blog.autopsy.se/2009/02/converting-audiobooks-to-m4b-sucks/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 13:50:22 +0000</pubDate>
		<dc:creator>ube</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Audiobooks]]></category>
		<category><![CDATA[faac]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[mpg321]]></category>

		<guid isPermaLink="false">http://blog.autopsy.se/?p=75</guid>
		<description><![CDATA[Ok, I download stuff from the internet so sue me! Since I'm an iSheep I want to use my iPod/iPhone to listen to to my audiobooks that I download. The problem with this is that all releases are in MP3 format and this messes up my play lists when doing a shuffle of all songs; [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I download stuff from the internet so <a title="sue me!" href="http://www.thelocal.se/tag/Pirate_Bay" target="_blank">sue me!</a> Since I'm an iSheep I want to use my iPod/iPhone to listen to to my audiobooks that I <a title="download" href="http://thepiratebay.org" target="_blank">download</a>. The problem with this is that all releases are in MP3 format and this messes up my play lists when doing a shuffle of all songs; all of a sudden there is a chapter from an audiobook read. So, what to do. A cupple of months ago I wrote a script that converted m3u to m4b, and now I've rewritten it. So, here it is! Execute the script with directory-with-m3u-files as argument.</p>
<p><span id="more-75"></span></p>
<pre class="perl"><span style="color: #808080; font-style: italic;">#!/usr/bin/perl</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> File::<span style="color: #006600;">Basename</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@m3u</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@files</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$f</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$count</span> = <span style="color: #cc66cc;">1</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$discs</span>;
<a href="http://perldoc.perl.org/functions/opendir.html"><span style="color: #000066;">opendir</span></a><span style="color: #66cc66;">&#40;</span>DIR, <span style="color: #0000ff;">$ARGV</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">or</span> <a href="http://perldoc.perl.org/functions/die.html"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Can't open <span style="color: #000099; font-weight: bold;">\&quot;</span>$ARGV[0]<span style="color: #000099; font-weight: bold;">\&quot;</span>!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">@files</span> = <a href="http://perldoc.perl.org/functions/readdir.html"><span style="color: #000066;">readdir</span></a><span style="color: #66cc66;">&#40;</span>DIR<span style="color: #66cc66;">&#41;</span>;
<a href="http://perldoc.perl.org/functions/closedir.html"><span style="color: #000066;">closedir</span></a><span style="color: #66cc66;">&#40;</span>DIR<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$path</span> = <span style="color: #0000ff;">$ARGV</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$f</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">@files</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> ! -d <span style="color: #0000ff;">$f</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$f</span> =~ <a href="http://perldoc.perl.org/functions/m.html"><span style="color: #000066;">m</span></a>/^.*\.m3u$/<span style="color: #66cc66;">&#41;</span> &amp;&amp; ! <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$f</span> =~ <a href="http://perldoc.perl.org/functions/m.html"><span style="color: #000066;">m</span></a>/^<span style="color: #cc66cc;">0000</span>.*$/<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                        <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">@m3u</span>, <span style="color: #0000ff;">$f</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0000ff;">@m3u</span> = <a href="http://perldoc.perl.org/functions/sort.html"><span style="color: #000066;">sort</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">@m3u</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$discs</span> = <span style="color: #0000ff;">@m3u</span>;
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Found $discs m3u files.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
<span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$m</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">@m3u</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@data</span>;
        <span style="color: #0000ff;">$file</span> = <span style="color: #0000ff;">$m</span>;
        <span style="color: #0000ff;">$file</span> =~ <a href="http://perldoc.perl.org/functions/s.html"><span style="color: #000066;">s</span></a>/^<span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span>\..*/\<span style="color: #cc66cc;">1</span>/;
        <span style="color: #0000ff;">$outfile</span> = <span style="color: #0000ff;">$file</span>.<span style="color: #ff0000;">&quot;.m4b&quot;</span>;
        <a href="http://perldoc.perl.org/functions/open.html"><span style="color: #000066;">open</span></a> ID3, <span style="color: #ff0000;">&quot;&lt;$ARGV[0]/$m&quot;</span> <span style="color: #b1b100;">or</span> <a href="http://perldoc.perl.org/functions/die.html"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;File <span style="color: #000099; font-weight: bold;">\&quot;</span>$ARGV[0]/$m<span style="color: #000099; font-weight: bold;">\&quot;</span> not found!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #009999;">&lt;ID3&gt;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">@data</span>,<span style="color: #0000ff;">$_</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
        <a href="http://perldoc.perl.org/functions/close.html"><span style="color: #000066;">close</span></a><span style="color: #66cc66;">&#40;</span>ID3<span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> -f tmpfile <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;tmpfile found.. Deleteing<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
                <a href="http://perldoc.perl.org/functions/unlink.html"><span style="color: #000066;">unlink</span></a><span style="color: #66cc66;">&#40;</span>tmpfile<span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
        <a href="http://perldoc.perl.org/functions/open.html"><span style="color: #000066;">open</span></a><span style="color: #66cc66;">&#40;</span>TMPFILE, <span style="color: #ff0000;">&quot;&gt;tmpfile&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$line</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">@data</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$line</span> =~ <a href="http://perldoc.perl.org/functions/m.html"><span style="color: #000066;">m</span></a>/^<span style="color: #808080; font-style: italic;">#.*/ ) {</span>
                <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$line</span> !=~ <a href="http://perldoc.perl.org/functions/m.html"><span style="color: #000066;">m</span></a>/.*\.rar.*/ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                                <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> TMPFILE <span style="color: #ff0000;">&quot;$path/$line&quot;</span>;
                        <span style="color: #66cc66;">&#125;</span>
                <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
        <a href="http://perldoc.perl.org/functions/close.html"><span style="color: #000066;">close</span></a><span style="color: #66cc66;">&#40;</span>TMPFILE<span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$id3</span> = `head <span style="color: #cc66cc;">-1</span> tmpfile`;
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Getting id3-data from $id3<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
        <span style="color: #0000ff;">@id3</span> = `id3v2 --list <span style="color: #0000ff;">$id3</span>`;
        <span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$line</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">@id3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$line</span> =~ <a href="http://perldoc.perl.org/functions/m.html"><span style="color: #000066;">m</span></a>/^TALB.*/ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #0000ff;">$TITLE</span> = <span style="color: #0000ff;">$line</span>;
                        <span style="color: #0000ff;">$TITLE</span> =~ <a href="http://perldoc.perl.org/functions/s.html"><span style="color: #000066;">s</span></a>/^.*: <span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span>\n$/\<span style="color: #cc66cc;">1</span>/;
                <span style="color: #66cc66;">&#125;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$line</span> =~ <a href="http://perldoc.perl.org/functions/m.html"><span style="color: #000066;">m</span></a>/^TPE1.*/ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #0000ff;">$AUTH</span> = <span style="color: #0000ff;">$line</span>;
                        <span style="color: #0000ff;">$AUTH</span> =~ <a href="http://perldoc.perl.org/functions/s.html"><span style="color: #000066;">s</span></a>/^.*: <span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span>\n$/\<span style="color: #cc66cc;">1</span>/;
                <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Got:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Title:  $TITLE<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Author: $AUTH<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Output: $outfile<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Converting..<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
        <a href="http://perldoc.perl.org/functions/system.html"><span style="color: #000066;">system</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;mpg321 -@ tmpfile -q -w - | faac -w --disc <span style="color: #000099; font-weight: bold;">\&quot;</span>$count/$discs<span style="color: #000099; font-weight: bold;">\&quot;</span> --track <span style="color: #000099; font-weight: bold;">\&quot;</span>1/1<span style="color: #000099; font-weight: bold;">\&quot;</span> --artist <span style="color: #000099; font-weight: bold;">\</span>
<span style="color: #000099; font-weight: bold;">\&quot;</span>$AUTH<span style="color: #000099; font-weight: bold;">\&quot;</span> --title <span style="color: #000099; font-weight: bold;">\&quot;</span>$TITLE<span style="color: #000099; font-weight: bold;">\&quot;</span> --album <span style="color: #000099; font-weight: bold;">\&quot;</span>$TITLE<span style="color: #000099; font-weight: bold;">\&quot;</span> --writer  <span style="color: #000099; font-weight: bold;">\&quot;</span>$AUTH<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\</span>
--genre <span style="color: #000099; font-weight: bold;">\&quot;</span>Audiobook<span style="color: #000099; font-weight: bold;">\&quot;</span> -o <span style="color: #000099; font-weight: bold;">\&quot;</span>$file.m4b<span style="color: #000099; font-weight: bold;">\&quot;</span> - &quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #0000ff;">$count</span>++;
<span style="color: #66cc66;">&#125;</span>
        <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Done, I think.. Have a nice day!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.autopsy.se/2009/02/converting-audiobooks-to-m4b-sucks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SJ sucks!</title>
		<link>http://blog.autopsy.se/2008/12/sj-sucks/</link>
		<comments>http://blog.autopsy.se/2008/12/sj-sucks/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 14:17:53 +0000</pubDate>
		<dc:creator>ube</dc:creator>
				<category><![CDATA[On the road]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Traveling]]></category>

		<guid isPermaLink="false">http://blog.autopsy.se/2008/12/19/sj-sucks/</guid>
		<description><![CDATA[Here in Sweden there are two train companies, Tågkompaniet and SJ. I'm on a train operated by the latter.. In first class you get free internet, so now I'm entering this post from my iPhone.. Kinda ok appart from the problem with writing in english with a swedish dictionary. When I type "a" it becomes [...]]]></description>
			<content:encoded><![CDATA[<p>Here in Sweden there are two train companies, Tågkompaniet and SJ. I'm on a train operated by the latter.. In first  class you get free internet, so now I'm entering this post from my iPhone.. Kinda ok appart from the problem with writing in english with a swedish dictionary. When I type "a" it becomes "å" (river in swedish), I erase and type "a" again and my phone tries to be helpfull and corrects it to "att" (to in swedish).. Well, I know I could change the keyboard to english, but where does that leave me when I'm texting?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.autopsy.se/2008/12/sj-sucks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
