mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2026-01-02 09:50:41 +00:00
Fixed an infinite loop
Parsing this new file from soundgrinder seems to be error-prone, for now this fixes it.
This commit is contained in:
@@ -66,7 +66,7 @@ class TestWaveInfo(TestCase):
|
|||||||
for wav_file in self.all_files():
|
for wav_file in self.all_files():
|
||||||
info = wavinfo.WavInfoReader(wav_file)
|
info = wavinfo.WavInfoReader(wav_file)
|
||||||
ffprobe_info = ffprobe(wav_file)
|
ffprobe_info = ffprobe(wav_file)
|
||||||
|
if info.bext:
|
||||||
self.assertEqual( info.bext.description, ffprobe_info['format']['tags']['comment'] )
|
self.assertEqual( info.bext.description, ffprobe_info['format']['tags']['comment'] )
|
||||||
self.assertEqual( info.bext.originator, ffprobe_info['format']['tags']['encoded_by'] )
|
self.assertEqual( info.bext.originator, ffprobe_info['format']['tags']['encoded_by'] )
|
||||||
if 'originator_reference' in ffprobe_info['format']['tags']:
|
if 'originator_reference' in ffprobe_info['format']['tags']:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
import pdb
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
class ListChunkDescriptor(namedtuple('ListChunkDescriptor' , 'signature children')):
|
class ListChunkDescriptor(namedtuple('ListChunkDescriptor' , 'signature children')):
|
||||||
@@ -30,11 +30,16 @@ def parse_list_chunk(stream, length):
|
|||||||
|
|
||||||
children = []
|
children = []
|
||||||
while (stream.tell() - start) < length:
|
while (stream.tell() - start) < length:
|
||||||
children.append(parse_chunk(stream))
|
child_chunk = parse_chunk(stream)
|
||||||
|
if child_chunk:
|
||||||
|
children.append(child_chunk)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
return ListChunkDescriptor(signature=signature, children=children)
|
return ListChunkDescriptor(signature=signature, children=children)
|
||||||
|
|
||||||
def parse_chunk(stream):
|
def parse_chunk(stream):
|
||||||
|
#breakpoint()
|
||||||
ident = stream.read(4)
|
ident = stream.read(4)
|
||||||
if len(ident) != 4:
|
if len(ident) != 4:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -115,7 +115,10 @@ class WavInfoReader():
|
|||||||
|
|
||||||
def _get_bext(self, f, encoding):
|
def _get_bext(self, f, encoding):
|
||||||
bext_data = self._find_chunk_data(b'bext',f,default_none=True)
|
bext_data = self._find_chunk_data(b'bext',f,default_none=True)
|
||||||
|
if bext_data:
|
||||||
return WavBextReader(bext_data, encoding)
|
return WavBextReader(bext_data, encoding)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def _get_ixml(self,f):
|
def _get_ixml(self,f):
|
||||||
ixml_data = self._find_chunk_data(b'iXML',f,default_none=True)
|
ixml_data = self._find_chunk_data(b'iXML',f,default_none=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user