Automatic display of incoming picture share
- Update: I have a better sprintpcs picture mail reader now which can post to blogs and understand both the Treo 650 and Treo 750 picture mails. Leave comments there or email me if you want more posts about how that's done.
- I put this in procmail::
-
:0 c
* ^Subject: A Picture Share!
| $MAILDIR/pictureshare
And this is in Mail/pictureshare:
#!/usr/local/bin/python2.3
# if mail contains a link like this, launch mozilla on dash. part of
# the url will end up in a shell command, so i limit the url tightly.
# if there is not a good enough match, this program silently exits.
# <a style="color: #FF0000;" href="http://pictures.sprintpcs.com/share.jsp?invite=gEZm4LPf8UzcFaCLk8Zx&amp;shareName=Photo">View</a>
import sys,re,os
msg = sys.stdin.read()
m = re.search(r"""href="http://pictures\.sprintpcs\.com/share\.jsp\?invite=([a-zA-Z0-9]+)&amp;shareName=Photo">View""",msg)
if m:
remote_cmd = "DISPLAY=:0.0 scripts/newmozilla http://pictures.sprintpcs.com/share.jsp\?invite=%s\&amp;shareName=Photo" % m.group(1)
print "launching mozilla on dash for picture share email"
os.system('source ~/.ssh-agent-dot; ssh dash "%s"' % remote_cmd)
And this is scripts/newmozilla on dash:
#!/bin/zsh
URL=$1
if [[ $URL = "" ]]; then
URL=http://google.com
fi
/usr/local/mozilla/mozilla -remote "openurl($URL,new-window)"
For testing, I run received mh mails through the program:
dot(pts/0):~% cat Mail/inbox/127 | Mail/pictureshare
launching mozilla on dash for picture share email
Atom feed of this blog
<class 'rdflib.syntax.parsers.n3p.n3proc.ParseError'> at /public/comments
Illegal literal character: u'\r'
Traceback (innermost first)
/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/syntax/parsers/n3p/n3proc.pyinunquote/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/syntax/parsers/n3p/n3proc.pyinliteral/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/syntax/parsers/n3p/n3proc.pyinliteralFinish/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/syntax/parsers/n3p/n3proc.pyinonFinish/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/syntax/parsers/n3p/n3p.pyinparse/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/syntax/parsers/n3p/n3proc.pyinparse/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/syntax/parsers/N3Parser.pyinparse/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/Graph.pyinparse/usr/local/lib/python2.6/dist-packages/rdflib-2.4.1-py2.6-linux-x86_64.egg/rdflib/Graph.pyinparse/my/site/blog/baby/commentServe.pyingetGraph/my/site/blog/baby/commentServe.pyinGET/usr/local/lib/python2.6/dist-packages/web.py-0.34-py2.6.egg/web/application.pyinhandle_class/usr/local/lib/python2.6/dist-packages/web.py-0.34-py2.6.egg/web/application.pyin_delegate/usr/local/lib/python2.6/dist-packages/web.py-0.34-py2.6.egg/web/application.pyinhandle/usr/local/lib/python2.6/dist-packages/web.py-0.34-py2.6.egg/web/application.pyinprocessRequest information
INPUT
COOKIES
No data.
META
ENVIRONMENT
You're seeing this error because you have
web.config.debugset toTrue. Set that toFalseif you don't to see this.