def add_track(self, track_id, num, title, length, pos): """ Add track to list @param track id as int @param track number as int @param title as str @param length as str @param pos as int @param show cover as bool """ track_row = TrackRow(self._show_menu, self._show_loved) track_row.show_indicator(Lp.player.current_track.id == track_id, utils.is_loved(track_id)) if pos: track_row.set_num_label( '''<span foreground="%s" font_desc="Bold">%s</span>''' % (rgba_to_hex(Lp.window.get_selected_color()), str(pos))) elif num > 0: track_row.set_num_label(str(num)) track_row.set_number(num) track_row.set_title_label(title) track_row.set_duration_label(seconds_to_string(length)) track_row.set_object_id(track_id) track_row.show() self.add(track_row)
def add_track(self, track_id, num, title, length, pos): """ Add track to list @param track id as int @param track number as int @param title as str @param length as str @param pos as int @param show cover as bool """ track_row = TrackRow() track_row.show_menu(self._show_menu) if Lp.player.current_track.id == track_id: track_row.show_icon(True) if pos: track_row.set_num_label( '''<span foreground="%s" font_desc="Bold">%s</span>''' % (rgba_to_hex(Lp.window.get_selected_color()), str(pos))) elif num > 0: track_row.set_num_label(str(num)) track_row.set_number(num) track_row.set_title_label(title) track_row.set_duration_label(seconds_to_string(length)) track_row.set_object_id(track_id) track_row.show() self.add(track_row)
def add_album(self, track_id, album, num, title, length, pos): """ Add album row to the list @param track id as int @param album as album (None) @param track number as int @param title as str @param length as str @param pos as int @param show cover as bool """ album_row = AlbumRow(self._show_loved) album_row.show_indicator(Lp().player.current_track.id == track_id, utils.is_loved(track_id)) if pos: album_row.set_num_label( """<span foreground="%s" font_desc="Bold">%s</span>""" % (rgba_to_hex(Lp().window.get_selected_color()), str(pos)) ) elif num > 0: album_row.set_num_label(str(num)) album_row.set_number(num) album_row.set_title_label(title) album_row.set_duration_label(seconds_to_string(length)) album_row.set_object_id(track_id) if album is not None: album_row.set_album_and_artist(album.id) surface = Lp().art.get_album_artwork(album, ArtSize.MEDIUM * album_row.get_scale_factor()) album_row.set_cover(surface, Lp().albums.get_name(album.id)) del surface album_row.show_header() album_row.show() self.add(album_row)
def add_album(self, track_id, album, num, title, length, pos): """ Add album row to the list @param track id as int @param album as album (None) @param track number as int @param title as str @param length as str @param pos as int @param show cover as bool """ album_row = AlbumRow(self._show_loved) album_row.show_indicator(Lp().player.current_track.id == track_id, utils.is_loved(track_id)) if pos: album_row.set_num_label( '''<span foreground="%s" font_desc="Bold">%s</span>''' % (rgba_to_hex(Lp().window.get_selected_color()), str(pos))) elif num > 0: album_row.set_num_label(str(num)) album_row.set_number(num) album_row.set_title_label(title) album_row.set_duration_label(seconds_to_string(length)) album_row.set_object_id(track_id) if album is not None: album_row.set_album_and_artist(album.id) surface = Lp().art.get_album_artwork( album, ArtSize.MEDIUM * album_row.get_scale_factor()) album_row.set_cover(surface, Lp().albums.get_name(album.id)) del surface album_row.show_header() album_row.show() self.add(album_row)
def _update_pos_label(self, widget): """ Update position label @param player @param track id as int """ for row in self.get_children(): track_id = row.get_object_id() if Lp.player.is_in_queue(track_id): pos = Lp.player.get_track_position(track_id) row.set_num_label( '''<span foreground="%s" font_desc="Bold">%s</span>''' % (rgba_to_hex(Lp.window.get_selected_color()), str(pos))) elif row.get_number() > 0: row.set_num_label(str(row.get_number())) else: row.set_num_label('')
def add_album(self, track_id, album_id, num, title, length, pos): """ Add album row to the list @param track id as int @param album id as int or None @param track number as int @param title as str @param length as str @param pos as int @param show cover as bool """ album_row = AlbumRow() album_row.show_menu(self._show_menu) if Lp.player.current_track.id == track_id: album_row.show_icon(True) if pos: album_row.set_num_label( '''<span foreground="%s" font_desc="Bold">%s</span>''' % (rgba_to_hex(Lp.window.get_selected_color()), str(pos))) elif num > 0: album_row.set_num_label(str(num)) album_row.set_number(num) album_row.set_title_label(title) album_row.set_duration_label(seconds_to_string(length)) album_row.set_object_id(track_id) if album_id is not None: album_row.set_album_and_artist(album_id) album_id = Lp.tracks.get_album_id(track_id) surface = Lp.art.get_album( album_id, ArtSize.MEDIUM*album_row.get_scale_factor()) album_row.set_cover(surface, Lp.albums.get_name(album_id)) del surface album_row.show_header(True) album_row.show() self.add(album_row)