Exemple #1
0
def index(request):
    playlist_files = None
    if 'playlist' in request.GET:
        playlist_name, cache_entries = get_playlist_files(
            request.GET['playlist'])
        playlist_files = [i.path for i in cache_entries]
    data = {'playlist': playlist_files}
    return render(request, 'player/index.html', data)
Exemple #2
0
def index(request):
    playlist_files = None
    if 'playlist' in request.GET:
        playlist_name, playlist_files = get_playlist_files(request.GET['playlist'])
    data = {
        'playlist': playlist_files
    }
    return render(request, 'player/index.html', data)
Exemple #3
0
def index(request):
    playlist_files = None
    if 'playlist' in request.GET:
        playlist_name, cache_entries = get_playlist_files(request.GET['playlist'])
        playlist_files = [i.path for i in cache_entries]
    data = {
        'playlist': playlist_files
    }
    return render(request, 'player/index.html', data)
Exemple #4
0
def download_pls(request, playlist_path):
    files = []
    playlist_name, cache_entries = get_playlist_files(playlist_path)
    for f in cache_entries:
        file_data = f.easy
        file_data['path'] = request.build_absolute_uri(build_url('player.views.get_file', get={
            'path': f.path,
            'username': request.user.username,
            'token': get_user_token(request.user),
        }))
        files.append(file_data)

    data = {
        'files': files
    }

    response = render(request, 'download/pls.txt', data)
    response['Content-Disposition'] = ('attachment; filename="[' +
                                       playlist_path.replace('/', '-') + '] ' +
                                       playlist_name + '.pls"')
    response['Content-Type'] = 'audio/x-scpls'
    return response
Exemple #5
0
def download_pls(request, playlist_path):
    files = []
    playlist_name, cache_entries = get_playlist_files(playlist_path)
    for f in cache_entries:
        file_data = f.easy
        file_data['path'] = request.build_absolute_uri(
            build_url('player.views.get_file',
                      get={
                          'path': f.path,
                          'username': request.user.username,
                          'token': get_user_token(request.user),
                      }))
        files.append(file_data)

    data = {'files': files}

    response = render(request, 'download/pls.txt', data)
    response['Content-Disposition'] = ('attachment; filename="[' +
                                       playlist_path.replace('/', '-') + '] ' +
                                       playlist_name + '.pls"')
    response['Content-Type'] = 'audio/x-scpls'
    return response