Skip to content

Instantly share code, notes, and snippets.

@thebigmunch
Last active April 19, 2020 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebigmunch/c80560c789ce72d46db301e15c265082 to your computer and use it in GitHub Desktop.
Save thebigmunch/c80560c789ce72d46db301e15c265082 to your computer and use it in GitHub Desktop.
audio-metadata test
import warnings
from pathlib import Path
import audio_metadata
audio_filepaths = []
filepaths = [
path.resolve()
for path in Path('.').glob('**/*.*')
if path.is_file()
]
for filepath in filepaths:
warnings.simplefilter("ignore", category=audio_metadata.AudioMetadataWarning)
try:
if audio_metadata.determine_format(filepath) is not None:
audio_filepaths.append(filepath)
except:
print(f"Could not determine format: {filepath}")
for audio_filepath in audio_filepaths:
warnings.simplefilter("error", category=audio_metadata.AudioMetadataWarning)
try:
m = audio_metadata.load(audio_filepath)
except Exception as e:
print(f"Could not load: {audio_filepath}")
print(f"Reason: {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment