motorhead.robbiecrash.me

I thought it would be really funny to a subdomain that just redirected you to a random Motorhead video on YouTube.

So I did.

tl:dr

To make motorhead.robbiecrash.me work, I first pulled a list of all the Motorhead MP3s I have in Python. Then I figured out how to write a redirect page in JavaScript. Then figured out how to randomize the redirect, and used a Google Feeling Lucky query set for to query for "motorhead youtube SONG NAME."

I did it in Python by loading my library from my Python project MPy3Syncer, and then printing all Motorhead song titles. The JavaScript randomly picks a song title, and boom you're redirected.

Python:

import pickle  
lib = pickle.load("audioLibrary.PKL")  
for UID in lib.artist["Motorhead"]:  
    print lib.UID[UID].trackName.replace(" ","+")

This, obviously, made me create slayer.robbiecrash.me and weirdal.robbiecrash.me.

JavaScript:

<script type="text/javascript">  
    var titles = new Array("SONG", "Names","Here");  
    var title = titles[Math.floor(titles.length*Math.random())]  
    uRL = "http://www.google.com/search?hl=en&q=motorhead+youtube+" + title + "&btnI=1"  
    window.location = uRL  
</script>

All of this part went nice, getting Apache to play nice with doing subdomains with virtual hosts, not so much. But that turned out to just be because of some cruft from a now-disabled phpmyadmin installation and configuration.