From c05d3ce2e9f21b5e1110922d724121b6c098fce2 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Thu, 25 Jul 2013 18:49:27 -0300 Subject: [PATCH] unicode this bitch --- lyrics.py | 28 +++++++++++++++------------- lyrics.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/lyrics.py b/lyrics.py index 3534dd0..3f862ac 100644 --- a/lyrics.py +++ b/lyrics.py @@ -1,15 +1,17 @@ #!/usr/bin/env python +# -*- encoding: utf-8 -*- + import yaml import random def work(message): - print '>>>', message, '...' + print u'>>>', message, u'...' def title(message): - print "\n{0}\n".format(message) + print u"\n{0}\n".format(message) def display(message): @@ -17,7 +19,7 @@ def display(message): def get_songs(): - work('Getting content') + work(u'Getting content') result = None with open('lyrics.yaml') as content: result = yaml.load(content) @@ -25,12 +27,12 @@ def get_songs(): def pick_song(songs): - work('Picking a song') + work(u'Picking a song') song = random.choice(songs) while song['done']: - work('Song "{0}" was already picked, getting a new ' - 'one'.format(song['song'])) + work(u'Song "{0}" was already picked, getting a new ' + u'one'.format(song['song'])) song = random.choice(songs) return song @@ -44,23 +46,23 @@ def firstialize(string): def show_hints(song): - display('Artist: {0}'.format(firstialize(song['artist']))) - display('Song: {0}'.format(firstialize(song['song']))) + display(u'Artist: {0}'.format(firstialize(song['artist']))) + display(u'Song: {0}'.format(firstialize(song['song']))) def show_info(song): - display('Artist: {0}'.format(song['artist'])) - display('Song: {0}'.format(song['song'])) + display(u'Artist: {0}'.format(song['artist'])) + display(u'Song: {0}'.format(song['song'])) def show_song(song): - title('Song picked, here it is:') + title(u'Song picked, here it is:') display(song['lyrics']) - display('') + display(u'') show_hints(song) - raw_input('Press enter to display the answer:') + raw_input(u'Press enter to display the answer:') show_info(song) diff --git a/lyrics.yaml b/lyrics.yaml index 7d568bf..9c5b250 100644 --- a/lyrics.yaml +++ b/lyrics.yaml @@ -3561,3 +3561,29 @@ song: just the way you are done: true lyrics: > +- + artist: vinicius de moraes + song: A Tonga da Mironga do Kabuletê + done: false + lyrics: > + Eu caio de bossa + + Eu sou quem eu sou + + Eu saio da fossa + + Xingando em nagô + + + + Você que ouve e não fala + + Você que olha e não vê + + Eu vou lhe dar uma pala + + Você vai ter que aprender + + + + (5x)