コード例 #1
0
ファイル: ajax.py プロジェクト: bunchesofdonald/spotifyremote
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
コード例 #2
0
ファイル: ajax.py プロジェクト: bunchesofdonald/spotifyremote
def current_track(request):
    app = SpotifyApp()
    return app.current_track()
コード例 #3
0
ファイル: ajax.py プロジェクト: bunchesofdonald/spotifyremote
def state(request):
    app = SpotifyApp()
    position = app.position()
    state = app.state()
    
    return {'position': position, 'state': state}
コード例 #4
0
ファイル: ajax.py プロジェクト: bunchesofdonald/spotifyremote
def playpause(request):
    app = SpotifyApp()
    app.playpause()
    return ''
コード例 #5
0
ファイル: ajax.py プロジェクト: bunchesofdonald/spotifyremote
def previous_track(request):
    app = SpotifyApp()
    app.previous_track();
    return ''
コード例 #6
0
ファイル: ajax.py プロジェクト: bunchesofdonald/spotifyremote
def next_track(request):
    app = SpotifyApp()
    app.next_track();
    return ''