<commit_before>package gui;

import java.io.File;

import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

public class VideoArea extends BorderPane {

	// TODO: Comments needed
	private MediaPlayer mediaPlayer = null;
	private MediaView mediaView = null;

	// TODO: Comments needed
	public void play() {
		if (mediaPlayer != null) {
			mediaPlayer.play();
		}
	}
	
	public void pause() {
		if (mediaPlayer != null) {
			mediaPlayer.pause();
		}
	}

	public void stop() {
		if (mediaPlayer != null) {
			mediaPlayer.stop();
		}
	}

	private void loadVideo(File videoFile) {
		// check if no file has been chosen
		if (videoFile == null) {
			return;
		}
		// init video
		String url = "file://" + videoFile.getAbsolutePath();
		Media media = new Media(url);
		mediaPlayer = new MediaPlayer(media);
		mediaView = new MediaView(mediaPlayer);
		// remove open-button
		this.getChildren().clear();
		// arrange and add view
		this.setScaleX(0.5);
		this.setScaleY(0.5);
		this.setCenter(mediaView);
		// position video when loaded
		mediaPlayer.setOnReady(new Runnable() {    
            @Override
            public void run() {
            	mediaView.setTranslateX(-media.getWidth()/4);  
            	mediaView.setTranslateY(-media.getHeight()/4);  
            }
        });
	}
	
	/**
	 * Initialize Area
	 */
	public VideoArea() {
		// add open-button
		Button openButton = new Button("Open Video");
		openButton.setOnAction((event) -> {
			FileChooser fileChooser = new FileChooser();
			fileChooser.setTitle("Open Resource File");
			Stage parentWindow = TimesliceChronometer.getInstance().getPrimaryStage();
			File videoFile = fileChooser.showOpenDialog(parentWindow);
			loadVideo(videoFile);
		});
		this.setTop(openButton);
	}
}
<commit_msg>corrects handling of File to URL conversion<commit_after>package gui;

import java.io.File;
import java.net.MalformedURLException;
import java.util.logging.Logger;

import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

public class VideoArea extends BorderPane {

	// TODO: Comments needed
	private MediaPlayer mediaPlayer = null;
	private MediaView mediaView = null;

	// TODO: Comments needed
	public void play() {
		if (mediaPlayer != null) {
			mediaPlayer.play();
		}
	}
	
	public void pause() {
		if (mediaPlayer != null) {
			mediaPlayer.pause();
		}
	}

	public void stop() {
		if (mediaPlayer != null) {
			mediaPlayer.stop();
		}
	}

	private void loadVideo(File videoFile) {
		// check if no file has been chosen
		if (videoFile == null) {
			return;
		}
		// init video
		String url = null;
		try {
			url = videoFile.toURI().toURL().toString();
		} catch (MalformedURLException e) {
			Logger.getGlobal().warning(e.getLocalizedMessage());
		}
		Media media = new Media(url);
		mediaPlayer = new MediaPlayer(media);
		mediaView = new MediaView(mediaPlayer);
		// remove open-button
		this.getChildren().clear();
		// arrange and add view
		this.setScaleX(0.5);
		this.setScaleY(0.5);
		this.setCenter(mediaView);
		// position video when loaded
		mediaPlayer.setOnReady(new Runnable() {    
            @Override
            public void run() {
            	mediaView.setTranslateX(-media.getWidth()/4);  
            	mediaView.setTranslateY(-media.getHeight()/4);  
            }
        });
	}
	
	/**
	 * Initialize Area
	 */
	public VideoArea() {
		// add open-button
		Button openButton = new Button("Open Video");
		openButton.setOnAction((event) -> {
			FileChooser fileChooser = new FileChooser();
			fileChooser.setTitle("Open Resource File");
			Stage parentWindow = TimesliceChronometer.getInstance().getPrimaryStage();
			File videoFile = fileChooser.showOpenDialog(parentWindow);
			loadVideo(videoFile);
		});
		this.setTop(openButton);
	}
}

{'fraction_non_alphanumeric': 0.12469497315763788, 'fraction_numerical': 0.0029282576866764276, 'mean_word_length': 3.3560042507970245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4662834', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1278, 'n_words': 292}