mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2026-01-02 18:00: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)
|
(options, args) = parser.parse_args(sys.argv)
|
||||||
for arg in args[1:]:
|
for arg in args[1:]:
|
||||||
try:
|
try:
|
||||||
this_file = WavInfoReader(f=arg)
|
this_file = WavInfoReader(path=arg)
|
||||||
if options.adm:
|
if options.adm:
|
||||||
if this_file.adm:
|
if this_file.adm:
|
||||||
sys.stdout.write(this_file.adm.xml_str())
|
sys.stdout.write(this_file.adm.xml_str())
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class WavInfoReader:
|
|||||||
Parse a WAV audio file for metadata.
|
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.
|
Create a new reader object.
|
||||||
|
|
||||||
@@ -80,21 +80,21 @@ class WavInfoReader:
|
|||||||
#: RIFF cues markers, labels, and notes.
|
#: RIFF cues markers, labels, and notes.
|
||||||
self.cues: Optional[WavCuesReader] = None
|
self.cues: Optional[WavCuesReader] = None
|
||||||
|
|
||||||
if hasattr(f, 'read'):
|
if hasattr(path, 'read'):
|
||||||
self.get_wav_info(f)
|
self.get_wav_info(path)
|
||||||
self.url = 'about:blank'
|
self.url = 'about:blank'
|
||||||
self.path = repr(f)
|
self.path = repr(path)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
absolute_path = os.path.abspath(f)
|
absolute_path = os.path.abspath(path)
|
||||||
|
|
||||||
#: `file://` url for the file.
|
#: `file://` url for the file.
|
||||||
self.url: str = pathlib.Path(absolute_path).as_uri()
|
self.url: str = pathlib.Path(absolute_path).as_uri()
|
||||||
|
|
||||||
self.path = absolute_path
|
self.path = absolute_path
|
||||||
|
|
||||||
with open(f, 'rb') as f:
|
with open(path, 'rb') as path:
|
||||||
self.get_wav_info(f)
|
self.get_wav_info(path)
|
||||||
|
|
||||||
def get_wav_info(self, wavfile):
|
def get_wav_info(self, wavfile):
|
||||||
chunks = parse_chunk(wavfile)
|
chunks = parse_chunk(wavfile)
|
||||||
|
|||||||
Reference in New Issue
Block a user