From 0ec5425cd89da8458d7123692670ac4b1e25ef74 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Thu, 3 Jan 2019 19:22:13 -0800 Subject: [PATCH] Update wave_reader.py Working on a walk() method, not done yet --- wavinfo/wave_reader.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wavinfo/wave_reader.py b/wavinfo/wave_reader.py index 497b4cb..1ae7167 100644 --- a/wavinfo/wave_reader.py +++ b/wavinfo/wave_reader.py @@ -125,7 +125,17 @@ class WavInfoReader(): ixml_string = ixml_data return WavIXMLFormat(ixml_string) + def walk(self): + """ + Walk all of the available metadata fields. + :yields: a string, the :scope: of the metadatum, the string :name: of the + metadata field, and the value + """ + scopes = ('fmt','data')#,'bext','ixml','info') - + for scope in scopes: + attr = self.__getattribute__(scope) + for field in attr._fields: + yield scope, field, attr.__getattribute__(field)