Merge pull request #327 from Robbt/robbt-fix/podcast_download_decode_to_avoid_corruption

Fix podcast corruption by adding decode = true to the raw request object for the celery task
This commit is contained in:
Lucas Bickel 2017-10-08 14:50:17 +02:00 committed by GitHub
commit 1add49efdf

View file

@ -153,6 +153,7 @@ def podcast_download(id, url, callback_url, api_key, podcast_name, album_overrid
with closing(requests.get(url, stream=True)) as r:
filename = get_filename(r)
with tempfile.NamedTemporaryFile(mode ='wb+', delete=False) as audiofile:
r.raw.decode_content = True
shutil.copyfileobj(r.raw, audiofile)
# currently hardcoded for mp3s may want to add support for oggs etc
m = MP3(audiofile.name, ID3=EasyID3)