Guitar Hero, Wikipedia, VK, Perl, Like it!

1,855 views

Published on

Lightning talk at #yr2012

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,855
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Guitar Hero, Wikipedia, VK, Perl, Like it!

  1. 1. Guitar Hero,Wikipedia,VK, Perl, Like it! Anatoly Sharifulin YAPC::Russia 2012
  2. 2. Another storyabout me and Perl
  3. 3. Guitar Hero: guitar,drums and microphone Finally got myself a present
  4. 4. I’m Playing...
  5. 5. Plus a singer :-)
  6. 6. Guitar Hero for «kids» Hand made :-)
  7. 7. — Who plays or likes Guitar Hero?
  8. 8. — Why dont you come by? :-)
  9. 9. Thats amazing, yeah, but...
  10. 10. 1. Few familiar tracks
  11. 11. 2. Too many discs, what to buy,what songs are there?
  12. 12. Eureka!I know what to do...
  13. 13. and I know Perl!
  14. 14. 1. WikipediaOn wiki I found all disc and track details
  15. 15. 1. WikipediaWrote a Perl script to parse all tracklists and save to a database
  16. 16. 1. Wikipediamap + grep + re + insert db
  17. 17. 2.VK.comThere are all (or almost all) tracks and API on VKontakte!
  18. 18. 2.VK.com Created a VK app,accessed audio files through the OAuth Authorization
  19. 19. 2.VK.comWrote an ojo script to find links to all mp3 through API
  20. 20. 2.VK.com API Limits: no parallel requestsand 100 requests per hour from one user
  21. 21. 2.VK.comTrack search: corrected some tracks manually, umlauts and NFD (thanks to @nordicdyno)
  22. 22. 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;
  23. 23. 2.VK.comWith the same ojo wrote a downloader of mp3-files (in one stream, so not to cross the limits)
  24. 24. 2.VK.com The only screw-up of ojo: all files are of the same length; solution:$ENV{MOJO_MAX_MESSAGE_SIZE} = 100*1024*1024
  25. 25. 2.VK.com Downloaded over 650 tracks,no fun in listening to a local player...
  26. 26. 3. Frodio.com Created a radiostation with a random playlist;a tiny bug: not all tracks contain correct ID3-tags
  27. 27. 3. Frodio.com Wrote a script to edit tagsusing MP3::Tag (delete ID3v1, set ID3v2)
  28. 28. 3. Frodio.comArtist — Track title [GH disc name]
  29. 29. 3. Frodio.comTook two days to get a good radio — Radio Guitar Hero http://guitarhero.frodio.com
  30. 30. Now Im kept abreast of all GH tracks
  31. 31. Facebook EffectBut I felt lonely and posted to GH Facebook group about radio
  32. 32. Facebook Effect2250+ Likes, 43 Shared, 76 Comments, 78 peak of online listeners
  33. 33. Perl, Guitar Hero and Rock’n’Roll
  34. 34. use Perl or die;
  35. 35. Thanks! Anatoly SharifulinYAPC::Russia 2012

×