MediaMonkey Setlist.fm Playlist Creator Script

I’m going to the Forbidden Fruit music festival this weekend and for all gigs I like to do ‘homework’ on the bands and what sets they’re likely to play. That sounds like working to have fun but concerts are always better when you know the songs!

MediaMonkey is my music player of choice; one of the reasons being its powerful scripting functionality. So creating playlists from setlist.fm got boring enough that I decided to hack together a MediaMonkey script, extension, addon, plugin or whatever you want to call it to do it for me. Luckily most of the work was done for me and I just had to adapt the Last.fm Loved Tracks Playlist Creator from psykar so 99% of the code is thanks to him.

Install the MMIP below and go to Tools -> Scripts -> Setlist FM Playlist Creator and enter a setlist URL like this one: http://www.setlist.fm/setlist/cut-copy/2011/the-button-factory-dublin-ireland-13d1b5a1.html. A playlist should be created in this format: [Setlist] ArtistName – CityName (EventDate). A message will pop up if some songs weren’t found. Future upgrades of the script might tell you what album these missing songs are on. Download the MMIP below:

Download MediaMonkey Setlist.fm Playlist Creator 1.0 MMIP

Make sure to have MediaMonkey running in administrator mode or you’ll get a “Product installation error”. For any other errors or feature requests, post as a comment below. If you like this script and it saves you time, please post a comment below telling me you use it. It’s disheartening to bother with something when you think nobody uses it!

Automatically generate Android boilerplate code from Layout XML

Java has a bit of a reputation for being too verbose which is a common stick for haters to beat it with. But as Bjarne Stroustrup says “There are only two kinds of languages: the ones people complain about and the ones nobody uses”.

But it’s a valid criticism so you want your IDE to generate the boring code for you which is where the Lazy Android Eclipse plugin from Ryan Mattison comes in. After you install it you right click on any Android Layout and select Fast Layout -> Generate Activity. It’s then supposed to write code into your class in focus but it only pastes to the clipboard for me where I can easily use in my activites of course.

So here’s my original layout XML:


<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <LinearLayout
         android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
    <RadioGroup
      android:layout_width="fill_parent"
      android:id="@+id/radio_type"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:orientation="horizontal"
      android:layout_marginBottom="10dp">
      <RadioButton android:id="@+id/radio_car"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:checked="true"
          android:text="Car" />
      <RadioButton android:id="@+id/radio_motorcycle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Motorcycle" />
      <RadioButton android:id="@+id/radio_truck"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:checked="true"
          android:text="Truck" />
      <RadioButton android:id="@+id/radio_bus"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Bus/Coach" />
    </RadioGroup>
    </LinearLayout>
    </ScrollView>

And here’s the code it generated:

 /**********DECLARES*************/
      private RadioGroup radio_type;
      private RadioButton radio_car;
      private RadioButton radio_motorcycle;
      private RadioButton radio_truck;
      private RadioButton radio_bus;
      /**********INITIALIZES*************/
      radio_type = (RadioGroup) findViewById(R.id.radio_type);
      radio_car = (RadioButton) findViewById(R.id.radio_car);
      radio_motorcycle = (RadioButton) findViewById(R.id.radio_motorcycle);
      radio_truck = (RadioButton) findViewById(R.id.radio_truck);
      radio_bus = (RadioButton) findViewById(R.id.radio_bus);
      /* Please visit http://www.ryangmattison.com for updates */

Very handy. Get the plugin here.

ryanair leaving money on the table with no customer registration

I’ve booked loads of Ryanair flights and every time they ask you for your name, address, mobile and when you check in online, they ask for your passport number and date of birth. Why do you have to do this everytime? Why can’t you register an account on the ryanair website and have all this information stored for you so you can book flights with one click. It would make life easier for customers and provid loads more potential cash for Ryanair.

They could start a self-serve ad system like Facebook’s and let advertisers target customers by nationality, destination and age. Right now they just have generic Hertz ads when you book your flight which I doubt bring in much conversions. How much would a small car hire firm in Knock make if they could target all German people over the age of 40 with a German language ad right after they’ve booked their flight to Knock? And they more targeted and higher converting ads, the more money for Ryanair. And this is guaranteed correct info, nobody is going to put a fake nationality or date of birth on their online check in.

Of course all this data gathering would need a pretty good terms and conditions but I sure that could be drawn up easy. Ryanair are leaving so much €€€ on the table, their IT department must be retarded.

charles web proxy review

As I said in my last post, I’ve written many a scraper using php with curl or fsockopen in my time, trying to write automated tools and scraping data. I’ve tried many tools to help me sniff the HTTP traffic so I could emulate it in PHP as quick as possible. I started off using Wireshark or Ethereal as it was called at the time which was complete overkill, mostly used for network trouble shooting and grabs all TCP/UDP packets which is information overload, all we want is HTTP data. Then I think I used the LiveHTTPheaders addon for Firefox which was pretty limited. Then a Java program called Burpsuite which was pretty powerful but I ran into a problem trying to automate myspace myads submissions, trying to figure out what HTTP the myads flash file was sending over HTTPS. I ran the gamut of every proxy tool out there until I came across Charles Web Proxy.

It’s basically the best out there. It sits as a proxy between the web and your browser, grabbing all data as it comes in. This usually causes problems with SSL but it has a custom SSL cert that you manually add to your browser that lets you log HTTPS data with no warnings. It can grab Flash traffic as it seems to work as a Windows proxy, not just a browser one. It presents HTTP data many different ways so you can understand what’s going on quicker. For example, a multipart form upload is presented as the the raw HTTP data sent, just the headers, just the cookies, the text body and all the form fields. I won’t list all the features as they’re all listed on the site. If you’re using any other tool for automation/scraping, you’re wasting time.

php curl debugging – seeing the exact http request headers sent by curl

In my many of years of php/curl use, I’ve hammered my head off my table countless times trying to debug scripts that weren’t emulating the browser like it was supposed to. This was pretty hard without seeing the exact HTTP request header sent by cURL each session, but this is possible now from PHP 5.1.3

Use the curl_getinfo php function with the CURLINFO_HEADER_OUT option but make sure to set option CURLINFO_HEADER_OUT to true as a curl option.

$ch = curl_init("http://www.google.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$get = curl_exec($ch);
$info=curl_getinfo($ch,CURLINFO_HEADER_OUT);
var_dump($info);

raygun 4play interview video

I remember seeing this ridiculous interview for a band called Raygun on Graham Linehan’s blog a few months. I went looking for it again and noticed Sony had forced most copies to be taken down! But I found this one on Youtube and decided to post on my site for safekeeping. My favourite bit is ‘they couldn’t even find me a job in a record store’. LOL. Sums up this coddled generation.

how to copy a website with httrack on linux

This is more for my own reference than anything. Say you see a flog on the intertubes and want to rip it and stick up for affiliate links. How to do it quickly on Linux? I used to use wget but it sucked. httrack is much better.

httrack "http://www.techcrunh.com/" -N1 -O "/home/techcrunch_rip/public_html" +techcrunch.com/* +crunchgear.com/* -v

This will rip the homepage of techcrunch and stick it in the folder specified by -O. URL filters next ensure it only downloads files from certain domains. The -N1 argument is the most important, it ensures htttrack sticks all images, css in one directory instead of creating loads of directories. Very handy.