/** Delete selected items from a playlist (not from disk) */ public void removeSelection() { LibraryPlaylistsTableDataLine[] lines = getSelectedLibraryLines(); if (currentPlaylist != null && currentPlaylist.getId() == LibraryDatabase.STARRED_PLAYLIST_ID) { for (LibraryPlaylistsTableDataLine line : lines) { PlaylistItem playlistItem = line.getInitializeObject(); playlistItem.setStarred(false); playlistItem.save(); } LibraryMediator.instance().getLibraryExplorer().refreshSelection(); } else { for (LibraryPlaylistsTableDataLine line : lines) { PlaylistItem playlistItem = line.getInitializeObject(); playlistItem.delete(); } LibraryMediator.instance().getLibraryPlaylists().reselectPlaylist(); clearSelection(); } super.removeSelection(); }
public void actionPerformed(ActionEvent e) { Playlist playlist = getSelectedPlaylist(); if (playlist != null) { List<File> files = new ArrayList<File>(); for (PlaylistItem item : playlist.getItems()) { File file = new File(item.getFilePath()); files.add(file); } iTunesMediator.instance().addSongsiTunes(playlist.getName(), files.toArray(new File[0])); } }
/** Sets up the dataline for use with the playlist. */ public void initialize(PlaylistItem item) { super.initialize(item); sizeHolder = new SizeHolder(item.getFileSize()); exists = new File(item.getFilePath()).exists(); bitrate = initializer.getTrackBitrate(); if (bitrate != null && bitrate.length() > 0 && !bitrate.endsWith(" kbps")) { bitrate = bitrate + " kbps"; } this.nameCell = new NameHolder(initializer.getTrackTitle()); this.actionsHolder = new LibraryActionsHolder(this, false); }