From 7b4a04e03a207a5467e4b9d951c8acddcd823065 Mon Sep 17 00:00:00 2001 From: Feiteng Date: Tue, 24 Dec 2024 05:58:46 +0000 Subject: [PATCH 1/2] allow more than one candidate backends --- lhotse/audio/backend.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lhotse/audio/backend.py b/lhotse/audio/backend.py index cd6532e70..ed9abc7de 100644 --- a/lhotse/audio/backend.py +++ b/lhotse/audio/backend.py @@ -609,11 +609,6 @@ def read_audio( if b.handles_special_case(path_or_fd): candidates.append(b) - assert len(candidates) < 2, ( - f"CompositeAudioBackend has more than one sub-backend that " - f"handles a given special case for input '{path_or_fd}'" - ) - if len(candidates) == 1: try: return candidates[0].read_audio( @@ -718,11 +713,6 @@ def info( if b.handles_special_case(path_or_fd): candidates.append(b) - assert len(candidates) < 2, ( - f"CompositeAudioBackend has more than one sub-backend that " - f"handles a given special case for input '{path_or_fd}'" - ) - if len(candidates) == 1: try: return candidates[0].info(path_or_fd=path_or_fd) From e5a025aa57b75a180bdc3d455854b035d5e80a41 Mon Sep 17 00:00:00 2001 From: Feiteng Date: Fri, 3 Jan 2025 16:12:53 +0000 Subject: [PATCH 2/2] Update LibsndfileBackend --- lhotse/audio/backend.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lhotse/audio/backend.py b/lhotse/audio/backend.py index ed9abc7de..b6ce12fc0 100644 --- a/lhotse/audio/backend.py +++ b/lhotse/audio/backend.py @@ -511,8 +511,6 @@ def handles_special_case(self, path_or_fd: Union[Pathlike, FileObject]) -> bool: and not torchaudio_ffmpeg_backend_available() ): return True # prefer this to old torchaudio for file IO - if isinstance(path_or_fd, (Path, str)) and str(path_or_fd).endswith(".opus"): - return True # use libnsdfile for OPUS return False def is_applicable(self, path_or_fd: Union[Pathlike, FileObject]) -> bool: