Example #1
0
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
Example #2
0
def current_track(request):
    app = SpotifyApp()
    return app.current_track()
Example #3
0
def state(request):
    app = SpotifyApp()
    position = app.position()
    state = app.state()
    
    return {'position': position, 'state': state}
Example #4
0
def playpause(request):
    app = SpotifyApp()
    app.playpause()
    return ''
Example #5
0
def previous_track(request):
    app = SpotifyApp()
    app.previous_track();
    return ''
Example #6
0
def next_track(request):
    app = SpotifyApp()
    app.next_track();
    return ''