backed out of breaking change

This commit is contained in:
Jamie Hardt
2023-11-09 11:29:22 -08:00
parent ab42cba5b0
commit 514cfe0e75
2 changed files with 8 additions and 8 deletions

View File

@@ -38,7 +38,7 @@ def main():
(options, args) = parser.parse_args(sys.argv)
for arg in args[1:]:
try:
this_file = WavInfoReader(f=arg)
this_file = WavInfoReader(path=arg)
if options.adm:
if this_file.adm:
sys.stdout.write(this_file.adm.xml_str())

View File

@@ -35,7 +35,7 @@ class WavInfoReader:
Parse a WAV audio file for metadata.
"""
def __init__(self, f, info_encoding='latin_1', bext_encoding='ascii'):
def __init__(self, path, info_encoding='latin_1', bext_encoding='ascii'):
"""
Create a new reader object.
@@ -80,21 +80,21 @@ class WavInfoReader:
#: RIFF cues markers, labels, and notes.
self.cues: Optional[WavCuesReader] = None
if hasattr(f, 'read'):
self.get_wav_info(f)
if hasattr(path, 'read'):
self.get_wav_info(path)
self.url = 'about:blank'
self.path = repr(f)
self.path = repr(path)
else:
absolute_path = os.path.abspath(f)
absolute_path = os.path.abspath(path)
#: `file://` url for the file.
self.url: str = pathlib.Path(absolute_path).as_uri()
self.path = absolute_path
with open(f, 'rb') as f:
self.get_wav_info(f)
with open(path, 'rb') as path:
self.get_wav_info(path)
def get_wav_info(self, wavfile):
chunks = parse_chunk(wavfile)