예제 #1
0
파일: api.py 프로젝트: slobdell/light-api
def upload_video(request, user=None, access_token=None):

    if request.method != "POST":
        raise Http404
    uploaded_file = request.FILES['file']
    file_type = uploaded_file.content_type
    file_type = file_type
    # validate file_type here
    unique_identifier = str(uuid.uuid4())
    song_url = _upload_song(unique_identifier, uploaded_file)
    artwork_url = _upload_artwork(unique_identifier, uploaded_file)

    analysis_json = EchoNestRestClient().upload_file(song_url)
    song = Song.create(user, analysis_json, artwork_url, song_url)
    return render_to_json(song.to_json())
예제 #2
0
파일: api.py 프로젝트: slobdell/light-api
def songs(request, user=None):
    songs = Song.get_for_user(user)
    return render_to_json([song.to_json() for song in songs])