forked from j62/ctbrec
Remove old code
This commit is contained in:
parent
c73bdda35d
commit
fbb1c284d2
|
@ -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<TrackData> tracks = mediaPlaylist.getTracks();
|
|
||||||
// List<String> 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) {
|
private void showErrorDialog(final String title, final String msg, final Exception e) {
|
||||||
Platform.runLater(new Runnable() {
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue