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 __toggle_playlist(playlist, songs, parent): has_some, has_all = playlist.has_songs(songs) if has_all: playlist.remove_songs(songs) elif has_some: resp = ConfirmMultipleSongsAction(parent, playlist, songs).run() if resp == ConfirmMultipleSongsAction.REMOVE: playlist.remove_songs(songs) elif resp == ConfirmMultipleSongsAction.ADD: playlist.extend(songs) return else: playlist.extend(songs) PlaylistsBrowser.changed(playlist)
def _on_toggle_playlist_activate(self, item, playlist, songs): parent = get_menu_item_top_parent(item) has_some, has_all = playlist.has_songs(songs) if has_all: playlist.remove_songs(songs) elif has_some: resp = ConfirmMultipleSongsAction(parent, playlist, songs).run() if resp == ConfirmMultipleSongsAction.REMOVE: playlist.remove_songs(songs) elif resp == ConfirmMultipleSongsAction.ADD: playlist.extend(songs) return else: playlist.extend(songs) PlaylistsBrowser.changed(playlist)
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 _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 on_new(widget, playlist): PlaylistsBrowser.changed(playlist)
def __add_songs_to_playlist(playlist, songs): playlist.extend(songs) PlaylistsBrowser.changed(playlist)