<?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>WHMCR &#187; Android</title> <atom:link href="http://www.whmcr.com/category/android/feed/" rel="self" type="application/rss+xml" /><link>http://www.whmcr.com</link> <description>Just another WordPress site</description> <lastBuildDate>Tue, 06 Dec 2011 16:48:41 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>iPhone to Android SMS Converstion Script</title><link>http://www.whmcr.com/2010/05/25/iphone-to-android-sms-converstion-script/</link> <comments>http://www.whmcr.com/2010/05/25/iphone-to-android-sms-converstion-script/#comments</comments> <pubDate>Tue, 25 May 2010 10:56:29 +0000</pubDate> <dc:creator>welby</dc:creator> <category><![CDATA[Android]]></category> <category><![CDATA[Apple]]></category> <category><![CDATA[Hardware]]></category> <category><![CDATA[iPhone]]></category> <category><![CDATA[Andorid]]></category> <category><![CDATA[Linux]]></category><guid
isPermaLink="false">http://www.whmcr.com/?p=134</guid> <description><![CDATA[As promised here&#8217;s a copy of my iPhone to Android script. Just a quick and dirty python script that reads in a backup from itunes and converts it to a bit of XML able to be read in by SMS Backup and &#8230; <a
href="http://www.whmcr.com/2010/05/25/iphone-to-android-sms-converstion-script/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>As promised here&#8217;s a copy of my iPhone to Android script. Just a quick and dirty python script that reads in a backup from itunes and converts it to a bit of XML able to be read in by SMS Backup and Restore on the android platform</p><div
class="my_syntax_box"><span
class="my_syntax_selecall"><a
href="javascript:;" onclick="selectCode(this); return false;">Selec All</a> </span><span
class="my_syntax_Bar">Code:</span><div
class="my_syntax"><div
class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> sqlite3 <span style="color: #ff7700;font-weight:bold;">import</span> *
<span style="color: #ff7700;font-weight:bold;">from</span> sqlite3 <span style="color: #ff7700;font-weight:bold;">import</span> *
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">xml</span>.<span style="color: black;">sax</span>.<span style="color: black;">saxutils</span> <span style="color: #ff7700;font-weight:bold;">import</span> escape
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">codecs</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
f <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">codecs</span>.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'sms.xml'</span><span style="color: #66cc66;">,</span><span style="color: #483d8b;">'w'</span><span style="color: #66cc66;">,</span><span style="color: #483d8b;">'utf-8'</span><span style="color: black;">&#41;</span>
f.<span style="color: black;">write</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'''&lt; ?xml version='1.0' encoding='UTF-8' standalone='yes' ?&gt;
&lt;smses&gt;
'''</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;"># This is 31bb7ba8914766d4ba40d6dfb6113c8b614be442.mddata or 31bb7ba8914766d4ba40d6dfb6113c8b614be442.mdbackup usally</span>
c <span style="color: #66cc66;">=</span> connect<span style="color: black;">&#40;</span><span style="color: #483d8b;">'sms.db'</span><span style="color: black;">&#41;</span>
curs <span style="color: #66cc66;">=</span> c.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
curs.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'''SELECT address,date,text,flags FROM message WHERE flags &amp;lt;5 ORDER BY date asc'''</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> curs:
        a<span style="color: #66cc66;">=</span> escape<span style="color: black;">&#40;</span><span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>row<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        d <span style="color: #66cc66;">=</span> escape<span style="color: black;">&#40;</span><span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>row<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        t <span style="color: #66cc66;">=</span> row<span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span>-<span style="color: #ff4500;">1</span>
        t <span style="color: #66cc66;">=</span> <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>t<span style="color: black;">&#41;</span>
        b <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&quot;'</span><span style="color: #66cc66;">,</span><span style="color: #483d8b;">&quot;'&quot;</span><span style="color: #66cc66;">,</span>escape<span style="color: black;">&#40;</span><span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>row<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
        f.<span style="color: black;">write</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">'&lt;sms protocol=&quot;0&quot; address=&quot;'</span>+a+<span style="color: #483d8b;">'&quot; date=&quot;'</span>+d+<span style="color: #483d8b;">'000&quot; type=&quot;'</span>+t+<span style="color: #483d8b;">'&quot; subject=&quot;null&quot; body=&quot;'</span>+b+<span style="color: #483d8b;">'&quot; toa=&quot;0&quot; sc_toa=&quot;0&quot; service_center=&quot;null&quot; read=&quot;1&quot; status=&quot;-1&quot; /&gt;'</span>+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
f.<span style="color: black;">write</span><span style="color: black;">&#40;</span>
<span style="color: #483d8b;">'''&lt;/smses&gt;'''</span> <span style="color: black;">&#41;</span></pre></div></div></div>]]></content:encoded> <wfw:commentRss>http://www.whmcr.com/2010/05/25/iphone-to-android-sms-converstion-script/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using memcached
Database Caching 1/6 queries in 0.006 seconds using memcached
Object Caching 234/234 objects using apc

Served from: whmcr.com @ 2012-02-04 12:13:29 -->
