DCASE-REPO / dcase_util

A collection of utilities for Detection and Classification of Acoustic Scenes and Events
https://dcase-repo.github.io/dcase_util/
MIT License
129 stars 33 forks source link

Fix a bug in AudioContainer's load_from_youtube method #6

Closed dangpzanco closed 6 years ago

dangpzanco commented 6 years ago

If tmp_file is not removed before youtube_audio.download() is called, a FileExistsError is raised on the Windows platform. Needs to be tested on Linux and Mac, but looks like it should work fine.

Reference Issue

No reference issue (that I know of). I just found this today when going thru the tutorials.

What does this implement/fix? Explain your changes.

The fix is to get tmp_file.name and then call tmp_file.close(), so we keep a safe temp filename and delete the empty file before we download the audio from Youtube.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.009%) to 50.286% when pulling f08ffd3a362f0f29c7c7489e22826aa387ff5f26 on dangpzanco:zanco-branch into 10522e8f957b1bdc272fae6854414e1882185ee0 on DCASE-REPO:develop.

toni-heittola commented 6 years ago

Thanks for this contribution. I do not have Windows installation to test this fix. However, it does not break anything on Linux side, so I merge it to the develop branch. It will be included in the upcoming v0.2.1 in a couple of days.