As you see the 7 in the “Unclustered Files” line is the sum of the tracks in that cluster, as is the 17, while it’s also showing the %tracknumber% for that line item, it’s serving dual purpose by co-incidence, since you’d see the album name on the Cluster folder title, and how many tracks are contained within the folder at that moment…
What I’d like to be able to do is use that behavior to have it actually add up the Size Column so that you can see how much data that Album is going to use on the disk.
If youn want to display some kind of aggregated data from the child elements on a parent you have to implement it on the parent’s column method. For the file size of albums and clusters something like this should work (completely untested code):
elif column == '~filesize':
totalsize = sum(f.metadata.filesize for f in self.iterfiles())
return "%s (%s)" % (bytes2human.decimal(totalsize), bytes2human.binary(totalsize))
As you have already seen I have started to add configurable columns to the Picard development version. For now this intentionally is limited to a rather small number of typically requested, uncontroversial and easy to implement columns. But the idea is definitely to extend this. If filesize gets added something like the above certainly will be added to the default column implementations.
What do you think I blew here? … Something in Top Tags settings I have missed. I guess it’s time for Compare Diff in the Options code… (As he laughs I’m sure… ) I’m actually learning quite a bit with all this.
I’m getting zero sum values from the above iteration of metadata.filesize. If I refer to it that way in metadatabox I get 0 as well. But ..getall("~filesize") works for the individual row data and in metadatabox.
I can’t really tell you since this is using your custom code for setting the metadata.filesize. That attribute is not normally set. Are you sure the metadata.filesize is actually set there? Or should it rather use metadata["~filesize"] instead, e.g.:
try:
totalsize = sum(int(f.metadata["~filesize"]) for f in self.iterfiles())
except ValueError:
totalsize = 0