Monthly Archives: February 2011

download mp3s from Google Voice

So I use Google Voice for my voicemail, which gives often ridiculous computer transcriptions of the voicemail. I also use Vonage, which gives quite accurate human transcriptions, and includes an mp3 of the voicemail in the email. This is a much better situation, but Google Voice doesn’t let me turn of its voicemail so that only my Vonage voicemail service takes messages. Arg. So in my annoyance, I decided to try to write a script to download the mp3s from Google Voice. Turns out it was quite easy, especially because I was using python. Here’s my script, to use it, right click on the Play message link in the email, and copy it, then use that URL as the argument to this script (you’ll probaby want to change the dldir to something that works for your computer):


#!/usr/bin/python

import sys, re, time
from urllib2 import Request, urlopen, URLError, HTTPError

dldir = '/Users/hans/Desktop/'

url = sys.argv[1]
f = urlopen(url)
pagecontents = f.read()
f.close()

regex = re.compile("'messagePath': '(.*)'", re.MULTILINE)
for match in regex.finditer(pagecontents):
    mp3url = match.group(1)

regex = re.compile('gc-message-name">(.*)(.*)</span', re.MULTILINE)
for match in regex.finditer(pagecontents):
    msgtime = match.group(1)

msgdate = time.strftime('%Y-%m-%d %H.%M', time.strptime(msgtime, "%m/%d/%y %I:%M %p"))

filename = 'voicemail from ' + name + ' on ' + msgdate + '.mp3'
print "filename: " + filename
mp3 = urlopen(mp3url)
mp3contents = mp3.read()
mp3.close()
writefile = open(dldir + filename, 'w')
writefile.write(mp3contents)
writefile.close()


Setting up perms on an Android NDK install

When I install the Android NDK, I like to put it into /usr/local/android-ndk-r5b since it seems to be a logically place to be. That means installing as root, or using sudo. The Android NDK is setup without ‘other’ permissions, so this means you get odd problems and Permission denied errors when trying to use ndk-build, etc. To fix this:

sudo chown -R root.root /usr/local/android-ndk-r5b/
sudo chmod -R a+r /usr/local/android-ndk-r5b/
sudo find /usr/local/android-ndk-r5b/ -perm 754 |xargs sudo chmod a+x
sudo find /usr/local/android-ndk-r5b/ -type d | xargs sudo chmod a+x


building openssl for Android… errors!

So I am in the process of building openssl for Android for an app. I started with the official Android version that is included in Android itself, and am following instructions like these to get it building for my app. It went swimmingly until it barfed this out:

/usr/local/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-gcc -MMD -MP -MF /Users/hans/code/eighthave/openssl-android/obj/local/armeabi/objs/crypto/dso/dso_dlfcn.o.d.org -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/Users/hans/code/eighthave/openssl-android -I/Users/hans/code/eighthave/openssl-android/crypto/asn1 -I/Users/hans/code/eighthave/openssl-android/crypto/evp -I/Users/hans/code/eighthave/openssl-android/include -I/Users/hans/code/eighthave/openssl-android/include/openssl -Iexternal/zlib -I/Users/hans/code/eighthave/openssl-android/crypto -DANDROID -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CAST -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_IDEA -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_SHA0 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED -DOPENSSL_NO_STORE -DOPENSSL_NO_WHIRLPOOL -DOPENSSL_NO_HW -DOPENSSL_NO_ENGINE -DZLIB -DNO_WINDOWS_BRAINDEATH -DOPENSSL_BN_ASM_MONT -DAES_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -Wa,--noexecstack -O2 -DNDEBUG -g -I/usr/local/android-ndk/platforms/android-3/arch-arm/usr/include -c /Users/hans/code/eighthave/openssl-android/crypto/dso/dso_dlfcn.c -o /Users/hans/code/eighthave/openssl-android/obj/local/armeabi/objs/crypto/dso/dso_dlfcn.o && rm -f /Users/hans/code/eighthave/openssl-android/obj/local/armeabi/objs/crypto/dso/dso_dlfcn.o.d && mv /Users/hans/code/eighthave/openssl-android/obj/local/armeabi/objs/crypto/dso/dso_dlfcn.o.d.org /Users/hans/code/eighthave/openssl-android/obj/local/armeabi/objs/crypto/dso/dso_dlfcn.o.d

crypto/dso/dso_dlfcn.c: In function 'dlfcn_pathbyaddr':
crypto/dso/dso_dlfcn.c:445: error: 'Dl_info' undeclared (first use in this function)
crypto/dso/dso_dlfcn.c:445: error: (Each undeclared identifier is reported only once
crypto/dso/dso_dlfcn.c:445: error: for each function it appears in.)
crypto/dso/dso_dlfcn.c:445: error: expected ';' before 'dli'
crypto/dso/dso_dlfcn.c:455: error: 'dli' undeclared (first use in this function)
make: *** [obj/local/armeabi/objs/crypto/dso/dso_dlfcn.o] Error 1

It took me a bit to figure it out, but basically it was building against android-3 and Android’s dlfcn.h didn’t include the Dl_info struct until android-8. So time to set this in default.properties:

target=android-8

sourceforge certificate fingerprint

So SourceForge has updated their HTTPS certificate for SVN, but they have not posted the information anywhere about that certificate. That means there is no way to verify that this certificate is in fact the real SourceForge, and not some man-in-the-middle certificate. So I was getting this whenever using SVN:

hans@172-26-15-11 doc $ svn up
Error validating server certificate for 'https://pure-data.svn.sourceforge.net:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: *.svn.sourceforge.net
 - Valid: from Tue, 01 Feb 2011 03:25:10 GMT until Mon, 05 Mar 2012 04:22:59 GMT
 - Issuer: GeoTrust, Inc., US
 - Fingerprint: 94:74:b3:a9:54:ce:dc:e5:0d:d6:cf:86:b1:40:5a:48:b9:ea:15:de
(R)eject, accept (t)emporarily or accept (p)ermanently? 

I ran this on three different machines on three different networks, and got the same fingerprint on all of them, so I guess I’ll have to take that as good enough. It seems that there is a bug report on this:
*.svn.sourceforge.net SSL certificate can’t be verified.


Follow

Get every new post delivered to your Inbox.