From 41b84b8399e4eb13f319a151aeb50cb4d2e61fe4 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Wed, 8 Nov 2023 17:58:00 -0800 Subject: [PATCH] Change a param in WavInfoReader's __init__ It makes more sense this way but it breaks everything prior to this version. --- wavinfo/__main__.py | 2 +- wavinfo/wave_reader.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wavinfo/__main__.py b/wavinfo/__main__.py index 81640c5..f63db23 100644 --- a/wavinfo/__main__.py +++ b/wavinfo/__main__.py @@ -34,7 +34,7 @@ def main(): (options, args) = parser.parse_args(sys.argv) for arg in args[1:]: try: - this_file = WavInfoReader(path=arg) + this_file = WavInfoReader(f=arg) if options.adm: if this_file.adm: sys.stdout.write(this_file.adm.xml_str()) diff --git a/wavinfo/wave_reader.py b/wavinfo/wave_reader.py index 56a2f77..1e88afd 100644 --- a/wavinfo/wave_reader.py +++ b/wavinfo/wave_reader.py @@ -29,7 +29,7 @@ class WavInfoReader: Parse a WAV audio file for metadata. """ - def __init__(self, path, info_encoding='latin_1', bext_encoding='ascii'): + def __init__(self, f, info_encoding='latin_1', bext_encoding='ascii'): """ Create a new reader object. @@ -74,20 +74,20 @@ class WavInfoReader: #: RIFF cues markers, labels, and notes. self.cues :Optional[WavCuesReader] = None - if hasattr(path, 'read'): - self.get_wav_info(path) + if hasattr(f, 'read'): + self.get_wav_info(f) self.url = 'about:blank' - self.path = repr(path) + self.path = repr(f) else: - absolute_path = os.path.abspath(path) + absolute_path = os.path.abspath(f) #: `file://` url for the file. self.url: str = pathlib.Path(absolute_path).as_uri() self.path = absolute_path - with open(path, 'rb') as f: + with open(f, 'rb') as f: self.get_wav_info(f) def get_wav_info(self, wavfile):