Can playback video with controls, need to fix performance and reducing window size

This commit is contained in:
Guillaume Tâche
2024-08-01 19:42:25 +02:00
parent 75829244b9
commit a94eaff9ad
102 changed files with 2921 additions and 423 deletions

34
run/pom.xml Normal file
View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.gtache.autosubtitle</groupId>
<artifactId>autosubtitle</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>autosubtitle-run</artifactId>
<dependencies>
<dependency>
<groupId>com.github.gtache.autosubtitle</groupId>
<artifactId>autosubtitle-ffmpeg</artifactId>
</dependency>
<dependency>
<groupId>com.github.gtache.autosubtitle</groupId>
<artifactId>autosubtitle-fx</artifactId>
</dependency>
<dependency>
<groupId>com.github.gtache.autosubtitle</groupId>
<artifactId>autosubtitle-whisper</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,100 @@
package com.github.gtache.autosubtitle.modules.run;
import com.github.gtache.autosubtitle.Audio;
import com.github.gtache.autosubtitle.Translator;
import com.github.gtache.autosubtitle.Video;
import com.github.gtache.autosubtitle.setup.SetupManager;
import com.github.gtache.autosubtitle.setup.modules.impl.SubtitleExtractorSetup;
import com.github.gtache.autosubtitle.setup.modules.impl.TranslatorSetup;
import com.github.gtache.autosubtitle.subtitle.EditableSubtitle;
import com.github.gtache.autosubtitle.subtitle.Subtitle;
import com.github.gtache.autosubtitle.subtitle.SubtitleCollection;
import com.github.gtache.autosubtitle.subtitle.SubtitleConverter;
import com.github.gtache.autosubtitle.subtitle.SubtitleExtractor;
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
/**
* Module for missing components
*/
@Module
public abstract class MissingComponentsModule {
@Provides
@Singleton
static Translator providesTranslator() {
return new Translator() {
@Override
public Locale getLocale(final String text) {
return Locale.getDefault();
}
@Override
public String translate(final String text, final Locale to) {
return text;
}
@Override
public Subtitle translate(final Subtitle subtitle, final Locale to) {
return subtitle;
}
@Override
public SubtitleCollection translate(final SubtitleCollection collection, final Locale to) {
return collection;
}
};
}
@Provides
@Singleton
static SubtitleExtractor providesSubtitleExtractor() {
return new SubtitleExtractor() {
@Override
public Collection<? extends EditableSubtitle> extract(final Video in) {
return List.of();
}
@Override
public Collection<? extends EditableSubtitle> extract(final Audio in) {
return List.of();
}
};
}
@Provides
@Singleton
static SubtitleConverter providesSubtitleConverter() {
return new SubtitleConverter() {
@Override
public String convert(final SubtitleCollection collection) {
return "";
}
@Override
public String formatName() {
return "none";
}
};
}
@Provides
@Singleton
@SubtitleExtractorSetup
static SetupManager providesSubtitleExtractorSetupManager() {
return new NoOpSetupManager();
}
@Provides
@Singleton
@TranslatorSetup
static SetupManager providesTranslatorSetupManager() {
return new NoOpSetupManager();
}
}

View File

@@ -0,0 +1,33 @@
package com.github.gtache.autosubtitle.modules.run;
import com.github.gtache.autosubtitle.setup.SetupException;
import com.github.gtache.autosubtitle.setup.SetupManager;
import com.github.gtache.autosubtitle.setup.SetupStatus;
class NoOpSetupManager implements SetupManager {
@Override
public String name() {
return "NoOpSetupManager";
}
@Override
public SetupStatus status() {
return SetupStatus.NOT_INSTALLED;
}
@Override
public void install() throws SetupException {
}
@Override
public void uninstall() throws SetupException {
}
@Override
public void update() throws SetupException {
}
}

View File

@@ -0,0 +1,24 @@
package com.github.gtache.autosubtitle.modules.run;
import com.github.gtache.autosubtitle.gui.modules.fx.FXModule;
import com.github.gtache.autosubtitle.modules.ffmpeg.FFmpegModule;
import com.github.gtache.autosubtitle.modules.gui.GuiModule;
import com.github.gtache.autosubtitle.modules.impl.CoreModule;
import com.github.gtache.autosubtitle.setup.modules.ffmpeg.FFmpegSetupModule;
import dagger.Component;
import javafx.fxml.FXMLLoader;
import javax.inject.Singleton;
/**
* Main component
*/
@Singleton
@Component(modules = {CoreModule.class, GuiModule.class, FXModule.class, FFmpegModule.class, FFmpegSetupModule.class, MissingComponentsModule.class})
public interface RunComponent {
/**
* @return The main FXML loader
*/
FXMLLoader getMainLoader();
}

View File

@@ -0,0 +1,26 @@
package com.github.gtache.autosubtitle.run;
import com.github.gtache.autosubtitle.modules.run.DaggerRunComponent;
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public final class Main extends Application {
@Override
public void start(final Stage primaryStage) throws Exception {
final var component = DaggerRunComponent.create();
final var loader = component.getMainLoader();
final Parent root = loader.load();
final var scene = new Scene(root);
final var stage = new Stage();
stage.setScene(scene);
stage.sizeToScene();
stage.show();
}
public static void main(final String[] args) {
Application.launch(args);
}
}

View File

@@ -0,0 +1,10 @@
/**
* Main module for auto-subtitle
*/
module com.github.gtache.autosubtitle.run {
requires com.github.gtache.autosubtitle.ffmpeg;
requires com.github.gtache.autosubtitle.fx;
requires com.github.gtache.autosubtitle.whisper;
opens com.github.gtache.autosubtitle.run to javafx.graphics;
}