Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions sonata/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def __init__(self):
self.ART_LOCAL_REMOTE = 1
self.VIEW_FILESYSTEM = 0
self.VIEW_ARTIST = 1
self.VIEW_GENRE = 2
self.VIEW_ALBUM = 3
self.VIEW_COMPOSER = 2
self.VIEW_GENRE = 3
self.VIEW_ALBUM = 4
self.LYRIC_TIMEOUT = 10
self.NOTIFICATION_WIDTH_MAX = 500
self.NOTIFICATION_WIDTH_MIN = 350
Expand All @@ -44,9 +45,10 @@ def __init__(self):
self.COVERS_TYPE_STANDARD = 0
self.COVERS_TYPE_STYLIZED = 1
self.LIB_LEVEL_GENRE = 0
self.LIB_LEVEL_ARTIST = 1
self.LIB_LEVEL_ALBUM = 2
self.LIB_LEVEL_SONG = 3
self.LIB_LEVEL_COMPOSER = 1
self.LIB_LEVEL_ARTIST = 2
self.LIB_LEVEL_ALBUM = 3
self.LIB_LEVEL_SONG = 4
self.NUM_ARTISTS_FOR_VA = 2

# the names of the plug-ins that will be enabled by default
Expand Down
10 changes: 9 additions & 1 deletion sonata/current.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ def on_current_column_click(self, column):
self.sort('col' + str(col_num), column)
return

def on_sort_by_composer(self, _action):
self.sort('composer')

def on_sort_by_artist(self, _action):
self.sort('artist')

Expand Down Expand Up @@ -398,7 +401,12 @@ def sort(self, mode, column=None):
# Those items that don't have the specified tag will be put at
# the end of the list (hence the 'zzzzzzz'):
zzz = 'zzzzzzzz'
if mode == 'artist':
if mode == 'composer':
record["sortby"] = (misc.lower_no_the(mpdh.get(track, 'composer', zzz)),
mpdh.get(track, 'artist', zzz).lower(),
mpdh.get(track, 'disc', '0', True, 0),
mpdh.get(track, 'track', '0', True, 0))
elif mode == 'artist':
record["sortby"] = (misc.lower_no_the(mpdh.get(track, 'artist', zzz)),
mpdh.get(track, 'album', zzz).lower(),
mpdh.get(track, 'disc', '0', True, 0),
Expand Down
6 changes: 6 additions & 0 deletions sonata/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def _widgets_song(self):
self.info_labels = {}
self.info_boxes_in_more = []
labels = [(_("Title"), 'title', False, "", False),
(_("Composer"), 'composer', True,
_("Launch composer in Wikipedia"), False),
(_("Artist"), 'artist', True,
_("Launch artist in Wikipedia"), False),
(_("Album"), 'album', True,
Expand Down Expand Up @@ -232,6 +234,7 @@ def update(self, playing_or_paused, newbitrate, songinfo, update_all):
getattr(self, "_update_%s" % func)(songinfo)

def _update_song(self, songinfo):
composerlabel = self.info_labels['composer']
artistlabel = self.info_labels['artist']
tracklabel = self.info_labels['track']
albumlabel = self.info_labels['album']
Expand All @@ -242,6 +245,9 @@ def _update_song(self, songinfo):
label.set_text(mpdh.get(songinfo, name))

tracklabel.set_text(mpdh.get(songinfo, 'track', '', False))
composerlabel.set_markup(misc.link_markup(misc.escape_html(
mpdh.get(songinfo, 'composer')), False, False,
self.linkcolor))
artistlabel.set_markup(misc.link_markup(misc.escape_html(
mpdh.get(songinfo, 'artist')), False, False,
self.linkcolor))
Expand Down
Loading