diff --git a/wavinfo/__init__.py b/wavinfo/__init__.py index d7d33f0..571a434 100644 --- a/wavinfo/__init__.py +++ b/wavinfo/__init__.py @@ -7,6 +7,6 @@ Go to the documentation for wavinfo.WavInfoReader for more information. from .wave_reader import WavInfoReader from .riff_parser import WavInfoEOFError -__version__ = '1.5' +__version__ = '1.6' __author__ = 'Jamie Hardt ' -__license__ = "MIT" \ No newline at end of file +__license__ = "MIT" diff --git a/wavinfo/__main__.py b/wavinfo/__main__.py index f676acd..73cb991 100644 --- a/wavinfo/__main__.py +++ b/wavinfo/__main__.py @@ -4,6 +4,7 @@ from . import WavInfoReader import sys import json + def main(): parser = OptionParser() @@ -28,5 +29,6 @@ def main(): except Exception as e: print(e) + if __name__ == "__main__": main() diff --git a/wavinfo/rf64_parser.py b/wavinfo/rf64_parser.py index 852c0d6..8f27a4a 100644 --- a/wavinfo/rf64_parser.py +++ b/wavinfo/rf64_parser.py @@ -6,7 +6,7 @@ RF64Context = namedtuple('RF64Context','sample_count bigchunk_table') def parse_rf64(stream, signature = b'RF64'): - #print("starting parse_rf64") + # print("starting parse_rf64") start = stream.tell() assert( stream.read(4) == b'WAVE' ) @@ -19,13 +19,13 @@ def parse_rf64(stream, signature = b'RF64'): ds64_data = ds64_chunk.read_data(stream) assert(len(ds64_data) >= ds64_fields_size ) - #print("Read ds64 chunk: len()",len(ds64_data)) + # print("Read ds64 chunk: len()",len(ds64_data)) riff_size, data_size, sample_count, length_lookup_table = struct.unpack( ds64_field_spec , ds64_data[0:ds64_fields_size] ) bigchunk_table = {} chunksize64format = "<4sL" chunksize64size = struct.calcsize(chunksize64format) - #print("Found chunks64s:", length_lookup_table) + # print("Found chunks64s:", length_lookup_table) for n in range(length_lookup_table): bigname, bigsize = struct.unpack_from( chunksize64format , ds64_data, offset= ds64_fields_size ) @@ -35,6 +35,6 @@ def parse_rf64(stream, signature = b'RF64'): bigchunk_table[signature] = riff_size stream.seek(start, 0) - #print("returning from parse_rf64, context: ",RF64Context( sample_count=sample_count, bigchunk_table=bigchunk_table ) ) + # print("returning from parse_rf64, context: ", RF64Context(sample_count=sample_count, bigchunk_table=bigchunk_table)) return RF64Context( sample_count=sample_count, bigchunk_table=bigchunk_table ) diff --git a/wavinfo/riff_parser.py b/wavinfo/riff_parser.py index 5a941dd..47ead92 100644 --- a/wavinfo/riff_parser.py +++ b/wavinfo/riff_parser.py @@ -36,7 +36,7 @@ def parse_list_chunk(stream, length, rf64_context=None): signature = stream.read(4) children = [] - while (stream.tell() - start + 8) < length: + while stream.tell() - start + 8 < length: child_chunk = parse_chunk(stream, rf64_context=rf64_context) children.append(child_chunk) @@ -56,16 +56,16 @@ def parse_chunk(stream, rf64_context=None): data_size = struct.unpack('