If I download an audio file from the web and something bad happens to the download process, how does one efficiently detect that the audio file is incomplete with python?
There are some ideas, such as using the
file command in linux:
But it recognizes that it's mp4:
audio.mp4: ISO Media, MPEG v4 system, version 2
Even mplayer detects the mp4 audio type, but fails when trying to play. I don't think launching mplayerfrom python and checking if it failed is a scalable solution though.
Here is a sample of broken file:
The sample above fails with mutagen and mp4file, causing them to hang indefinitely. It has to do with fileObject.tell().