16 June 2009

OpenSearch and Music Libraries

(This post doesn't go into detail on the OpenSearch spec., check out the OpenSearch website and the guide by Mozilla if you're interested).

So recently I decided to implement OpenSearch on the Surge website. Now, Surge has two separate search pages for artists and individual tracks.

"Ideally", I muttered to myself, "I should like to implement both of these... using one search field"

Because really, I'd much rather have one search engine that does everything than a handful for individual but similar functions.

So the project really had two main parts to it:

  1. The simple part, searching the website
  2. And the slightly more complicated auto-complete function

The Simple Part

This was nice, just a case of mashing our two existing search pages into one. Display a list of matching artists, if any, and a list of matching tracks, if any. If a single artist or single track is matched the user is just taken straight to the relevant page.

It also interprets "[phrase] - [phrase]" as being "[artist] - [track]" or vice-versa. Which I thought was pretty cool but also comes in useful for the auto-suggest part.

Auto Suggest

The auto suggest function in OpenSearch works by querying a script which then returns suggestions in JSON format.

Primarily I was going to use MySQL's UNION function to combine a track search and an artist search into one list, but thinking about it a bit more I realised I needed the artist result first. Because ideally the suggestions should work in two modes.

  1. Matching on an artist or track
  2. Listing tracks from a matched artist

The second mode only kicks in if an exact match has been found for the artist or if only one artist

So the artist query searches the artist table and matches with "artist_name LIKE '%$keyword%'". Then count the rows and compare the artist name and keyword to decide which mode to put it in.

The track query, similarly, searches the track table and matches with "track_name LIKE '%$keyword%'". But if we're in mode 2. it also matches tracks whose artist id matches the one found from the artist search.

The next step is just mashing it all down into JSON code and printing it.

Job done.

11 October 2008

Free Music: The Vines, The Hair, Modernaire, Eugine McGuinness, Ulrich Schnauss

I've been pretty bad with regular updates recently, haven't I? Sorry guys. Things at uni and Surge are making me a very busy boy. Coupled with flu this means a lack of updates for you - but it also means a backlog of free music to get through, so let's do it!

The Vines - Get Out

Get Out is the first track from The Vines' current album Melodia. It's quite a standard track that doesn't see the band pushing their boundaries at all. This doesn't stop it from being a good song - it's a perfectly listenable song that doesn't get boring or strange in any way. And as an album intro track you shouldn't really expect anything else.

The Hair - Half Cut

The Hair are a new band from York and Leeds who are currently touring the UK with Kaiser Chiefs. Their offering to the world of music journalism (and the general public), Half Cut, is an interesting indie-feeling song which shows the band definitely think about how to make their songs interesting. From the listening to their other tracks they have a good range of sounds and I think they have the potential to do well in the world. Watch out for them.

Modernaire - Faites Vos Jeux

Modernaire are a pop trio from Manchester. I guess you could say they sound a bit like Lilly Allen if she didn't sing in that horrible accent and also got into pop electronica. That's all I can really think to say about this, other than you can get more tracks from the Jackdaw Recordings website.

Eugene McGuinness - Not So Academic

Man... how do I describe this? Try taking the Killers and sending them back in time to the days of blues and early rock 'n' roll and you might be somewhere near this. Or you might not. Eugene McGuinness puts a distinctly blues-period aura into his music, while at the same time keeping it distinctly modern. His vocals seem to drift between styles from the 70s and from modern indy bands, and the gap between old and new is bridged even more so with songs full of electric guitar happily sitting beside those backed by a honky-tonk piano.

Ulrich Schnauss - A Letter From Home

Ulrich Schnauss is an ambient electronica artist born in Germany now living in the UK. A Letter From Home is a chillout track that keeps you interested and relaxed throughout - which is all chillout music needs to be, really.


That's it for free music this week. On Wednesday I should be interviewing The Hair for Surge and hopefuly some or all of that interview might filter back to this blog... so until then, goodbye!

26 September 2008

Free Music Friday: Jonathan Davis, Wilco w/ Fleet Foxes, Witchita Records

Jonathan Davis - Got Money

Jonathan Davis, the voice of Korn as his website proudly points out, has written a song about people having money. It's pretty odd, possibly a message to RnB stars with its wobbly vocals and various RnB references. I'll have to listen to it a bit more before I make any more sense of it. Oh yeah, and it features Slipknot's Jim Root.

Wilco w/ Fleet Foxes - I Shall Be Released

Wilco and Fleet Foxes are totally into politics, and they wish more people would be. They've got a live cover of Mr Dylan's I Shall Be Released on their website for you on one condition: That you pretend to be American and say you'll vote in the elections.

Witchita Records - free sampler

Witchita Records are host to people like Bloc Party, Simian Mobile Disco, Those Dancing Days and loads others. They're giving away a free album sampler on their website with tracks from loads of their artists. If you're into broadening your horizons you should totally go for it.

20 September 2008

Free Music Friday: Trivium, Iglu & Hartly

Hello all, welcome to Friday (okay, it's actually Saturday but I'm only human). This week you can have some screamy music and a sonic milkshake

Trivium - Kirisute Gomen

Kirisute Gomen cover artTrivium doing what Trivium do best, and that is making Trivium-style music. It's the first single from their upcoming fourth album Shogun, slated for release on September 30th. I have a feeling this track is going to be free for a limited period (it was on the Roadrunner Records website for 24 hours at the end of July), so get it while it's hot.

Iglu & Hartly - Tomorrow

Iglu & Hartly - And Then Boom album art This is interesting. At first the song sounds like it's going to be dance or electro or something with your classic synth intro. But then you find that actually this song is more rock and rap. "a sonic milkshake, a genre blending, culture-defying laser show" is how last.fm describes them. Either way, it's definitely an uplifting song that you could do worse than to download.

THANKS FOR STOPPING BY, SEE YOU SOON GUYS.

18 September 2008

Free Music Podcast: August 2008 - Hundred Days, Fortune Drive, The Ticket That Exploded

Better late than never. It’s just me this month.

Download from here or here. Features music from:

  • Hundred Days
  • Fortune Drive
  • The Ticket That Exploded

5 September 2008

Free Music: Various Artists

This week I have plenty of music for you lovely lot, so I'll just let you get on with the downloads and will keep the words to a minimum.

By the way, I'm going to aim at doing this every fortnight now until further notice because I'm a busy busy bee.

Coldplay - Death Will Never Conquer [Direct]

Chris Martin plays the piano. This is a track that didn't make it to Viva La Vida, so the band are just giving it away.

Elliot Minor - Jessica (Alternate version)

The harmony-driven emo kids dish out a slower, piano and acoustic fuelled version of their song Jessica. Even if you haven't heard the original it's a great track.

The Miserable Rich - Over and Over (Hot Chip cover)

There's nothing quite like a stripped down strings version of a classic electropop song. Saw these guys at Beachdown, did a pretty good performance.

Gloria Cycles - Wonderbus [Direct]

Another Beachdown act. A bit of a short, racy and quite catchy song about buses and women.

Peggy Sue - Superman

Peggy Sue converse with Superman, who tells tales of his lament. With vocals reminiscent of Kate Nash and a very acoustic/folk vibe. Worth listening to just for the brilliant lyrics.

29 August 2008

Free Music: The Ticket That Exploded

This week I'm a little tired from trying to catch up on work, sleep and energy that I didn't get done at Beachdown (speaking of which, expect to hear more about that in the next few weeks). But there is still free music - so sit back and try and comprehend as I ramble about The Ticket That Exploded.

The Ticket That Exploded, a duo from Amsterdam, have some free tracks up on last.fm. They're a very mellow band - similar in feeling to bands like Sigur Ros, the less rockish stuff from Guster, and much of John Frusciante's more mellow solo work.

Their songs are all acoustic, mostly very bright and happy music with lots of vocal harmonies. They all follow the same style, and yet all end up sounding quite individual.

Enough talking, here's the links:

Normal service will resume next week!