-
-
Save thebigmunch/c80560c789ce72d46db301e15c265082 to your computer and use it in GitHub Desktop.
audio-metadata test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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