-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute.py
35 lines (24 loc) · 880 Bytes
/
execute.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys, pprint
from artist_info import ArtistInfo
def usage():
return 'Usage: %s [artist name]' % sys.argv[0]
if __name__ == '__main__':
if len(sys.argv) == 1:
print usage()
quit(1)
artist_info = ArtistInfo()
pp = pprint.PrettyPrinter(depth=6)
search = artist_info.search_artist(' '.join(sys.argv[1:]))
i=1
for r in search['artist-list']:
if 'disambiguation' in r:
print '%d\t - %s (%s)' % (i, r['name'], r['disambiguation'])
else:
print '%d\t - %s' % (i, r['name'])
i += 1
num = int(input('Selecione o numero do artista correto: '))
if (len(search['artist-list']) > num-1):
mbid = search['artist-list'][num-1]['id']
name = search['artist-list'][num-1]['name'].decode('utf-8')
info = artist_info.get_info(mbid, name)
pp.pprint(info)