Adding Additional _Internal Tags to the Metadata Window?

I added ~filesize to the list of _variables internally…

…and am trying to figure out how to get it to be visible in the Metadata View:

The only thing I see different with those Picard internal tag _variables is them being listed separately in tags, under preserved tags and other than the two that already are there, length and rating, which do have descriptor entries.

PRESERVED_TAGS = (
    '~bitrate',
    '~bits_per_sample',
    '~channels',
    '~dirname',
    '~extension',
    '~filename',
    '~format',

So I also added them to the list of descriptors:

    'engineer': N_('Engineer'),
    '~filename': N_('Filename'), # amd
    '~filesize': N_('Filesize'), # amd
    'genre': N_('Genre'),
    'genresort' : N_('Genre Sort'), # amd

…and they’re able to be selected as an option to keep on top of the list, but something else is still keeping them out of the metadata window. Otherwise, any tag will show up without any extra code. Since ~length is one of those internal ones that is also a selection, and will show up in the metadata window. What else might be keeping that from there?

The only change required to make the filesize appear in the metadata box is to add two lines after https://github.com/metabrainz/picard/blob/53a0894e988e1f3dd32c8d284ffadc521c2941f7/picard/ui/metadatabox.py#L491-L492, similar to:

            tag_diff.add("~filesize",
                         orig_metadata.getall("~filesize"), new_metadata.getall("~filesize"), False)

and then work through the file to add ~filesize to all the places where ~length is treated specially, if appropriate.

You can see how any tags beginning with ~ are filtered out in the for-loop just above that block of code.

2 Likes

!!! If I could click that ‘Like’ a few more times…
Perfect! Thank you!

Being able to see the path/filenames in both the columns and when selecting individual tracks is so much help when having to pick through duplicates and such.

Having it actually change when saved would be a small bonus, but just having it there is worth way more. :slight_smile: :stadium: :boom: :100: