Curiosity got me … Looked at the Add Column Plug-in … and … !!! That’s all to add a column? That’s Nuts.
So, is there a variable that represents the number of tracks that works in that space?
…and as for why the Add Album Column can’t be disabled. But it -can- be removed. It’s literally a wedged in hack.
Looking at it, and adding to it:
from picard.ui.itemviews import MainPanel #MainPanel.columns.append((N_('Matched'), 'matched')) #MainPanel.columns.append((N_('Album'), 'album'))
Dis/enable lines as desired - the biggest question being, is there a ‘variable’ that represents the number of matched tracks for that album that can be placed there? Stabbing around in the dark, just putting various things in there, that some seem to work, many do not, and a few will just crash it.
Moving that into itemviews.py
directly … I see how the plug-in is a literal wedged in hack.
"Hey you! Let me see your list! (/me adds something to it)
Okay, you can have it back. (snicker, he’ll never notice I added that myself! )
columns = [
(N_('Title'), 'title'),
(N_('Matched'), 'matchedtracks'), # whatever would be appropriate ..
(N_('Tracks'), 'totaltracks'),
(N_('Length'), '~length'),
(N_('Artist'), 'artist'),
(N_('Album'), 'album'),
]
…and I presume that if a tick box in Options were applied to (N_('Album'), 'album'),
that would be en/disable at will.
Which brings me to album.py
Here is where the columns are being populated.
With changes to the (x/y); x images to be only (x images) at the top and need to be added at the end.
def column(self, column):
if column == 'title':
if self.status is not None:
title = self.status
else:
title = self.metadata['album']
if self.tracks:
linked_tracks = 0
for track in self.tracks:
if track.is_linked():
linked_tracks += 1
text = title
# text = '%s\u200E (%d/%d' % (title, linked_tracks, len(self.tracks))
# 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
else:
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
else:
text += ngettext(" (%i image not in all tracks)", " (%i different images among tracks)",
number_of_images) % number_of_images
return text
else:
return title
elif column == '~length':
length = self.metadata.length
if length:
return format_time(length)
else:
return ''
#### This needs to get broken into two and show up in the tracks / matched columns.
#### I've gotten this far. ... But I'm up agaist a wall with this part.
text = '(%d/%d' % (linked_tracks, len(self.tracks))
unmatched = self.get_num_unmatched_files()
if unmatched:
text += '; %d?' % (unmatched,)
unsaved = self.get_num_unsaved_files()
if unsaved:
text += '; %d*' % (unsaved,)
elif column == 'album':
return self.metadata['album']
elif column == 'artist':
return self.metadata['albumartist']
elif column == 'tracks':
return 'linked_tracks'
elif column == 'matched':
return 'totaltracks'
else:
return ''
# Reference for putting back values in new columns
#
# unmatched = self.get_num_unmatched_files()
#
# text = '%s <-> (%d|%d' % (title, linked_tracks, len(self.tracks))
# if unmatched:
# text += '; %d?' % (unmatched,)
# unsaved = self.get_num_unsaved_files()
# if unsaved:
# text += '; %d*' % (unsaved,)
`
How I interpret that is within that Definition there are two sets of things going on.
First, it populates the data for line title, with the graphic icon, the Album Name, Length and Artist Columns.
While data is being fetched from the DB Title
is temporarily defined as [loading album information]
Once Album data is fetched, title
is now populated as Album Name with the text for the amount of tracks matched, saved/not saved and sum of the amount of images retrieved is appended so we see
(O) Album Name (x/y; z image(s))
as a single string being echoed in the title column.
As a sub-set to the Bold Text Title Length Artist line, the album tracks are populated below in a loop form until there are no more to display.
…and then it’s done with that last return ''
So a Column added to MainPanel as above will result in that column being populated at the ‘sub-set’ point where the tracktitle
etc are being echoed.
First I would like to move that Album Title from the ‘sub-set’ lines (the individual tracks) to the top line so that we see all in one line:
Title. .................... Tracks | Match | Len | Artist | Album
(O) Album Name (z image(s)).. 15 ... 14 ... 3m42s . B-52's . AlbumName
.. ♫ 01 . Track Title ......................1m02s
.. ♫ 02 . Track Title ......................2m40s
(O) Next Album (z image(s)).. 20 ... 20 ... 3m42s . B-47's . Kaboom!
… etc.
With just the quick slick wedge method I can get the tracktotal
and album
columns populated. I can’t find a variable that would stand in for matchedtracks
.
I presume that i’ll need to add a elif column == 'matched'
and then attach that value to it, which I believe is already available as matchedtracks
.
Now I’m hung up on trying to restore the values to the new columns, and to get totaltracks
show on the top line.
# at the comment that says This needs to be broken up into two ..