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