Variable Visibiltiy in Code - MainWindow / Album / Cluster ... (Or: How do I get these to show in the list?)

Tags: #<Tag:0x00007f7d027bef40> #<Tag:0x00007f7d027bec48>

Some data will not show unless it’s in a child node in list view.

On the left, you can see the track has the additional columns populated.
On the right you can see where the additional columns are also populated.

…but they will only populate IF they are within a child node. Meaning you’ve got an exposure triangle available to expand/collapse that tree branch.

There’s three tracks on the right:
The first one has two files associated with it and it’s columns are populated.
The second one also has two files associated with it. The columns are not populated, probably it should be in this case since those columns could have different values. Fine.

The third one has only one track associated with it and it’s columns are not visible. You can see there is another copy of the same track on the left that does have the columns populated. Let’s move that one over to the right:

Now you can see both tracks have the columns populated. But if I remove additional tracks to where there is only a single track listed, the other that shows the populated column no longer will have that data visible. Let’s remove a track from the second position:

As you see now, the data is no longer showing for the remaining track.

I’m sure this is related to the code setup where values do change. So the question begs, in the code for listing column data, how can I differentiate between these so that I can get that data to list?

    elif column == 'albumtracks':
        # text = '(%d/%d' % (linked_tracks, len(self.tracks))
        # text = '%s\u200E (%d/%d' % (title, linked_tracks, len(self.tracks))
        if self.tracks:
            linked_tracks = 0
            for track in self.tracks:
                if track.is_linked():
                    linked_tracks += 1
            text = '%d' % (len(self.tracks))
            # text = '%d' % (linked_tracks)
            return text

    elif column == '~completed':
        trackcount = len(self.tracks)
        if not trackcount:
            return ''
        return '{:03.0f}%'.format(self.get_num_matched_tracks() / trackcount * 100)

    elif column == 'artcount':
        # CoverArt.set_metadata uses the orig_metadata.images if metadata.images is empty
        # in order to show existing cover art if there's no cover art for a release. So
        # we do the same here in order to show the number of images consistently.
        if self.metadata.images:
            metadata = self.metadata
            metadata = self.orig_metadata

        number_of_images = len(metadata.images)
        if getattr(metadata, 'has_common_images', True):
            # text += ngettext("; %i image", "; %i images",
            # number_of_images) % number_of_images

            text = ngettext("%i img", "%i imgs",
                             number_of_images) % number_of_images
            return text
            text = "..."

            return text

The reason is that this is file specific data, so it does not show up for tracks. You would need to change the Track.column method to return the file metadata. I would probably do this in a way that checks the number of linked files, and if there is only one and some field is not available in the track’s metadata then return the value from the first file’s metadata.

1 Like

The code for ‘Completeness’ of the album (%) on the right will show it’s value in the line listing… and it’s visually pleasing to -not- have it duplicated below. But the Media Column will not show it’s value on the line listing, only on the sub-branched lines.

So, I’d like to understand how to get the value to be visible on the expanded line vs. not visible on the collapsed line and when it appears in a column or not.

On the right, Catalog Number, Media … it’s all a single Album, it’s pretty much a given that it will be the same. So I don’t need to see it on each line. Artist? That can change of course, so that one works as desired.

I have a feeling it’s something to do with the Album line not actually being associated with a particular actual single asset.

…and related: I’d like to see the cumulative total for the file size of the whole album like it shows the track / album art image stats. Part of that is the section of code that actually does the addition and I see where those are. Though this will probably become more clear once I figure out how to get the other column…

So we both pressed submit at the same time.

Okay, so that has something to do with self.metadata.. and the display routines will display it if it’s referred to that way, where as the album title … It shows as the title on the main line, but the added Album Column does not show on the main line. So somewhere in the way those two are being presented lies the difference.