Berocca Bribing Bloggers

October 2nd, 2008 by Strawp

They’ve clearly gotten a new marketing person over at Berocca in the past year. Having not really touched TV ads until now, they launched a campaign which is clearly targetted at the blogosphere which featured a slighty embarrassing rip-off of OK Go‘s “Here It Goes Again” and now they’re buying blog posts by launching their “Blogger Relief” campaign. You can register your blog and if they like it they’ll send you a box of free stress relieving gizmos.

I don’t need to be paid off to thoroughly recommend Berocca – I’ve been addicted to the stuff for years and it’s saved my life countless times, however the odd cheap bribe never hurt anyone.

If that still doesn’t convince you, the prospect of luminescent orange pee after a glass always brightens up a dull day (and freaks out anyone else in the public toilet).

New SVN repo: PHP Libraries

September 10th, 2008 by Strawp

Just added a new repository to the site: PHP Libraries. Currently in there are working classes or functions for:

  • Firefly Media Server – a class for direct access to the songs database
  • Roku Client – a client for Roku music players like the Soundbridge. Allows remote scripting etc
  • twitter – a bunch of functions for posting to, or getting info from a twitter account
  • Delicious – a class for (currently only) getting delicious bookmarks. Will add other methods if/when they’re needed for other scripts.

And there’s a ping.fm class in there that I might work on if I can be bothered to get an App key for it.

Head to svn.strawp.net/lib to browse them, svn co http://svn.strawp.net/lib to check the lot out.

Update: Just added svn.strawp.net/scripts/ which currently just has my twitter command line client in it.

iPlayer Nokia N95 Stream Already Available

September 9th, 2008 by Strawp

Well spotted by Phil who’s discovered that the new N95/N96 stream for the BBC iPlayer is already available and can be viewed or even saved to file just by pointing an RTSP compatible media player at a valid URL – just like when the iPhone H264 stream came out.

More details are on our lovely Beebhack wiki

New host!

September 4th, 2008 by Strawp

I’ve just moved my site from the (once good value, now rubbish) ODSOL to Dreamhost, which is a blinding improvement.

I now have (about 1000 times) more web space and I’ll also be able to do nice things like host my own SVN projects. Yay!

Some of the links to other non-blog parts of the site might not work for a bit…

My Twitter client available for download

June 26th, 2008 by Strawp

Somebody out there wants it, so here it is

Update: I’ve moved this to the SVN server. To get them:

  1. svn co http://svn.strawp.net/scripts/tw
  2. svn co http://svn.strawp.net/lib/twitter.php
  3. chmod u+wrx tw
  4. make sure TWITTER_EMAIL and TWITTER_PASSWORD are defined

“tw h” for help text.

My CLI client gets its own ascii Fail Whale

June 26th, 2008 by Strawp

I’ve been using my own PHP-based CLI Twitter client pretty much since signing up (the Twitter API is so simple). You can view your timeline, tweet, view replies and view and send direct messages all via the command line, and I’ve just added the now-famous Fail Whale image to the error output, see this screenshot for an example.

The source isn’t published at the moment, but if you want it I’ll clean it up (take out my hard-coded username and password) and upload it – just leave a comment.

The whale is based on this one which I turned into my own version reversed with added twitter birdies.

DRM, shmee-RM

June 9th, 2008 by Strawp

Looks like I overestimated the file encryption entirely on the last BBC update. Fortunately some people still had their own “clear” versions of some programs which they could compare directly with the newly encrypted downloads, noticing that what some of us thought was a DRM scheme was actually just a simple XOR of the video stream with two repeating bytes. A quick perl script later and P Lewis, posting on Paul’s blog had a working video file just like the old scripts produced.

P Lewis has since incorporated this update into a really nice full featured script for browsing and downloading video from iPlayer.

I really hope this update wasn’t what the iPlayer team were doing for the last couple of months. Bloody waste of license payer’s cash if it was.

iPhone iPlayer hole gets DRM’d (no, properly this time)

June 6th, 2008 by Strawp

It’s looking like files downloaded from the iPhone iPlayer interface are now unplayable on devices other than the iPhone. Previously this was wide open to allow anyone to download Quicktime (H.264) video over HTTP directly from the site, but it now appears that although the video can still be downloaded it is encrypted (probably with Fairplay DRM).

More technical details on the Wiki as they come in.

(See also Paul Battley’s blog)

While I’m at it: AAC to MP3 conversion script

June 4th, 2008 by Strawp

Based on Converting FLAC to MP3 in Linux (I tweaked the LAME settings a bit though):

#!/bin/bash

# Converts all AAC (m4a) files in a folder into mp3s, plus the id3 tag
# Requires faad, lame, id3v2

for a in *
do
  # Check the file is a flac file
  if [[ "$a" =~ (m4a)$ ]]
  then
    # Name of outfile
    OUTF=`echo "$a" | sed s/\.m4a/.mp3/g`
    echo "$a => $OUTF"

    # Capture all the FLAC metadata
    ARTIST=`faad -i "$a" 2>&1 | grep "^artist" | sed "s/.*: //g"`
    TITLE=`faad -i "$a" 2>&1 | grep "^title" | sed "s/.*: //g"`
    ALBUM=`faad -i "$a" 2>&1 | grep "^album" | sed "s/.*: //g"`
    GENRE=`faad -i "$a" 2>&1 | grep "^genre" | sed "s/.*: //g"`
    TRACKNUMBER=`faad -i "$a" 2>&1 | grep "^track" | sed "s/.*: //g"`
    YEAR=`faad -i "$a" 2>&1 | grep "^date" | sed "s/.*: //g"`

    # echo "$ARTIST - $TITLE - $GENRE - $TRACKNUMBER"

    # Convert the audio data from AAC to MP3
    faad -w "$a" | lame -V 2 -m j -b 192 -B 224 -s 44.1 - "$OUTF"

    # Tag the resulting MP3 with the captured metadata
    id3v2 -t "$TITLE" -T "$TRACKNUMBER" -a "$ARTIST" -A "$ALBUM" -g "$GENRE" -y "$YEAR" "$OUTF"
  fi
done

Converting FLAC to MP3 in Linux

June 4th, 2008 by Strawp

A quick howto…

If you’re using a desktop debian distro, just use SoundConverter:

sudo apt-get install soundconverter

If you’re shelling into a server (or you just prefer CLI), you’ll need a script and a few audio tools. Here’s the bash script (based on this one):

#!/bin/bash

# Converts all flac files in a folder into mp3s, plus the id3 tag
# Requires flac, metaflac, lame, id3v2

for a in *
do
  # Check the file is a flac file
  if [[ "$a" =~ flac$ ]]
  then
    # Name of outfile
    OUTF=`echo "$a" | sed s/\.flac/.mp3/g`
    echo "$a => $OUTF"

    # Capture all the FLAC metadata
    ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`
    TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`
    ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`
    GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`
    TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`

    # Convert the audio data from FLAC to MP3
    flac -c -d "$a" | lame -m j -b 256 -s 44.1 - "$OUTF"

    # Tag the resulting MP3 with the captured metadata
    id3v2 -t "$TITLE" -T "$TRACKNUMBER" -a "$ARTIST" -A "$ALBUM" -g "$GENRE" "$OUTF"
  fi
done

Save that off in your path, make it executable:

chmod u+wrx flac2mp3

and run it from an location with mp3s in. It’ll convert all FLAC files to identically named MP3 files with the id3v2 information based on the FLAC metadata.

You’ll need flac, metaflac, id3v2 and lame:

sudo apt-get install flac id3v2 lame

Happy converting :)