Dylan Smith

Spotify Global Hotkeys

leave a comment »

So it goes without saying that Spotify is awesome, right? Free, tons of music (with the glaring exception of AC/DC and unsurprisingly, Metallica), collaborative playlists and last.fm scrobbling. It’s made almost entirely of win.

Almost … because it doesn’t have global hotkeys. Now, at home Spotify recognises my keyboard’s dedicated media keys and responds accordingly. But on my work laptop I have no way of pausing, resuming and skipping. A little Googling revealed this gem: AutoHotkey.

It’s basically a script-driven hotkey application for Windows, and it’s fairly simple to use. Each script has a “.ahk” extension, and they can be stored anywhere. To activate a script, simply double-click it and it runs in your system tray. If you want to run a script on startup, just create a shortcut to it in your Start » Programs » Startup folder.

Here is the custom script I made for Spotify, based on code I found in this thread. The keys should be fairly obvious from the code and comments. The “Info” action basically copies the currently playing song’s information to your clipboard, so you can paste it into Twitter, for example.

I’m quite keen to see what else I can automate with this useful little app.

SetTitleMatchMode 2 

;#############################################################
; Application: Spotify
;-------------------------------------------------------------
; Ctrl-PageUp = Previous Track
; Ctrl-PageDn = Next Track
; Ctrl-Home   = Pause/Play
; Ctrl-End    = Info
;
;#############################################################

; "CTRL + PAGE UP"  for previous
^PgUP::
DetectHiddenWindows, On
ControlSend, ahk_parent, ^{Left}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
return 

; "CTRL + PAGE DOWN"  for next
^PgDn::
{
DetectHiddenWindows, On
ControlSend, ahk_parent, ^{Right}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
return
} 

; "CTRL + HOME"  for pause
^Home::
{
DetectHiddenWindows, On
ControlSend, ahk_parent, {space}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
return
} 

; "CTRL + DOWN"  for info
^End::
{
DetectHiddenWindows, On
SetTitleMatchMode 2
WinGetTitle, now_playing, ahk_class SpotifyMainWindow
StringTrimLeft, playing, now_playing, 10
DetectHiddenWindows, Off
clipboard = %playing%`r`n
return
}

Written by Dylan

Sep 25, 2009 at 10:45 am

Posted in Uncategorized

Hiatus

with one comment

So I haven’t posted in months. I gave Tumblr a bash, and liked it. But seriously, between Twitter and Facebook, where does one find the time?

Written by Dylan

Jul 14, 2009 at 11:47 am

Posted in Uncategorized

Awesome Guitar Hero 4 World Tour Drum Pedal Mod

leave a comment »

My friend Carl just wrote a great article about his custom drum pedal mod for GH:WT. The plastic pedal that comes with the game got crushed after a few weeks of constant hard rocking, and so he came up with a solution that is most righteous. Wyld Stallyons!

Check it out at LazyGamer.

Written by Dylan

Jan 21, 2009 at 10:28 am

Posted in Gaming

The ABBA-Grease Conjecture

leave a comment »

All women love ABBA & the Grease soundtrack.
All men hate them.

This post was prompted when I was sent the new Vodacom Summer TV ad:

Before the opening words “Summer loving” could be completed, I had already become the victim of a mini-sick. My body seems to reject this music. And I don’t think I’m alone.

Fellas: ever remember being on a dance floor at a club somewhere when an ABBA or Grease tune comes on and all the girls squeal with excitement? If you ever thought “Wow, I love this song. I’m so excited and I know exactly how to dance to this without feeling like a complete tool”, please let me know so we can disprove the conjecture.

Written by Dylan

Nov 11, 2008 at 2:30 pm

Posted in Random

Behold! The Watch of Undying Awesome

with one comment

Casio W23

That’s right, folks. You’re looking at the first watch I ever owned. The enigma known as the Casio W23 that was bequeathed to me upon the occasion of the celebration of my 8th year. According to the legend, my mom got it at the Pick ‘n Pay Hypermarket in Durban North.

Of course, anyone who lived in Durban in the 80s knows that when you bought a new watch, you removed the rubber “factory” wrist strap IMMEDIATELY and bought a Gotcha, Rip Curl or Billabong velcro strap from your local surf store. You then spent the entire afternoon trying to install your new watch strap, which usually involved fruitlessly attempting to squeeze those annoying metal pins that hold the strap in place back into the holes in the watch body with a butter knife; holes which were about 3 microns in diameter, and required an electron microscope to find. The fact that the velcro strap was about 3 times the thickness of the original strap didn’t help much either. Ultimately, you’d end up standing in the driveway waiting for your dad to come home, clutching the watch body, velcro strap and 2 slightly bent pins in your bleeding fingers.

I wore it from the age of 8 until my 20th birthday, when I was presented with a Rip Curl Tidemaster watch. The only reason I agreed to take the Casio off my arm was because the Rip Curl knew the exact tidal movements and phase of the moon at any given time, which seemed like pure witchcraft.

This watch was so awesome. It had local and alternate date, time and day of the week, a stop watch, countdown, alarm and a light. It took 12 years of abuse, and came out the other side with only a slight chip in the glass face, and a light that no longer worked. And, believe it or not, I only changed the battery twice in the entire time that I owned it.

Come to think of it, I only changed the velcro straps about 3 times as well, which sometimes resulted in a tangy aroma around left wrist area. Don’t judge me.

And as I type this, the date and time just hit 11th November, 11:11:11, an occasion which I waited for all year round when I wore the W23. Why? Because, due to the layout of the display, the watch would read:

11-11
11:11:11

Why that was (and still is) so fascinating is beyond me, but I hope you enjoyed that little bit of nostalgia.

Written by Dylan

Nov 11, 2008 at 11:13 am

Posted in Random

Detect when the mouse leaves a Flash movie in AS2 (the easy way)

leave a comment »

I was asked to fix an old piece of AS2 work today (meh). The piece in question featured a custom mouse cursor, and the client wanted the custom cursor to disappear when the actual mouse cursor left the Flash movie, rather than having it stop on the edge of the stage looking lost. Fair enough. AS3 has the awesome new MOUSE_LEAVE event for such things, but this was AS2.

I looked for a few quick solutions online and all of them seemed like too much work, in particular a solution that created JavaScript listeners with ExternalInterface to monitor the mouse position on the containing document. That is a bridge too far for me I’m afraid.

In AS2 you can monitor the rollOver and rollOut events of a MovieClip as long as the mouse doesn’t leave the stage. For example, if a movieclip is the same size as the stage and positioned at 0,0 the rollOut event doesn’t fire because the mouse leaves the stage at the same instant that it leaves the movieclip. However, if the movieclip was slightly smaller than the stage, the rollOut event would still fire because the mouse cursor would still be within the bounds of the stage when it left that movieclip.

So, my solution is to place a transparent movieclip over the movie, with a very slight border around it (say, 2 pixels). That gives Flash enough time to relase that the mouse is just about to leave the stage, before it actually does. Here is the code:

// create the mouse detection movieclip
var mouseLeave_mc:MovieClip = _root.createEmptyMovieClip('mouseLeave_mc', 9999);
var border:Number = 2;
mouseLeave_mc.beginFill(0x000000, 0);
mouseLeave_mc.moveTo(bdr, bdr);
mouseLeave_mc.lineTo(Stage.width - bdr, bdr);
mouseLeave_mc.lineTo(Stage.width - bdr, Stage.height - bdr);
mouseLeave_mc.lineTo(bdr, Stage.height - bdr);
mouseLeave_mc.lineTo(bdr, bdr);
mouseLeave_mc.endFill();

// set event listeners
mouseLeave_mc.onRollOut = Delegate.create(this, function() {
	// the mouse is about to leave the stage
})
mouseLeave_mc.onRollOver = Delegate.create(this, function() {
	// the mouse is about to enter the stage
})

Written by Dylan

Oct 28, 2008 at 5:27 pm

Posted in Code, Flash

Tagged with , , ,

Angry Pigeon is Angry!!1!

leave a comment »

I was shooting photos of the fountain in Piccadilly Circus today, and I noticed this little guy in the corner of one of my throwaway shots. His expression is classic!

Angry Pigeon is Angry!!1!

Written by Dylan

Oct 25, 2008 at 3:02 pm

Posted in Photography, Random

Dropbox makes your life easier

with 2 comments

I suspect many people are like me: they have a home desktop or laptop machine that they use during evenings and weekends, and a work machine that they use the rest of the time. If so, they’ll probably have some files, personal or business, that they need kept in sync between both machines.

My previous solution to this problem was FTP. Any files I always wanted a current copy of I would put in the FTP shared folder on my home computer. When I wanted to work on anything remotely I’d log in to get the latest copy, update it, and FTP it back to my home machine.

The other day, thanks to LifeHacker, I discovered Dropbox. Dropbox is a freeware utility that installs on as many machines you like, and will keep a specified folder on all linked machines in sync. Create, update or delete a file on one machine, and the action is replicated across all others.

The Dropbox software basically informs the Dropbox server of all file changes, and sends differential updates back and forward. The server also keeps a version history of every file update, and you can always access your files from your own private area on the Dropbox website. There is also a feature to share files with people by placing them in a special public folder, and entering their email addresses in a form – Dropbox sends them an email with a secure URL to view the files.

I’ve found it incredibly useful, and I really don’t miss having to open up my FTP client twice every time I want to update something. I just double-click on the Dropbox icon in my system tray (which opens my local Dropbox folder), make the change, save and close. Dropbox does the rest.

Now, I have had to get access to a file on my home machine that was not in my Dropbox. This is where a free LogMeIn account comes in real handy. LogMeIn is a web-based remote desktop solution that is absolutely brilliant and I recommend you sign up for an account immediately. I just log into my home desktop and copy the require files into my Dropbox. Seconds later, my work machine has the files automatically. Sweet.

Written by Dylan

Oct 23, 2008 at 9:17 am

Posted in Freeware

Tagged with , ,

MTV is going to get Rick Roll’d

with 3 comments

Yesterday the BBC reported that Rick Astley has been named as a nominee for “Best Act Ever” at thsi year’s MTV Europe Music Awards. The internet has spoken and MTV have listened. So can the “Rickrolling” meme really break through into the mainstream?

Rick is up against U2, Britney Spears, Christina Aguilera, Green Day and Tokio Hotel. Certainly formidible opponents, but I’m fairly confident Rick is going take the award. And what a sweet, sweet thing that will be. Not because I particularly like Rick, but because I can’t wait for Bono’s reaction to being beaten by Rick Astley.

After all, remember how much Bono HATES being #2?

Oh please, oh please…

Written by Dylan

Oct 3, 2008 at 11:05 am

Posted in News, Random

EXIF-based Photo Renaming with Python

leave a comment »

Python has been on my radar for a while now. I’ve been hearing good things about it, and after hearing that Google AppEngine requires Python (for now, anyway), I decided it was time to learn.

Python also seemed like a natural fit for a project I’ve been meaning to do for some time: to organise my rapidly expanding photo library by renaming all folders and images using EXIF data in the image files. Often we have a bunch of photos from different cameras in one “event” folder, but different cameras use different prefixes for the image files, and so Picasa groups the photos by camera rather than chronologically (which would make more sense). I know you can set Picasa to “sort by date”, but it’s not the default setting, and besides, I’d rather all my images be named uniformly.

So I present to you my first ever Python script. It will take a single directory as an argument and ask for user confirmation before starting to rename anything. If given the go-ahead, it will run through all the files in the directory attempting to rename the image based on the EXIF datestamp. If the EXIF data is not available, it will inspect the creation time of the file and use that as the basis for renaming.

I’ve tested this briefly on some sample images, and it works like a charm. I’m releasing this code with no guarantees or assurances, so if you nuke your entire photo library don’t blame me. It’s obviously a good idea to backup before attempting anything like this.

Requirements

Get the Python interpreter for your OS.
Get the EXIF.py library from SourceForge.

Download

Download exif-renamer-1.0.py

Written by Dylan

Sep 24, 2008 at 11:23 am

Posted in Code

Tagged with