Skip to content

Commit

Permalink
Allow setting GuanoFile.wav_data to fix but in d500x2guano.py whe…
Browse files Browse the repository at this point in the history
…n removing Pettersson metadata from `data` chunk
  • Loading branch information
riggsd committed Aug 9, 2018
1 parent 5a68cfb commit 0e707fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions bin/d500x2guano.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def d500x2guano(fname):
if not md:
print('Skipping non-D500X file: ' + fname, file=sys.stderr)
return False
pprint(md)
#pprint(md)

gfile = GuanoFile(fname)
gfile['GUANO|Version'] = 1.0
Expand All @@ -112,7 +112,8 @@ def d500x2guano(fname):

print(gfile.to_string())

gfile.wav_data = gfile.wav_data[D500X_DATA_SKIP_BYTES:] # throw out the metadata bytes from 'data' chunk
# throw out the Pettersson metadata bytes from 'data' chunk
gfile.wav_data = gfile.wav_data[D500X_DATA_SKIP_BYTES:]

unlock(fname) # D500X "locks" files as unwriteable, we must unlock before we can modify
gfile.write()
Expand Down
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

1.0.12

*2018-08-08*

- Allow setting `GuanoFile.wav_data`, and fix bug in `d500x2guano.py` script which strips
Pettersson metadata out of the `data` chunk


1.0.11
------

Expand Down
7 changes: 6 additions & 1 deletion guano.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
basestring = str


__version__ = '1.0.11'
__version__ = '1.0.12'

__all__ = 'GuanoFile',

Expand Down Expand Up @@ -426,6 +426,11 @@ def wav_data(self):
self._wav_data = f.read(self._wav_data_size)
return self._wav_data

@wav_data.setter
def wav_data(self, data):
self._wav_data_size = len(data)
self._wav_data = data

def write(self, make_backup=True):
"""
Write the GUANO .WAV file to disk.
Expand Down

0 comments on commit 0e707fe

Please sign in to comment.