Skip to content

Commit

Permalink
Initial run of 2to3
Browse files Browse the repository at this point in the history
  • Loading branch information
Joona Hoikkala committed Jun 5, 2015
1 parent 96edfc4 commit 1f833af
Show file tree
Hide file tree
Showing 32 changed files with 103 additions and 103 deletions.
16 changes: 8 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
master_doc = 'index'

# General information about the project.
project = u'spotipy'
copyright = u'2014, Paul Lamere'
project = 'spotipy'
copyright = '2014, Paul Lamere'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -185,8 +185,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'spotipy.tex', u'spotipy Documentation',
u'Paul Lamere', 'manual'),
('index', 'spotipy.tex', 'spotipy Documentation',
'Paul Lamere', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -215,8 +215,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'spotipy', u'spotipy Documentation',
[u'Paul Lamere'], 1)
('index', 'spotipy', 'spotipy Documentation',
['Paul Lamere'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -229,8 +229,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'spotipy', u'spotipy Documentation',
u'Paul Lamere', 'spotipy', 'One line description of project.',
('index', 'spotipy', 'spotipy Documentation',
'Paul Lamere', 'spotipy', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
4 changes: 2 additions & 2 deletions examples/add_a_saved_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
username = sys.argv[1]
tids = sys.argv[2:]
else:
print "Usage: %s username track-id ..." % (sys.argv[0],)
print("Usage: %s username track-id ..." % (sys.argv[0],))
sys.exit()

token = util.prompt_for_user_token(username, scope)
Expand All @@ -24,4 +24,4 @@
results = sp.current_user_saved_tracks_add(tracks=tids)
pprint.pprint(results)
else:
print "Can't get token for", username
print("Can't get token for", username)
6 changes: 3 additions & 3 deletions examples/add_tracks_to_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
playlist_id = sys.argv[2]
track_ids = sys.argv[3:]
else:
print "Usage: %s username playlist_id track_id ..." % (sys.argv[0],)
print("Usage: %s username playlist_id track_id ..." % (sys.argv[0],))
sys.exit()

scope = 'playlist-modify-public'
Expand All @@ -22,6 +22,6 @@
sp = spotipy.Spotify(auth=token)
sp.trace = False
results = sp.user_playlist_add_tracks(username, playlist_id, track_ids)
print results
print(results)
else:
print "Can't get token for", username
print("Can't get token for", username)
4 changes: 2 additions & 2 deletions examples/artist_albums.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ def show_artist_albums(artist):
for album in albums:
name = album['name']
if name not in seen:
print(' ' + name)
print((' ' + name))
seen.add(name)

if __name__ == '__main__':
sp = spotipy.Spotify()

if len(sys.argv) < 2:
print('Usage: {0} artist name'.format(sys.argv[0]))
print(('Usage: {0} artist name'.format(sys.argv[0])))
else:
name = ' '.join(sys.argv[1:])
artist = get_artist(name)
Expand Down
18 changes: 9 additions & 9 deletions examples/artist_discography.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def show_album_tracks(album):
results = sp.next(results)
tracks.extend(results['items'])
for track in tracks:
print ' ', track['name']
print
print track
print(' ', track['name'])
print()
print(track)

def show_artist_albums(id):
albums = []
Expand All @@ -31,27 +31,27 @@ def show_artist_albums(id):
while results['next']:
results = sp.next(results)
albums.extend(results['items'])
print 'Total albums:', len(albums)
print('Total albums:', len(albums))
unique = set() # skip duplicate albums
for album in albums:
name = album['name']
if not name in unique:
print name
print(name)
unique.add(name)
show_album_tracks(album)

def show_artist(artist):
print '====', artist['name'], '===='
print 'Popularity: ', artist['popularity']
print('====', artist['name'], '====')
print('Popularity: ', artist['popularity'])
if len(artist['genres']) > 0:
print 'Genres: ', ','.join(artist['genres'])
print('Genres: ', ','.join(artist['genres']))

if __name__ == '__main__':
sp = spotipy.Spotify()
sp.trace = False

if len(sys.argv) < 2:
print('Usage: {0} artist name'.format(sys.argv[0]))
print(('Usage: {0} artist name'.format(sys.argv[0])))
else:
name = ' '.join(sys.argv[1:])
artist = get_artist(name)
Expand Down
4 changes: 2 additions & 2 deletions examples/contains_a_saved_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
username = sys.argv[1]
tids = sys.argv[2:]
else:
print "Usage: %s username track-id ..." % (sys.argv[0],)
print("Usage: %s username track-id ..." % (sys.argv[0],))
sys.exit()

token = util.prompt_for_user_token(username, scope)
Expand All @@ -21,4 +21,4 @@
results = sp.current_user_saved_tracks_contains(tracks=tids)
pprint.pprint(results)
else:
print "Can't get token for", username
print("Can't get token for", username)
4 changes: 2 additions & 2 deletions examples/create_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
username = sys.argv[1]
playlist_name = sys.argv[2]
else:
print "Usage: %s username playlist-name" % (sys.argv[0],)
print("Usage: %s username playlist-name" % (sys.argv[0],))
sys.exit()

token = util.prompt_for_user_token(username)
Expand All @@ -24,4 +24,4 @@
playlists = sp.user_playlist_create(username, playlist_name)
pprint.pprint(playlists)
else:
print "Can't get token for", username
print("Can't get token for", username)
4 changes: 2 additions & 2 deletions examples/delete_a_saved_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
username = sys.argv[1]
tids = sys.argv[2:]
else:
print "Usage: %s username track-id ..." % (sys.argv[0],)
print("Usage: %s username track-id ..." % (sys.argv[0],))
sys.exit()

token = util.prompt_for_user_token(username, scope)
Expand All @@ -23,4 +23,4 @@
results = sp.current_user_saved_tracks_delete(tracks=tids)
pprint.pprint(results)
else:
print "Can't get token for", username
print("Can't get token for", username)
4 changes: 2 additions & 2 deletions examples/remove_specific_tracks_from_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
tid, pos = t_pos.split(',')
track_ids.append( { "uri" : tid, "positions": [ int(pos)] } )
else:
print "Usage: %s username playlist_id track_id,pos track_id,pos ..." % (sys.argv[0],)
print("Usage: %s username playlist_id track_id,pos track_id,pos ..." % (sys.argv[0],))
sys.exit()

scope = 'playlist-modify-public'
Expand All @@ -28,4 +28,4 @@
results = sp.user_playlist_remove_specific_occurrences_of_tracks(username, playlist_id, track_ids)
pprint.pprint(results)
else:
print "Can't get token for", username
print("Can't get token for", username)
4 changes: 2 additions & 2 deletions examples/remove_tracks_from_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
playlist_id = sys.argv[2]
track_ids = sys.argv[3:]
else:
print "Usage: %s username playlist_id track_id ..." % (sys.argv[0],)
print("Usage: %s username playlist_id track_id ..." % (sys.argv[0],))
sys.exit()

scope = 'playlist-modify-public'
Expand All @@ -24,4 +24,4 @@
results = sp.user_playlist_remove_all_occurrences_of_tracks(username, playlist_id, track_ids)
pprint.pprint(results)
else:
print "Can't get token for", username
print("Can't get token for", username)
4 changes: 2 additions & 2 deletions examples/replace_tracks_in_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
playlist_id = sys.argv[2]
track_ids = sys.argv[3:]
else:
print "Usage: %s username playlist_id track_id ..." % (sys.argv[0],)
print("Usage: %s username playlist_id track_id ..." % (sys.argv[0],))
sys.exit()

scope = 'playlist-modify-public'
Expand All @@ -24,4 +24,4 @@
results = sp.user_playlist_replace_tracks(username, playlist_id, track_ids)
pprint.pprint(results)
else:
print "Can't get token for", username
print("Can't get token for", username)
2 changes: 1 addition & 1 deletion examples/show_artist_top_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
response = sp.artist_top_tracks(urn)

for track in response['tracks']:
print track['name']
print(track['name'])
10 changes: 5 additions & 5 deletions examples/show_featured_playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print "Whoops, need your username!"
print "usage: python featured_playlists.py [username]"
print("Whoops, need your username!")
print("usage: python featured_playlists.py [username]")
sys.exit()

token = util.prompt_for_user_token(username)
Expand All @@ -18,16 +18,16 @@
sp = spotipy.Spotify(auth=token)

response = sp.featured_playlists()
print response['message']
print(response['message'])

while response:
playlists = response['playlists']
for i, item in enumerate(playlists['items']):
print playlists['offset'] + i, item['name']
print(playlists['offset'] + i, item['name'])

if playlists['next']:
response = sp.next(playlists)
else:
response = None
else:
print "Can't get token for", username
print("Can't get token for", username)
6 changes: 3 additions & 3 deletions examples/show_my_saved_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print "Usage: %s username" % (sys.argv[0],)
print("Usage: %s username" % (sys.argv[0],))
sys.exit()

token = util.prompt_for_user_token(username, scope)
Expand All @@ -20,6 +20,6 @@
results = sp.current_user_saved_tracks()
for item in results['items']:
track = item['track']
print track['name'] + ' - ' + track['artists'][0]['name']
print(track['name'] + ' - ' + track['artists'][0]['name'])
else:
print "Can't get token for", username
print("Can't get token for", username)
8 changes: 4 additions & 4 deletions examples/show_new_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print "Whoops, need your username!"
print "usage: python new_releases.py [username]"
print("Whoops, need your username!")
print("usage: python new_releases.py [username]")
sys.exit()

token = util.prompt_for_user_token(username)
Expand All @@ -22,11 +22,11 @@
while response:
albums = response['albums']
for i, item in enumerate(albums['items']):
print albums['offset'] + i,item['name']
print(albums['offset'] + i,item['name'])

if albums['next']:
response = sp.next(albums)
else:
response = None
else:
print "Can't get token for", username
print("Can't get token for", username)
6 changes: 3 additions & 3 deletions examples/show_related.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
uri = result['artists']['items'][0]['uri']

related = sp.artist_related_artists(uri)
print 'Related artists for', name
print('Related artists for', name)
for artist in related['artists']:
print ' ', artist['name']
print(' ', artist['name'])
except:
print "usage show_related.py [artist-name]"
print("usage show_related.py [artist-name]")

4 changes: 2 additions & 2 deletions examples/show_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
tids = file.read().split()

sp = spotipy.Spotify()
for start in xrange(0, len(tids), max_tracks_per_call):
for start in range(0, len(tids), max_tracks_per_call):
results = sp.tracks(tids[start: start + max_tracks_per_call])
for track in results['tracks']:
print track['name'] + ' - ' + track['artists'][0]['name']
print(track['name'] + ' - ' + track['artists'][0]['name'])



2 changes: 1 addition & 1 deletion examples/simple0.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

results = sp.search(q='weezer', limit=20)
for i, t in enumerate(results['tracks']['items']):
print ' ', i, t['name']
print(' ', i, t['name'])
2 changes: 1 addition & 1 deletion examples/simple1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
albums.extend(results['items'])

for album in albums:
print(album['name'])
print((album['name']))

8 changes: 4 additions & 4 deletions examples/simple2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
results = spotify.artist_top_tracks(lz_uri)

for track in results['tracks'][:10]:
print 'track : ' + track['name']
print 'audio : ' + track['preview_url']
print 'cover art: ' + track['album']['images'][0]['url']
print
print('track : ' + track['name'])
print('audio : ' + track['preview_url'])
print('cover art: ' + track['album']['images'][0]['url'])
print()
2 changes: 1 addition & 1 deletion examples/simple3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
items = results['artists']['items']
if len(items) > 0:
artist = items[0]
print artist['name'], artist['images'][0]['url']
print(artist['name'], artist['images'][0]['url'])

2 changes: 1 addition & 1 deletion examples/tracks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shows tracks for the given artist

from __future__ import print_function

import spotipy
import sys
sp = spotipy.Spotify()
Expand Down
8 changes: 4 additions & 4 deletions examples/user_playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print "Whoops, need your username!"
print "usage: python user_playlists.py [username]"
print("Whoops, need your username!")
print("usage: python user_playlists.py [username]")
sys.exit()

token = util.prompt_for_user_token(username)
Expand All @@ -23,6 +23,6 @@
sp = spotipy.Spotify(auth=token)
playlists = sp.user_playlists(username)
for playlist in playlists['items']:
print playlist['name']
print(playlist['name'])
else:
print "Can't get token for", username
print("Can't get token for", username)
Loading

0 comments on commit 1f833af

Please sign in to comment.