PHP

Hack Manchester 2012

Back in October, I spent a weekend with many other developers at Hack Manchester . Hack Manchester (part of Manchester Science Festival) is a 24 hour coding event, where 45 teams went head to head to complete challenges set by the sponsors and event organisers (@ruby_gem, @seanhandley and @TheAllSeeingPie) during the Manchester Science Festival.

My team included a group of young Manchester graduates (@scootio, @andyjslack and Alan). We decided to go for the 7Digital and Esendex challenges. The 7 Digital challenge was about using their music API to create the after-party’s music system. The Esendex challenge was to use SMS messaging in a different way. My team decided that we were going to make a Radio Station, which got it’s requests directly from Twitter / SMS / Android application using a web form. Once a request was received, it searched the 7Digital library using the API and queued it in the system ready to play automatically. If there were no requests in queue, it would look up from the top 40 UK singles and choose a random track.

Hack Manchester by Rob Gough

(Photo by Rob Gough )

We started at around 5pm on the Saturday afternoon, and quickly split the team into groups. Andy and I opted for PHP, setting up a Zend Framework application for the API we were going to build. This allowed all the different sources to communicate with our stream (with a little help from @Akrabat on IRC). Scott and Alan started work on the Android application, using Eclipse and Java with the Android SDK. A couple of hours into the challenge, we had the API up and running. At this point we decided to concentrate on the playlist and getting music tracks playing from the 7Digital API. This took a while to get right; there were lots of different methods needed to turn a single into an mp3 stream. By 4am we had this all worked out. We had also added filters to stop any karaoke versions coming through the net! At 2am Andy went home to catch up on some sleep. Alan and Scott also had a few hours sleep, whilst I went for a walk round having a chat with some of the other developers I know, such as @ben_nuttall and @asadhaideruk, then continued to work alone through the night creating a continuous stream of music and creating a way to play this stream ready for our Radio station. After having a discussion with @mheap at some point earlier in the morning, we decided the best and quickest way was to use PHP’s streaming library to stream a file and feed it into a Shoutcast/Icecast server. The progress on the Android app was really fast – we had the basic app up and running, with only the submission of the artist and track name required to be sent to our new API service layer.

Hack Manchester by Manchester Science FestivalAndy came back at 8am, just before… bacon! After breakfast, Andy worked on getting the SMS integration working, whilst I worked on getting a Twitter stream integration and populating our queue, ready for the stream to continue to play our requested tracks. After lots of testing, I was now bored of listening to ‘Gangnam Style’ and being Rick Rolled every time we reset the playlist!

(Photo by Manchester Science Festival )

At approximately 1pm on Sunday, one of the main developers of the 7Digital API came around and gave us more information about the full track streaming service they provided, with more integration required using OAuth. This would have been a major development, however myself and the team hadn’t used OAuth before, particularly in a Zend Framework application – and there was only a little documentation on the 7Digital website on how to do this – however I started to implement this, but unfortunately didn’t manage to complete it in time – and only had the 30-60 second clips of the songs working during judging stage, which happened around 3pm (due to the hour we gained when the clocks changed!).

Overall, even though we didn’t win our challenges, I really enjoyed this event. It was a great get together with lots of very talented developers, some familiar faces and lots of new ones. I will definitely be adding Hack Manchester 2013 to my calender, and bringing more of the @magma_digital team along with me to the next event!