def _on_new_playlist_activate(self, item, songs): parent = get_menu_item_top_parent(item) title = Playlist.suggested_name_for(songs) title = GetPlaylistName(qltk.get_top_parent(parent)).run(title) if title is None: return playlist = FileBackedPlaylist.new(PLAYLISTS, title) playlist.extend(songs) PlaylistsBrowser.changed(playlist)
def __add_to_new_playlist(songs, parent): if len(songs) == 1: title = songs[0].comma("title") else: title = ngettext("%(title)s and %(count)d more", "%(title)s and %(count)d more", len(songs) - 1) % { 'title': songs[0].comma("title"), 'count': len(songs) - 1 } title = GetPlaylistName(qltk.get_top_parent(parent)).run(title) if title is None: return playlist = Playlist.new(PLAYLISTS, title) PlaylistMenu.__add_songs_to_playlist(playlist, songs)
def _on_new_playlist_activate(self, item, songs): parent = get_menu_item_top_parent(item) if len(songs) == 1: title = songs[0].comma("title") else: title = ngettext("%(title)s and %(count)d more", "%(title)s and %(count)d more", len(songs) - 1) % { 'title': songs[0].comma("title"), 'count': len(songs) - 1 } title = GetPlaylistName(qltk.get_top_parent(parent)).run(title) if title is None: return playlist = Playlist.new(PLAYLISTS, title) playlist.extend(songs) PlaylistsBrowser.changed(playlist)
def _get_new_name(self, parent, title): """Ask the user for a name for the new playlist""" return GetPlaylistName(qltk.get_top_parent(parent)).run(title)