From 54e76b7c74c42ed092ba5aa727e839e3d1dc403c Mon Sep 17 00:00:00 2001 From: Roman Korostik Date: Thu, 28 Nov 2024 03:37:41 +0400 Subject: [PATCH 1/4] LibsndfileBackend: Exclude mp4/m4a/m4b files from set of files it is applicable to --- lhotse/audio/backend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lhotse/audio/backend.py b/lhotse/audio/backend.py index 278f2b00b..95ed1616c 100644 --- a/lhotse/audio/backend.py +++ b/lhotse/audio/backend.py @@ -516,6 +516,10 @@ def handles_special_case(self, path_or_fd: Union[Pathlike, FileObject]) -> bool: return False def is_applicable(self, path_or_fd: Union[Pathlike, FileObject]) -> bool: + if isinstance(path_or_fd, (Path, str)) and any( + str(path_or_fd).endswith(ext) for ext in [".mp4", ".m4a", ".m4b"] + ): + return False return True def supports_save(self) -> bool: From f66d61f4bc0ad34e135805c8949ef50554c3e98e Mon Sep 17 00:00:00 2001 From: Roman Korostik Date: Thu, 28 Nov 2024 19:25:23 +0400 Subject: [PATCH 2/4] AudioreadBackend: supports_info=True --- lhotse/audio/backend.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lhotse/audio/backend.py b/lhotse/audio/backend.py index 95ed1616c..449bcbed0 100644 --- a/lhotse/audio/backend.py +++ b/lhotse/audio/backend.py @@ -574,6 +574,9 @@ def read_audio( offset=offset, duration=duration, ) + + def supports_info(self): + return True def info( self, From 55041fe4c4bbfe7bd95d0dd20b0e8be11df2862a Mon Sep 17 00:00:00 2001 From: Roman Korostik Date: Mon, 2 Dec 2024 18:33:30 +0400 Subject: [PATCH 3/4] shar export: fix exception printing --- lhotse/cut/set.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lhotse/cut/set.py b/lhotse/cut/set.py index 5a62ba21c..a878ada21 100644 --- a/lhotse/cut/set.py +++ b/lhotse/cut/set.py @@ -3570,7 +3570,7 @@ def _export_to_shar_single( except Exception as e: if fault_tolerant: logging.warning( - "Skipping: failed to load cut '{cut.id}'. Error message: {e}." + f"Skipping: failed to load cut '{cut.id}'. Error message: {e}." ) else: raise From b2dd719d57c32824cd727e141a3e61adf06fdfb8 Mon Sep 17 00:00:00 2001 From: Roman Korostik Date: Thu, 5 Dec 2024 17:51:40 +0400 Subject: [PATCH 4/4] AudioreadBackend: black formatting --- lhotse/audio/backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lhotse/audio/backend.py b/lhotse/audio/backend.py index 449bcbed0..cd6532e70 100644 --- a/lhotse/audio/backend.py +++ b/lhotse/audio/backend.py @@ -574,7 +574,7 @@ def read_audio( offset=offset, duration=duration, ) - + def supports_info(self): return True