def get_artwork(request): app = SpotifyApp() artwork_path = app.album_artwork() image_name = os.path.split(artwork_path)[-1] static_image = os.path.join(settings.STATICFILES_DIRS[0], 'artwork', image_name) if not os.path.exists(static_image): os.rename(artwork_path, static_image) else: os.unlink(artwork_path) return settings.STATIC_URL + "artwork/" + image_name
def current_track(request): app = SpotifyApp() return app.current_track()
def state(request): app = SpotifyApp() position = app.position() state = app.state() return {'position': position, 'state': state}
def playpause(request): app = SpotifyApp() app.playpause() return ''
def previous_track(request): app = SpotifyApp() app.previous_track(); return ''
def next_track(request): app = SpotifyApp() app.next_track(); return ''