Guitar Hero, Wikipedia,VK, Perl, Like it! Anatoly Sharifulin YAPC::Russia 2012
Dec 05, 2014
Guitar Hero, Wikipedia, VK, Perl, Like it!
Anatoly SharifulinYAPC::Russia 2012
Another story about me and Perl
Guitar Hero: guitar, drums and microphone
Finally got myself a present
I’m Playing...
Plus a singer :-)
Guitar Hero for «kids»Hand made :-)
— Who plays or likes Guitar Hero?
— Why don't you come by? :-)
That's amazing, yeah, but...
1. Few familiar tracks
2. Too many discs,what to buy,
what songs are there?
Eureka!I know what to do...
and I know Perl!
1. WikipediaOn wiki I found all disc and track details
1. WikipediaWrote a Perl script to parse all tracklists
and save to a database
1. Wikipediamap + grep + re + insert db
2. VK.comThere are all (or almost all) tracks
and API on VKontakte!
2. VK.comCreated a VK app,
accessed audio files through the OAuth Authorization
2. VK.comWrote an ojo script to find links
to all mp3 through API
2. VK.comAPI Limits: no parallel requests
and 100 requests per hour from one user
2. VK.comTrack search: corrected some tracks manually, umlauts and NFD (thanks to @nordicdyno)
my $t = NFD( $_->{title} );$t =~ s/\pM//og;
my $q = b( $t )->url_escape->to_string;my $r = g( "https://api.vkontakte.ru/method/audio.search?q=$q&lyrics=1&count=1&access_token=$conf->{token}")->json;
2.VK.comWith the same ojo wrote a downloader of mp3-files
(in one stream, so not to cross the limits)
2.VK.comThe only screw-up of ojo:
all files are of the same length; solution:$ENV{MOJO_MAX_MESSAGE_SIZE} = 100*1024*1024
2.VK.comDownloaded over 650 tracks,
no fun in listening to a local player...
3. Frodio.comCreated a radiostation with a random playlist;
a tiny bug: not all tracks contain correct ID3-tags
3. Frodio.comWrote a script to edit tags
using MP3::Tag (delete ID3v1, set ID3v2)
3. Frodio.comArtist — Track title [GH disc name]
3. Frodio.comTook two days to get a good radio
— Radio Guitar Herohttp://guitarhero.frodio.com
Now I'm kept abreast of all GH tracks
Facebook EffectBut I felt lonely and posted to GH Facebook group
about radio
Facebook Effect2250+ Likes, 43 Shared, 76 Comments,
78 peak of online listeners
Perl, Guitar Hero and Rock’n’Roll
use Perl or die;
Thanks!Anatoly SharifulinYAPC::Russia 2012