Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

iterating iso metadata? #19

Closed
dougstarfish opened this issue Jun 12, 2019 · 2 comments
Closed

iterating iso metadata? #19

dougstarfish opened this issue Jun 12, 2019 · 2 comments

Comments

@dougstarfish
Copy link

I can see you have all of the iso metadata in there, which is exactly what I'm after. I can't find a built-in method/mechanism for extracting it. While it's possible to iterate over an iso object using something like iso.volume_descriptors['primary'].dict.items(), I wonder if you have a more direct, supported, object method rather than digging into the private dict membership directly?

@dougstarfish
Copy link
Author

I'll could use vars(iso.volume_descriptors['primary']) but a 'header()' method to pull all of them in one swoop would be pretty useful as a generalized mechanism. What do you think?

something like

class PrimaryVD ...
...
def header(self):
return self.dict.items()

and you could call it like

for k, v in iso.volume_descriptors['primary'].header():
print(k + ' = ' + str(v))

@barneygale
Copy link
Owner

This is a deliberate decision as the underlying data is a kind of struct rather than a mapping. Elsewhere in the library we use object attributes for storing data that's specific to that class of object. To me, a dict is the wrong abstraction for VD entries given its set of keys is pre-defined. For your use case I think vars() should do the trick. Hope this sounds reasonable!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants