From fbb1c284d26a1259c4c86a3a0a9beadd7aba281d Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Thu, 29 Nov 2018 13:41:45 +0100 Subject: [PATCH] Remove old code --- .../main/java/ctbrec/ui/RecordingsTab.java | 74 ------------------- 1 file changed, 74 deletions(-) diff --git a/client/src/main/java/ctbrec/ui/RecordingsTab.java b/client/src/main/java/ctbrec/ui/RecordingsTab.java index f8fef9dd..08b8a411 100644 --- a/client/src/main/java/ctbrec/ui/RecordingsTab.java +++ b/client/src/main/java/ctbrec/ui/RecordingsTab.java @@ -477,80 +477,6 @@ public class RecordingsTab extends Tab implements TabSelectionListener { } } - // private void download(Recording recording) throws IOException, ParseException, PlaylistException { - // String filename = recording.getPath().replaceAll("/", "-") + ".ts"; - // FileChooser chooser = new FileChooser(); - // chooser.setInitialFileName(filename); - // if(config.getSettings().lastDownloadDir != null && !config.getSettings().lastDownloadDir.equals("")) { - // File dir = new File(config.getSettings().lastDownloadDir); - // while(!dir.exists()) { - // dir = dir.getParentFile(); - // } - // chooser.setInitialDirectory(dir); - // } - // File target = chooser.showSaveDialog(null); - // if(target != null) { - // config.getSettings().lastDownloadDir = target.getParent(); - // String hlsBase = "http://" + config.getSettings().httpServer + ":" + config.getSettings().httpPort + "/hls"; - // URL url = new URL(hlsBase + "/" + recording.getPath() + "/playlist.m3u8"); - // LOG.info("Downloading {}", recording.getPath()); - // - // PlaylistParser parser = new PlaylistParser(url.openStream(), Format.EXT_M3U, Encoding.UTF_8); - // Playlist playlist = parser.parse(); - // MediaPlaylist mediaPlaylist = playlist.getMediaPlaylist(); - // List tracks = mediaPlaylist.getTracks(); - // List segmentUris = new ArrayList<>(); - // for (TrackData trackData : tracks) { - // String segmentUri = hlsBase + "/" + recording.getPath() + "/" + trackData.getUri(); - // segmentUris.add(segmentUri); - // } - // - // Thread t = new Thread() { - // @Override - // public void run() { - // try(FileOutputStream fos = new FileOutputStream(target)) { - // for (int i = 0; i < segmentUris.size(); i++) { - // URL segment = new URL(segmentUris.get(i)); - // InputStream in = segment.openStream(); - // byte[] b = new byte[1024]; - // int length = -1; - // while( (length = in.read(b)) >= 0 ) { - // fos.write(b, 0, length); - // } - // in.close(); - // int progress = (int) (i * 100.0 / segmentUris.size()); - // Platform.runLater(new Runnable() { - // @Override - // public void run() { - // recording.setStatus(STATUS.DOWNLOADING); - // recording.setProgress(progress); - // } - // }); - // } - // - // } catch (FileNotFoundException e) { - // showErrorDialog("Error while downloading recording", "The target file couldn't be created", e); - // LOG.error("Error while downloading recording", e); - // } catch (IOException e) { - // showErrorDialog("Error while downloading recording", "The recording could not be downloaded", e); - // LOG.error("Error while downloading recording", e); - // } finally { - // Platform.runLater(new Runnable() { - // @Override - // public void run() { - // recording.setStatus(STATUS.FINISHED); - // recording.setProgress(-1); - // } - // }); - // } - // } - // }; - // t.setDaemon(true); - // t.setName("Download Thread " + recording.getPath()); - // t.start(); - // } - // } - private void showErrorDialog(final String title, final String msg, final Exception e) { Platform.runLater(new Runnable() { @Override