Browse Source

unicode this bitch

master
Julio Biason 11 years ago
parent
commit
c05d3ce2e9
  1. 28
      lyrics.py
  2. 26
      lyrics.yaml

28
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)

26
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
<song title> (5x)

Loading…
Cancel
Save