mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2025-12-31 08:50:41 +00:00
backed out of breaking change
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user