From 13f04e97de4dcccb366625b56c3f8dc8804caf5e Mon Sep 17 00:00:00 2001 From: Jim Driessen Date: Sat, 28 Jan 2017 14:13:17 +0100 Subject: [PATCH] Support for formats other than MP3 (e.g. FLAC). --- marietje/api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/marietje/api/views.py b/marietje/api/views.py index 63e8b66..a124157 100644 --- a/marietje/api/views.py +++ b/marietje/api/views.py @@ -1,5 +1,5 @@ import time -from mutagen.mp3 import MP3 +from mutagen import File from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger @@ -177,7 +177,7 @@ def upload(request): file = request.FILES['file'] - duration = MP3(file).info.length + duration = File(file).info.length hash = send_to_bertha(file) song = Song(user=request.user, artist=request.POST.get('artist'), title=request.POST.get('title'), hash=hash, duration=duration) song.save()