mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-17 13:13:58 +00:00
Other versions: display the actual number of versions from release-count
This commit is contained in:
@@ -117,6 +117,7 @@ class ReleaseGroup(DataObject):
|
||||
self.version_headings = " / ".join(_(VERSIONS_HEADINGS[k]) for k in VERSIONS_NAME_KEYS)
|
||||
self.loaded_albums = set()
|
||||
self.refcount = 0
|
||||
self.versions_count = None
|
||||
|
||||
def load_versions(self, callback):
|
||||
kwargs = {'release-group': self.id, 'limit': 100}
|
||||
@@ -131,6 +132,8 @@ class ReleaseGroup(DataObject):
|
||||
except (TypeError, KeyError):
|
||||
return
|
||||
|
||||
self.versions_count = document.get('release-count', None)
|
||||
|
||||
versions = defaultdict(list)
|
||||
|
||||
# Group versions by same display name
|
||||
|
||||
@@ -402,13 +402,10 @@ def _build_other_versions_actions(releases_menu, album, alternative_versions):
|
||||
|
||||
def _add_other_versions(releases_menu, album, action_loading):
|
||||
|
||||
alt_versions = list(_alternative_versions(album))
|
||||
if album.release_group.versions_count is not None:
|
||||
releases_menu.setTitle(_("&Other versions (%d)") % album.release_group.versions_count)
|
||||
|
||||
alt_versions_count = len(alt_versions)
|
||||
if alt_versions_count > 1:
|
||||
releases_menu.setTitle(_("&Other versions (%d)") % alt_versions_count)
|
||||
|
||||
actions = _build_other_versions_actions(releases_menu, album, alt_versions)
|
||||
actions = _build_other_versions_actions(releases_menu, album, _alternative_versions(album))
|
||||
releases_menu.insertActions(action_loading, actions)
|
||||
releases_menu.removeAction(action_loading)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user