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())
def songs(request, user=None): songs = Song.get_for_user(user) return render_to_json([song.to_json() for song in songs])