IGF 2013: Ze YouTube Playlist

This year’s Independent Games Festival is near, they announced the Main Competition’s Finalists just this week. But because everyone knows about those and I like collecting things and was bored, I made a huge YouTube Playlist (three to be exact, because of YT limitations) containing all Trailers of all entries. This post will be about how I did it.

Manually clicking through all 588 entries and adding every single one to aforementioned playlist would have been madness, surely there must be a way to do this via some kind of script, right? Fortunately, there is. YouTube has a well-documented Data API and thanks to Matthew Wegner‘s work on the judging backend, the IGF website now features this giant JSON feed which is updated every 30 minutes from live data, for exactly this kind of third-party funzies.

Here we go

Why Bash? Because I love it. But oh noez, how to parse a bunch of JSON? Well, someone already did it. Behold:

curl http://submit.igf.com/json | ./JSON.sh | grep -E '"video","url"[^"]*'
["entries",0,"video","url"]     "http:\/\/www.youtube.com\/watch?v=LKNBa3yji8M"
["entries",1,"video","url"]     "http:\/\/www.youtube.com\/watch?v=fVs2lCz0oWg"
["entries",2,"video","url"]     "http:\/\/www.youtube.com\/watch?v=TPlkZRqnxUQ"
["entries",3,"video","url"]     "http:\/\/www.youtube.com\/watch?v=soLtbblQnew"
["entries",4,"video","url"]     "http:\/\/www.youtube.com\/watch?v=cz_h-v76gs4"
["entries",5,"video","url"]     "http:\/\/www.youtube.com\/watch?v=A6TFwXtyK-U"
["entries",6,"video","url"]     "http:\/\/www.youtube.com\/watch?v=jC1unLrT9oM"
["entries",7,"video","url"]     "http:\/\/www.youtube.com\/watch?v=GpjwVwZhoXo"
["entries",8,"video","url"]     "http:\/\/www.youtube.com\/watch?v=aJna79Tz7TQ"
["entries",9,"video","url"]     "http:\/\/www.vimeo.com\/42731394"
# ... etc

Which grabs that giant file and returns only the video url fields we want. Next, let’s filter out the Vimeo URLs and get rid of the remaining JSON stuff, we don’t need those.

less videos.txt | grep vimeo > videos-vimeo.txt
# Save those for later.
less videos.txt | grep youtube | cut -f 2 | tr -d '"\\#\!' > videos-youtube.txt
# In fact, we only need the video IDs. Regex to the rescue!
grep -o -E '[-0-9A-Za-z_]{11}' videos-youtube.txt > youtube-ids.txt
# Blammo. Simple, but surprisingly effective.

Now we got a list of YouTube video IDs. And because we read the goddamn manual, we’re aware of YouTube’s 200 videos per playlist limit, so let’s split that file up for later:

split -d -l 200 youtube-ids.txt youtube-ids.
# Quick check if that did what we wanted.
wc -l youtube-ids*

Yay!

API Stuff

So Google wants us to use OAuth 2.0. Ugh. Luckily, as per their deprecation policy, they still provide the ClientLogin API until April 20, 2015.

Here we only need to send a single HTTPS POST request and possibly solve a CAPTCHA, which will authorize our machine temporarily and gets us the token needed for subsequent API requests. And because we don’t want or need to do stuff like calculating Content-Lenght headers manually, we can use curl:

curl https://www.google.com/accounts/ClientLogin \
--data-urlencode Email=jeremy@example.com --data-urlencode Passwd=foo+bar \
-d accountType=GOOGLE \
-d source=Ludonaut-YTplaylist-Test-v1 \
-d service=youtube

Which should generate an answer like this:

SID=DQAAAHYBADCv2pSv7nfacDNwz3zEDUGtrSvN...gI8KhGAQZV4NexHZoQPlabTsGuRZeIBxj1A
LSID=EUBBBIaBADCl-kNxvRVmcQghpt3cqSMfJ8Z...j6xFK6QxaAcqy_9Pej8jhEnxS9E61ftQGPg
Auth=EUBBIacAAADK-kNxvRVmcQghpt3cqSMfb44...PSnBj3Z2vYwOEDjjG3Q53aQVC2132JKOuGh

The Auth part is the only part we need though. The YouTube Data API uses XML, so for each video we want to add to a playlist, a seperate HTTP POST has to be made, containing the proper XML:

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
    xmlns:yt="http://gdata.youtube.com/schemas/2007">
  <id>VIDEO_ID</id>
  <yt:position>1</yt:position>
</entry>

The important part here is the VIDEO_ID. The <yt:position> tag is entirely optional. By default, the newly added video will be added to the end of a playlist. Put this into a file, for example entry.xml and POST that shit:

curl --silent --request POST --data-binary "@entry.xml" \
--header "Content-Type: application/atom+xml" \
--header "Authorization: GoogleLogin auth=ABCDEFG" \
"http://gdata.youtube.com/feeds/api/playlists/PLAYLIST_ID"

Pow! Repeat 588 times.

Just kidding, the obvious next step is of course a simple shell script looping through the video IDs. The following needs just the Auth token, three playlist IDs, and our three files containing 200 YouTube video IDs max.

Ze Script

#!/bin/bash

auth=ABCDEFG
playlist_id1=HIJK
playlist_id2=LMNO
playlist_id3=PQRS

function echoxml {
    echo '<?xml version="1.0" encoding="UTF-8"?>'
    echo '<entry xmlns="http://www.w3.org/2005/Atom"'
    echo 'xmlns:yt="http://gdata.youtube.com/schemas/2007">'
    echo "<id>$1</id>"
    echo '</entry>'
}

# brace expansion ftw
for pl in $playlist_id{1,2,3}
do
    for i in $(less youtube-ids.{00,01,02})
    do
        file="$i.xml"
        echoxml "$i" > "$file"

        for j in $(less "$file")
        do
            curl --silent --request POST --data-binary "@$j" \
            --header "Content-Type: application/atom+xml" \
            --header "Authorization: GoogleLogin auth=$auth" \
            "http://gdata.youtube.com/feeds/api/playlists/$pl"
        done
    done
done

exit 0

Boom. Now, for those pesky Vimeo videos, I’m going to use youtube-dl, as it supports Vimeo just fine and even has an option for a batch file, which makes this final step a breeze:

less videolist-vimeo | grep vimeo | cut -f 2 | tr -d '"\\#\!' > vimeolist.txt
# aww yeeaaah
youtube-dl -a vimeolist.txt

One could take this one step further and upload those videos via the data API too, but I’ll stop here. The in-browser uploader is just too convenient not to use in this case, and my goal was not to turn this into chore. Anyway, welcome to the wonderful world of Bash scripting, where you’ll save a ton of time writing cool command line magics, just to waste all of it later by bragging about it in your blog.

Thanks for reading.

Dealing with Suicide

One week ago, an old friend of mine killed himself. He jumped in front of a train.

I had not seen him in almost a year, so I guess we weren’t really what I’d call friends anymore. For several reasons I’m not going to go into we barely acknowledged each other’s existence, though we went to high school together and knew each other pretty well. We actually met at a party last year and laughed about our depressions. It turned out we both had been diagnosed and were hospitalized into the same psych ward, just a couple of weeks apart, and were both on anti-depressants. He was drinking that night. Remembering something about the possibility of unforeseen side effects, I wasn’t, and went home early.

He was always the more fatalistic and bipolar type. Having incredible heights, there were times he was convinced he could achieve anything, followed by lows of equal magnitude. I know it is crude to talk bad about a dead person, but I always imagined him drinking himself to death by accident or something. Never him committing suicide, though. Nothing ‘active’. At least not that violent and public. I don’t know what state of mind he was in, only that he was out with friends of his, drinking, the night before. While I know he still was being treated, I am not sure about the specific type of drug. I can only guess how depressed he was by third-hand stories. Ultimately we can’t look into people’s heads (yet), but somehow that still isn’t a satisfying answer to the why.

I don’t know how to deal with this. No feelings, no tears from me. But I do feel very sorry for his family and loved ones. I think no one should ever have to experience this kind of pain.

I do know that I, during a particularly terrible depressive episode of mine, had suicidal thoughts. But I now know those were more self-loathing and whining about what-ifs and feeling sorry for myself than making actual plans. I think that’s not how this works anyway. As I understand it, people suffering from severe depression sometimes reach a point where they’re actually convinced that they are doing everyone a favor by ending their life.

Talking about depression isn’t easy due to social stigma, but it is a real mental illness someone can’t just ‘snap out’ of without the help of others. As Wil Wheaton put it:

So, please, if you or someone you know suffer from Depression — with or without thoughts of suicide — please talk to someone, and get help from a doctor.

Ludum Dare 25: Field Report

I made another thing in Twine last week. It’s called Field Report and it was made for the 25th Ludum Dare Game Jam. Ludum Dare is a tri-annual “48-hour game making frenzy!” competition with an additional 24 hours for Jam entries, which have more relaxed rules and allow teams. This round’s theme was “You are the Villain”, which felt rather gimmicky since it immediately invokes lots of old and overused ideas, but that’s of course no excuse for not making a game.

This time I collaborated with my buddy Matthias. He did the artwork and I did most of the writing and wrestling with Twine, though we both sat down and kind of wasted an entire day throwing ideas back and forth until we found one that motivated us to actually try and implement it.

The basic premise of Field Report is that it’s a reverse dating simulator. Dating sims being an old and often highly misogynistic genre of games (but still very popular in Japan), with the protagonist being a lone loser trying to impress girls with gifts, requiring the player to grind through enough minigames or find the correct dialog option to win the girl’s love (“achieve a romantic relationship”) and/or virginity. The player then gets rewarded in form of ecchi pin-up art or actual hentai pornography, depending on the explicitness and type of dating sim. As I said, highly misogynistic. But also easy to mock.

The game uses this genre convention of the player being the male, desperate protagonist and turns it around – by giving the player the choice of her answers to his cheap pick-up lines, essentially turning him into the game’s antagonist. We decided to take this one step further by prompting the player for a name at the beginning of the game, which, combined with the rather cruel dialog choices available (there is only one ending though) twists the theme even further by questioning who’s the real villain in the end.

I like how people actually picked up on the title being a dig at the language of self-titled pick-up artists from the so called seduction community. A warning on following the link to that Wikipedia article, it’s I-don’t-want-to-live-on-this-planet-anymore level stuff, especially if you like me, for research, decide to read actual “Field Reports” in these forums. Trust me, I’ve… seen things.

Sadly though, because we wasted about two days IRL and spent about 8 hours all in all, maybe, on the actual game development, the story isn’t really what I’d call finished. As mentioned above, there’s only one ending and little variation, and to be honest I think the whole idea could use a little work. Maybe providing more complex systems with actual disposition values, you know, like actual dating sims. But it was fun nonetheless, we learned a lot and the game gets nice comments on the Ludum Dare site.

I also learned some cool tricks with Twine and am currently contemplating if I feel like writing them down, into a guide, maybe. We’ll see.

IndieGames Weblog about The Message

Konstantinos Dimopoulos of indiegames.com:

The Message is wonderful. The Message is wise. The Message will probably make you beautiful. Play it. Don’t let me spoil anything for you.

Well, okay, I do suppose I could let you know that this is a lavishly illustrated choose-your-own-adventure thing created with twine that does all sorts of impressive stuff with its presentation. It also happens to be a properly well written and extremely smart offering. With a sci-fi theme. Oh, yes, and it was impressively created for Fuck This Jam, meaning that the people that shouldn’t enjoy this sort of thing actually came up with something brilliant.

Finding a Replacement for Terminus

Today I decided to seek out a new monospaced/fixed-width “programmer’s font” for my terminal emulation needs. Of course, this whole discussion is one of those “there are no right/wrong answers” type of things and I’m well aware that there is no “best choice” for everyone, but here are my findings. Also, I’m not going to visually list every font I’m talking about here, Luke already did that a while ago.

I’m in love with Terminus. It is extremely easy on the eyes, has all xterm pseudographic characters, includes probably every UTF-8 glyph ever and supports all languages in the entire universe. It is on every fresh Linux box literally the first thing I’ll install if it isn’t included in the Distro. I use it everywhere I can, for every terminal and editor and so on, but it is time for a change, because it has one fatal flaw. Terminus is a bitmap font, and those do not scale at all. Its non-aliased pixel-perfectness comes with a price: The sharp crispness gets completely fucked up by every font rendering system there is if it decides to randomly apply some resampling algorithms and ancient anti-blur filters. Madness!

So bitmap fonts like Terminus and the famous Proggy Fonts are nice and super crisp and all, but also pretty much useless in the age of high-ppi ‘Retina’ displays, so I went on a quest for an adequate replacement. My personal Best Programming Font Ever™ should include:

  • a zero character (0) with a dash or at least a dot inside.
  • box-drawing characters, because I’m a shell guy.
  • easily distinguishable i, I, 1 and o, O, 0.
  • distinct backticks, single and double quotes.
  • preferrably a vertically centered Tilde. (~)
  • Oh and let’s not forget clear punctuation characters, especially braces, parenthesis and brackets.

And because I’m a lazy sob, I asked Twitter:

Monaco won, followed by Inconsolata and Consolas. Also mentioned were this nice looking derivate of Inconsolata and Inconsolata-dz called Inconsolata-g, this page which reviews 22 monospaced (but mostly bitmap) fonts, Ubuntu Mono (No.) and both Source Sans Pro and Source Code Pro, which are Adobe’s recently released Open Source Fonts.

All of the above are awesome and beautiful fonts (I’m quite fond of Inconsolata and Consolas, actually), but I felt something was still missing until I rediscovered Bitstream Vera Sans Mono, which is Gnome’s default editor font and can be downloaded for free. Bitstream Vera is also the basis for Apple’s Menlo-Regular, their default font for Terminal.app since Snow Leopard, though the improvements are marginal at best (comparison). And because that still wasn’t PERFECT™, someone did some modifications and put them on Github.

So for now (and until a scalable version of Terminus appears), I’m using Meslo.

Of course I forgot to mention Comic Sans, Anonymous Pro (nice), ProFont for Windows (awesome) and Droid Sans Mono (yawn). Oh yeah, this bitmap font called Tamsyn looks cool, too.

The Message

So I made my first game and now it’s on RPS and Freeindiegam.es and Anna Anthropy loves it and people genuinely seem to enjoy it, and I’m like, okay, that’s cool. Somewhat surreal though. Anyway, last week there was a Game Jam called Fuck This Jam. The idea was to create a game in a genre you hate, or at least not fully understand. Here’s the keynote:

“Through utter ignorance for conventions and hate for the established rules of a genre, beautiful things will happen.”

After talking about indie games in our podcast all the time, partner-in-crime Dom and I were eager to make a game together so teaming up for this one was self-evident. Since both of us are fans of Ms. Anthropy’s work and had read her guide about making text-adventure games with Twine, we decided to finally give it a try. Inspired by all the fuzz about Curiosity (our robot on Mars, not Molyneux’ crime against video games), I had this idea about a short story about humanity making accidental first contact through New Horizons, which is currently en route to Pluto. Also, I’m a lazy wannabe space nerd and wanted a theme I could easily write about without having to do too much research. So after I told him about my idea, Dom agreed to draw some sweet pictures to spice the game up visually. (Seriously, without him it wouldn’t be half as cool as it is now)

I don’t hate Interactive Fiction. In fact, I kind of like text-adventures (yet dislike the often awfully archaic text parser controls). I like that these type of games still exist, but don’t understand why someone would surrender themselves to the above-mentioned controls. Most parsers still suck, but there are some cool solutions and ideas out there. Twine is one of them, which opts for “choose your own adventure” type mechanics.

We had some issues customizing the look of it (Twine’s template system is a little shitty), but in the end it turned out great and I’m proud like hell to finally have created something I can show people and not be embarrassed about it. Creating is fucking terrifying, but also exciting. Also, I learned a lot about what a nightmare deadlines are and how nerve-wrecking fixing last-minute bugs can be. I must admit that it isn’t much of a game, but I don’t really care about that whole discussion anymore. We made something, people have fun with it. The End.

Please, go have a look at The Message. The whole thing takes about two to five minutes, depending on how fast of a reader you are. If you like, you can tell me what you think, or leave a comment over there.

Thanks for reading.

Sure, Not

Well, let’s see were this is going.

Unaware of what year it was, Joe wandered the streets desperate for help. But the English language had deteriorated into a hybrid of hillbilly, valleygirl, inner-city slang and various grunts. Joe was able to understand them, but when he spoke in an ordinary voice he sounded pompous and faggy to them.

Hi Internet. I just had a nice pizza with spinach and cheese and too much garlic on it, and watched Idiocracy again (you should totally too). My friend Dom decided to release his new minimalistic theme for WordPress, which finally got me to restart my blog. A blog. For various reasons I haven’t had the chance, or energy, to write down my thoughts or generally about stuff I find interesting online for a couple years now. Always distracted by neat little video games, never resisting the urge to blow a clever would-be proto-blog-entry in 140 characters of wit down the Twitterhole.

This is also the first time I am attempting something like this in English (helloooo, overconfidence), which is all the rage now over here in our little internet hipster corner of Sauerkraut-and-Lederhosen-Country. I also got a terrible german accent with the usual ze‘s and all, which I always find infuriating to listen to but I heard that it’s kind of cute to native speakers’ ears. Anyhow, as you can see my English is far from perfect and I am sorry for that. But as long as I get my point across I don’t really care.

I’m Jeremy, by the way.

Hi.

PS: Here’s a video I like: