:-( iPod — again!
My iPod died again.
I am *REALLY* pissed off now.
I was going to go through the apple automated support line but upon trying to get a replacement it tells me:
Our records indicate that the warranty on your product has expired.
That's just nice.
So, i'm on hold now for apple care. The gatekeeper guy says that the reason that I got that error is because I put in the purchase date where it asked me for purchase date instead of putting in the date the iPod was replaced last time it broke.
I have a conspiracy therory to throw out here. I was listening to Alanis Morisette last night and it seems that I am not the first person that has had an iPod die while listening to Alanis Morisette.
In good news, Bret from Ranchero left a comment for me reminding me that I can simply use AppleScript to make NetNewsWire dump an OPML file. Sweet.
this should do it:
tell application "NetNewsWire" to export subscriptions to file "/tmp/temp.opml" with including groups
Very nice.
Now I just have to write something in PHP to automatically transfer the stuff to the server.
this script running on the client fetches the OPML from NNW and sends it the server
$key="somerandomvalue"; $timestamp=time(); $tmp=tempnam("/tmp","opml"); $cmd="/usr/bin/osascript -e 'tell application \"NetNewsWire\" to export subscriptions to file \"".$tmp."\" with including groups'"; `$cmd`; $post['opml'] ="@".$tmp; $post['timestamp'] =$timestamp; $post['hash'] =sha1(sha1($key).sha1($timestamp)); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://blog.adamjacobmuller.com/opml.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $response = curl_exec( $ch ); curl_close($ch); unlink($tmp); print $response;
this one recieves it and writes it to disk:
$opml="/home/adamhost/opml/MySubscriptions.opml"; $key="somerandomvalue"; $timestamp_file="/home/adamhost/opml/timestamp"; if ($_FILES['opml']) { require_once 'PHP/Compat.php'; PHP_Compat::loadFunction('file_put_contents'); $hash=sha1(sha1($key).sha1($_POST['timestamp'])); $last_timestamp=file_get_contents($timestamp_file); if ($hash==$_POST['hash']&&$timestamp>$last_timestamp) { $fh=fopen($_FILES['opml']['tmp_name'],"r"); $data=fread($fh,filesize($_FILES['opml']['tmp_name'])); fclose($fh); $fh=fopen($opml,"w"); fwrite($fh,$data,strlen($data)); fclose($fh); file_put_contents($timestamp_file,$timestamp); print "success"; } else { header("Content-Type: text/plain"); print "invalid hash"; } } else { header("Content-Type: text/x-opml"); print file_get_contents($opml); }
overall pretty cool — it also has a very secure authentication method — at least, i think it's secure. Any comments on that? I stopped one step short of encrypting the OPML with mcrypt before sending it, but that would not actually have been difficult to do.
No Comments »
No comments yet.
RSS feed for comments on this post. TrackBack URI
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>