@FXML protected void addPlaylistButtom() { // wybieranie playlisty FileChooser fc = new FileChooser(); fc.getExtensionFilters().add(new ExtensionFilter("Playlist", "*.fpl")); File playlistFile = fc.showOpenDialog(root.getScene().getWindow()); // kopiowanie playlisty i dodanie jej do biblioteki File destinationDirectory = new File("Playlists/" + playlistFile.getName()); if (playlistFile.exists()) { try { FileUtils.copyFile(playlistFile, destinationDirectory); playlistList.add(playlistFile); flowPane.getChildren().clear(); drawPlaylists(); } catch (IOException e) { e.printStackTrace(); } } SystemTrayIcon.trayMessage("Succes", "Added new playlist"); }
@FXML protected void addAlbumButton() { // wybieranie folderu z albumem DirectoryChooser directoryChooser = new DirectoryChooser(); directoryChooser.setTitle("Choose album folder"); File selectedDirectory = directoryChooser.showDialog(root.getScene().getWindow()); // kopiowanie albumu do folderu biblioteki File destinationDirectory = new File("C:/Users/Public/Music/" + selectedDirectory.getName()); try { FileUtils.copyDirectory(selectedDirectory, destinationDirectory); flowPane.getChildren().clear(); clearData(); loadAlbums(); drawAlbums(); } catch (IOException e) { e.printStackTrace(); } SystemTrayIcon.trayMessage("Succes", "Added new album"); }