Commit 49517623 authored by fred's avatar fred

store uploaded tracks in temporary files as older mutagen requires a real file

parent 9afd969b
......@@ -2,6 +2,7 @@ import csv
import datetime
from cStringIO import StringIO
import os
import tempfile
import mutagen
......@@ -160,8 +161,10 @@ class UploadTracksView(FormView):
missing_metadata = []
metadatas = {}
for f in tracks:
metadata = mutagen.File(f, easy=True)
f.seek(0)
with tempfile.NamedTemporaryFile(prefix='track-upload') as tmpfile:
tmpfile.write(f.read())
f.seek(0)
metadata = mutagen.File(tmpfile.name, easy=True)
if not metadata or not metadata.get('artist') or not metadata.get('title'):
missing_metadata.append(f.name)
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment