Change a param in WavInfoReader's __init__

It makes more sense this way but it breaks everything
prior to this version.
This commit is contained in:
Jamie Hardt
2023-11-08 17:58:00 -08:00
parent c25ac56555
commit 41b84b8399
2 changed files with 7 additions and 7 deletions

View File

@@ -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())

View File

@@ -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):