The Great Escape Festival 2015 Spotify Playlist

It’s that time of the the year again. The Great Escape Festival announced the first 150 artists on their bill and I’ve compiled them into a handy Spotify playlist.

Creating a festival playlist on Spotify using python

The problem: You’re going to a festival with more bands than you could ever hope to see. You need a playlist with songs of all the bands playing so you can decide what to go and see and what to give a miss.

The solution: From a list of the artists, query the Spotify Search API with the artist name and save the URIs of the five most popular tracks returned by Spotify. Simples!

[Download script]

The code above is the function which you can pass each artist name to. It’s only a few more lines of code to feed a list of artists into the function and save a playlist list of tracks. I’ve deliberately saved more data than is needed for this task, as you never know when it will come in handy e.g. creating a script to query the playlist for all the artists that were successfully found.

Once you have all the URIs in a text file, with appropriate line breaks, you can drag this into the Spotify client and into a new playlist and they’ll magically become the tracks you want!

The Great Escape 2014 Spotify Playlist

The chaps over at MAMA and Company announced the first batch of artists for The Great Escape festival this May, and with more than 100 announced and more to come, its time to get listening to my TGE14 Spotify playlist!

As with last year, I’ll be adding to it as more acts are announced and more tracks become available. As a rule, I’ve taken the top five most popular tracks from each artist (where present). Its work in progress, so do let me know if there’s something in there that shouldn’t be (I’ve tried to eliminate false positives this year).

And if you’d like to see the code that generated it, check out this post.

Creating a timelapse video using mencoder and ffmpeg on a Mac

The problem: Take 1500 images captured from my Raspberry Pi and turn them into a 1080 HD video suitable for upload to YouTube, Facebook, and Vimeo.

The solution: Install ffmpeg and/or mencoder and use either tool to from the Terminal on my mac to compile the images into a suitable video format.

To install the command line tools ffmpeg and mencoder I followed this tutorial from aktagon.com which points you to the binaries available from Mac OSX port website ffmpegx.com, which in turn points you to a few other sourceforge websites to download what you need. Once your set and you can run ffmpeg and mencoder from the command line, you’re ready to go.

The first method I tried was using ffmpeg. I tried this originally with a smaller resolution timelapse (720 HD) and it compiled quickly and easily with a relatively small filesize. Thanks to Greg Heartsfield for the instruction on this approach.

ffmpeg -r 25 -s hd720 -vcodec libx264 -b 1000k timelapse.mp4 -i image%04d.jpg

This roughly translates as: use ffmpeg, with a frame rate of 25fps, with settings preset ‘hd720’, with the H.264 codec, to encode a video with a bit rate of 1 Mbit/s called ‘timelapse.mp4’ using jpg files that follow a image0001, image0002, image0003 etc schema.

However, my timelapses weren’t consistent with this approach, and on some I got tearing and grey blocks across the screen. It may be my ageing MacBook was to blame, but instead I sought an alternative approach. So after failing to compile the video using mencoder with the H.264 codec from this post on a Ubuntu forum, I settled on this PasteBin code from a RaspberryPi For Beginners YouTube:

The first line of the code is a handy trick to list all the jpg files of the current directory and save them to a text file. The second line I’m less certain of as I’m unfamiliar with mencoder, and with the success of this encode my desire to trawl Google was somewhat diminished. However, it should be said that this method took a lot longer to encode than ffmpeg and playback was still jerky in places – but I’m definitely putting that down to the MacBook. I would have also have liked to have used the H.264 codec but I couldn’t get the code I’d found elsewhere to work…

Do let me know of any improvements to the code above, or alternative/more reliable methods for encoding jpgs into a timelapse video.

How to invert hex colour codes

The problem: Invert the colours of a Sublime Text 2 colour theme, so that when I invert the screen on my MacBook the colours are as if they weren’t inverted.

The solution: Write a python script that matches the hex colour codes (e.g. #ffffff) in the colour theme configuration file against a regular expression, and replace the hex colour codes with their inverse.

The code:

Things to note: The python interpreter returns hex numbers with a preceding ‘0x’, so hex(255) yields 0xff. That’s why we use [2:] to grab just the last two characters of the value. The regular expression here is used to match six character RGB codes as well as eight character ARGB codes. RGB codes can also be expressed as three characters but in the tmTheme file I was working with none were present.

Background: Last year I was diagnosed with cataracts in both eyes. A white back-lit program or webpage is particularly difficult to read because of the glare caused by the white light. Fortunately on Macs ctrl + alt + cmd + 8 inverts the screen to help alleviate this. Unfortunately this meant by code editor (Sublime Text 2) got inverted too. So rather than having to flick back and forth between modes, when working between Sublime and the browser I thought it’d be best to invert Sublime to have my Mac screen consistently inverted.

Goodbye Cavendish

Tracks from the night as they were played. Now I should stop messing about with Python and feeling pleased with myself and go to bed…

New Young Pony Club – Ice Cream | 22:35:20
Flume – Holdin On | 22:38:32
Major Lazer – Pon De Floor – Radio Edit | 22:41:07
Alt-J – Dissolve Me | 22:44:07
Daft Punk – Get Lucky (feat. Pharrell Williams) | 22:48:01
Vampire Weekend – A-Punk | 22:54:06
Yeah Yeah Yeahs – Date With the Night | 22:56:19
Arcade Fire – Keep the Car Running | 22:58:49
Azari & III – Reckless With Your Love – Paul Epworth Radio Edit | 23:02:13
Haim – Forever | 23:05:24
Maxïmo Park – Apply Some Pressure | 23:09:25
Mumford & Sons – Little Lion Man | 23:12:40
Blondie – Hanging On The Telephone – 2001 Digital Remaster | 23:16:42
Disclosure – F for You | 23:19:00
Bombay Bicycle Club – Shuffle | 23:23:24
Solange – Losing You | 23:27:15
Blur – There’s No Other Way | 23:31:32
The Cure – Close to Me | 23:34:40
Groove Armada – Superstylin’ | 23:38:15
Foals – My Number | 23:44:10
Rudimental – Waiting All Night (feat. Ella Eyre) | 23:48:06
The Wombats – Kill The Director | 23:52:54
Fenech-Soler – Demons | 23:55:30
The Cure – Boys Don’t Cry | 23:59:09
Of Monsters and Men – Little Talks | 00:01:40
The Jam – Town Called Malice | 00:06:02
Joy Division – Love Will Tear Us Apart | 00:08:50
The Clash – I Fought the Law | 00:12:10
M83 – Midnight City | 00:14:47
Phoenix – Lisztomania | 00:18:46
Foo Fighters – Monkey Wrench | 00:22:43
The Chemical Brothers – Swoon – Radio Edit | 00:26:29
Bill Haley & His Comets – Rock Around the Clock | 00:29:31
The 2 Bears – Bear Hug | 00:31:40
Chuck Berry – Johnny B. Goode | 00:36:05
The Maccabees – Can You Give It | 00:38:41
The Wombats – Techno Fan | 00:41:30
AlunaGeorge – You Know You Like It | 00:45:24
Delphic – Halcyon | 00:48:42
Jason Derülo – Talk Dirty – feat. 2 Chainz | 00:53:19
Jessie Ware – Running (Disclosure remix) | 00:56:12
Foals – My Number | 01:01:37
Miike Snow – Animal (Mark Ronson Remix) | 01:05:33
Mumford & Sons – The Cave | 01:09:58
Arctic Monkeys – I Bet You Look Good on the Dancefloor | 01:13:31
Foals – Cassius | 01:16:20
TNGHT – Higher Ground | 01:20:05
DJ Fresh – Golddust | 01:23:19
Hot Chip – One Life Stand | 01:26:25
The Chemical Brothers – Leave Home | 01:31:42
Pete and the Pirates – Bright Lights | 01:37:10
Tom Vek – A Chore | 01:40:16
Chromeo – Needy Girl – Radio Edit | 01:47:14
Tom Vek – Aroused | 01:51:25
Miike Snow – Animal (Mark Ronson Remix) | 01:54:51
The Chemical Brothers – Swoon – Radio Edit | 01:59:16
Chuck Berry – Johnny B. Goode | 02:02:18
Bloc Party – Helicopter | 02:04:55
Orbital – Wonky – Plump DJ’s Mix | 02:08:30
Delta Heavy – Get By | 02:13:25
Prince & The Revolution – Kiss | 02:18:01
Taylor Swift – I Knew You Were Trouble | 02:21:41
The Jam – Town Called Malice | 02:25:15
Fenech-Soler – Demons | 02:28:03
Kindness – That’s Alright | 02:31:42
Friendly Fires – Jump In The Pool | 02:36:24
LCD Soundsystem – North American Scum | 02:39:56
Two Door Cinema Club – What You Know | 02:45:19
Major Lazer – Get Free | 02:48:24
The Libertines – What Became Of The Likely Lads | 02:53:08
MGMT – Electric Feel (Justice Remix) | 02:56:25
Hot Chip – One Life Stand | 03:01:47
Pete and the Pirates – Blood Gets Thin | 03:07:04
M83 – Reunion | 03:10:04
The Rumble Strips – Girls And Boys In Love | 03:13:54
The Clash – I Fought the Law | 03:16:22
Django Django – Default | 03:18:59
Flume – Holdin On | 03:22:01
Phoenix – Lisztomania | 03:24:31
Yeah Yeah Yeahs – Heads Will Roll | 03:28:28
Totally Enormous Extinct Dinosaurs – Garden | 03:32:04
Everything Everything – MY KZ, UR BF | 03:36:34
Joy Division – Love Will Tear Us Apart | 03:40:07
SBTRKT – Pharaohs (feat. Roses Gabor) | 03:43:28
Young Knives – She’s Attracted To – Radio Edit | 03:47:01
Disclosure – Latch (feat. Sam Smith) | 03:50:01
Bombay Bicycle Club – Shuffle | 03:54:12
Arcade Fire – Reflektor | 03:58:03
Florence + the Machine – Dog Days Are Over | 04:05:32
Mumford & Sons – I Will Wait | 04:09:40
Foals – My Number | 04:14:12
Totally Enormous Extinct Dinosaurs – Tapes & Money | 04:18:07
John Travolta – The Grease Megamix | 04:21:42
MGMT – Kids – Soulwax Mix | 04:26:28
Metronomy – The Look | 04:32:02
Disclosure – F for You | 04:36:34
Fake Blood – I Think I Like It | 04:40:58