Extraction works

This commit is contained in:
Guillaume Tâche
2024-08-04 21:55:30 +02:00
parent 8002fc6719
commit 5efdaa6f63
121 changed files with 3360 additions and 400 deletions

View File

@@ -64,7 +64,7 @@ public interface MediaModel {
void setPosition(long position);
/**
* @return The current list of subtitles
* @return The current subtitles
*/
List<EditableSubtitle> subtitles();
}

View File

@@ -0,0 +1,22 @@
package com.github.gtache.autosubtitle.gui;
/**
* Controller for the parameters view
*/
public interface ParametersController {
/**
* Saves the parameters
*/
void save();
/**
* Resets the parameters
*/
void reset();
/**
* @return The model
*/
ParametersModel model();
}

View File

@@ -0,0 +1,67 @@
package com.github.gtache.autosubtitle.gui;
import com.github.gtache.autosubtitle.subtitle.ExtractionModel;
import com.github.gtache.autosubtitle.subtitle.OutputFormat;
import java.util.List;
/**
* Model for the media view
*/
public interface ParametersModel {
/**
* @return The available extraction models
*/
List<ExtractionModel> availableExtractionModels();
/**
* @return The current extraction model
*/
ExtractionModel extractionModel();
/**
* @param model The new extraction model
*/
void setExtractionModel(ExtractionModel model);
/**
* @return The available output formats
*/
List<OutputFormat> availableOutputFormats();
/**
* @return The current output format
*/
OutputFormat outputFormat();
/**
* @param format The new output format
*/
void setOutputFormat(OutputFormat format);
/**
* @return The available font families
*/
List<String> availableFontFamilies();
/**
* @return The current font family
*/
String fontFamily();
/**
* @param fontFamily The new font family
*/
void setFontFamily(String fontFamily);
/**
* @return The current font size
*/
int fontSize();
/**
* @param fontSize The new font size
*/
void setFontSize(int fontSize);
}

View File

@@ -0,0 +1,32 @@
package com.github.gtache.autosubtitle.gui;
/**
* Formatter for times
*/
public interface TimeFormatter {
/**
* Formats the given elapsed time and total time into a string
*
* @param elapsed The elapsed time in milliseconds
* @param total The total time in milliseconds
* @return The formatted string
*/
String format(long elapsed, long total);
/**
* Formats the given time into a string
*
* @param millis The time in milliseconds
* @return The formatted string
*/
String format(long millis);
/**
* Parses the given string
*
* @param time The time as a string
* @return The time in milliseconds
*/
long parse(final String time);
}

View File

@@ -1,10 +1,12 @@
package com.github.gtache.autosubtitle.gui;
import com.github.gtache.autosubtitle.Language;
import com.github.gtache.autosubtitle.Video;
import com.github.gtache.autosubtitle.subtitle.EditableSubtitle;
import com.github.gtache.autosubtitle.subtitle.ExtractionModel;
import com.github.gtache.autosubtitle.subtitle.SubtitleCollection;
import java.util.List;
import java.util.Locale;
/**
* Model for the main view
@@ -16,11 +18,31 @@ public interface WorkModel {
*/
Video video();
/**
* @return The current extraction model
*/
ExtractionModel extractionModel();
/**
* @param model The new extraction model
*/
void setExtractionModel(ExtractionModel model);
/**
* @return The current subtitle collection
*/
SubtitleCollection subtitleCollection();
/**
* @return The current list of subtitles
*/
List<EditableSubtitle> subtitles();
/**
* @return The current text
*/
String text();
/**
* @return The original extracted subtitles (used to reset)
*/
@@ -31,8 +53,48 @@ public interface WorkModel {
*/
EditableSubtitle selectedSubtitle();
/**
* @return The list of available video languages
*/
List<Language> availableVideoLanguages();
/**
* @return The list of available translations languages
*/
List<Language> availableTranslationsLanguage();
/**
* @return The video language
*/
Language videoLanguage();
/**
* @param language The video language
*/
void setVideoLanguage(Language language);
/**
* @return The list of selected translations
*/
List<Locale> translations();
List<Language> translations();
/**
* @return The current status
*/
WorkStatus status();
/**
* @param status The new status
*/
void setStatus(WorkStatus status);
/**
* @return The current progress
*/
double progress();
/**
* @param progress The new progress
*/
void setProgress(double progress);
}

View File

@@ -0,0 +1,8 @@
package com.github.gtache.autosubtitle.gui;
/**
* Possible statuses for the work controller
*/
public enum WorkStatus {
IDLE, EXTRACTING, TRANSLATING, EXPORTING
}

View File

@@ -0,0 +1,9 @@
package com.github.gtache.autosubtitle.gui.spi;
import java.util.spi.ResourceBundleProvider;
/**
* Provider for ParametersBundle
*/
public interface ParametersBundleProvider extends ResourceBundleProvider {
}

View File

@@ -0,0 +1,9 @@
package com.github.gtache.autosubtitle.gui.spi;
import java.util.spi.AbstractResourceBundleProvider;
/**
* Implementation of {@link ParametersBundleProvider}
*/
public class ParametersBundleProviderImpl extends AbstractResourceBundleProvider implements ParametersBundleProvider {
}

View File

@@ -0,0 +1,16 @@
package com.github.gtache.autosubtitle.modules.gui;
import javax.inject.Qualifier;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Qualifier
@Documented
@Retention(RUNTIME)
@Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
public @interface FontFamily {
}

View File

@@ -0,0 +1,16 @@
package com.github.gtache.autosubtitle.modules.gui;
import javax.inject.Qualifier;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Qualifier
@Documented
@Retention(RUNTIME)
@Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
public @interface FontSize {
}

View File

@@ -6,6 +6,7 @@ import dagger.Provides;
import javax.inject.Singleton;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.ResourceBundle;
/**
@@ -19,6 +20,7 @@ public class GuiModule {
return new CombinedResourceBundle(ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.MainBundle"),
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.SetupBundle"),
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.WorkBundle"),
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.ParametersBundle"),
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.MediaBundle"));
}
@@ -26,10 +28,10 @@ public class GuiModule {
@Singleton
@Play
static byte[] providesPlayImage() {
try {
return GuiModule.class.getResourceAsStream("/com/github/gtache/autosubtitle/gui/play_64.png").readAllBytes();
try (final var in = GuiModule.class.getResourceAsStream("/com/github/gtache/autosubtitle/gui/play_64.png")) {
return in.readAllBytes();
} catch (final IOException e) {
throw new RuntimeException(e);
throw new UncheckedIOException(e);
}
}
@@ -37,10 +39,24 @@ public class GuiModule {
@Singleton
@Pause
static byte[] providesPauseImage() {
try {
return GuiModule.class.getResourceAsStream("/com/github/gtache/autosubtitle/gui/pause_64.png").readAllBytes();
try (final var in = GuiModule.class.getResourceAsStream("/com/github/gtache/autosubtitle/gui/pause_64.png")) {
return in.readAllBytes();
} catch (final IOException e) {
throw new RuntimeException(e);
throw new UncheckedIOException(e);
}
}
@Provides
@Singleton
@FontFamily
static String providesFontFamily() {
return "Arial";
}
@Provides
@Singleton
@FontSize
static int providesFontSize() {
return 12;
}
}

View File

@@ -1,5 +1,7 @@
import com.github.gtache.autosubtitle.gui.spi.MainBundleProvider;
import com.github.gtache.autosubtitle.gui.spi.MainBundleProviderImpl;
import com.github.gtache.autosubtitle.gui.spi.ParametersBundleProvider;
import com.github.gtache.autosubtitle.gui.spi.ParametersBundleProviderImpl;
import com.github.gtache.autosubtitle.gui.spi.SetupBundleProvider;
import com.github.gtache.autosubtitle.gui.spi.SetupBundleProviderImpl;
import com.github.gtache.autosubtitle.gui.spi.WorkBundleProvider;
@@ -18,6 +20,7 @@ module com.github.gtache.autosubtitle.gui {
exports com.github.gtache.autosubtitle.modules.gui;
provides MainBundleProvider with MainBundleProviderImpl;
provides ParametersBundleProvider with ParametersBundleProviderImpl;
provides SetupBundleProvider with SetupBundleProviderImpl;
provides WorkBundleProvider with WorkBundleProviderImpl;
}

View File

@@ -1,2 +1,3 @@
main.tab.parameters.label=Parameters
main.tab.setup.label=Setup
main.tab.work.label=Work

View File

@@ -1,2 +1,3 @@
main.tab.parameters.label=Param\u00E8tres
main.tab.setup.label=Installation
main.tab.work.label=Travail

View File

@@ -0,0 +1,6 @@
parameters.button.reset.label=Reset
parameters.button.save.label=Save
parameters.extraction.model.label=Model to use for subtitle extraction
parameters.subtitles.font.family=Default subtitle font name
parameters.subtitles.font.size=Default subtitle font size
parameters.subtitles.output.format=Output format for the subtitles

View File

@@ -0,0 +1,6 @@
parameters.button.reset.label=R\u00E9initialiser
parameters.button.save.label=Sauvegarder
parameters.extraction.model.label=Mod\u00E8le utilis\u00E9 pour l'extraction des sous-titres
parameters.subtitles.font.family=Police par d\u00E9faut pour les sous-titres
parameters.subtitles.font.size=Taille de la police par d\u00E9faut pour les sous-titres
parameters.subtitles.output.format=Format de sortie pour les sous-titres

View File

@@ -1,4 +1,16 @@
setup.description.label=Status of the various tools used by the app
setup.event.check.end.label=Checked {0}
setup.event.check.start.label=Checking {0}
setup.event.delete.end.label=Deleted {0}
setup.event.delete.start.label=Deleting {0}
setup.event.download.end.label=Downloaded {0}
setup.event.download.start.label=Downloading {0}
setup.event.install.end.label=Installed {0}
setup.event.install.start.label=Installing {0}
setup.event.uninstall.end.label=Uninstalled {0}
setup.event.uninstall.start.label=Uninstalling {0}
setup.event.update.end.label=Updated {0}
setup.event.update.start.label=Updating {0}
setup.install.error.label=An error occurred while installing : {0}
setup.install.error.title=Error installing
setup.menu.install.label=Install
@@ -8,9 +20,11 @@ setup.menu.uninstall.label=Uninstall
setup.menu.update.label=Update
setup.reinstall.error.label=An error occurred while reinstalling : {0}
setup.reinstall.error.title=Error reinstalling
setup.status.bundle_installed.label=is installed.
setup.status.errored.label=threw an error.
setup.status.installed.label=is installed.
setup.status.not_installed.label=is not installed.
setup.status.system_installed.label=is installed (system).
setup.status.update_available.label=has an available update.
setup.uninstall.error.label=An error occurred while uninstalling : {0}
setup.uninstall.error.title=Error uninstalling

View File

@@ -1,4 +1,16 @@
setup.description.label=Statut des outils utilis\u00E9s par l'application
setup.event.check.end.label=Contr\u00F4le de {0} termin\u00E9
setup.event.check.start.label=Contr\u00F4le de {0} en cours
setup.event.delete.end.label=Suppression de {0} termin\u00E9e
setup.event.delete.start.label=Suppression de {0} en cours
setup.event.download.end.label=T\u00E9l\u00E9chargement de {0} termin\u00E9
setup.event.download.start.label=T\u00E9l\u00E9chargement de {0} en cours
setup.event.install.end.label=Installation de {0} termin\u00E9e
setup.event.install.start.label=Installation de {0} en cours
setup.event.uninstall.end.label=D\u00E9sinstallation de {0} termin\u00E9e
setup.event.uninstall.start.label=D\u00E9sinstallation de {0} en cours
setup.event.update.end.label=Mise \u00E0 jour de {0} termin\u00E9e
setup.event.update.start.label=Mise \u00E0 jour de {0} en cours
setup.install.error.label=Une erreur s''est produite lors de l''installation: {0}
setup.install.error.title=Erreur d'installation
setup.menu.install.label=Installer
@@ -8,9 +20,11 @@ setup.menu.uninstall.label=D\u00E9sinstaller
setup.menu.update.label=Mettre \u00E0 jour
setup.reinstall.error.label=Une erreur s''est produite lors de la r\u00E9installation: {0}
setup.reinstall.error.title=Erreur de r\u00E9installation
setup.status.bundle_installed.label=est install\u00E9.
setup.status.errored.label=a caus\u00E9 une erreur.
setup.status.installed.label=est install\u00E9.
setup.status.not_installed.label=n'est pas install\u00E9.
setup.status.system_installed.label=est install\u00E9 (syst\u00E8me).
setup.status.update_available.label=a une mise \u00E0 jour disponible.
setup.uninstall.error.label=Une erreur s''est produite lors de la d\u00E9sinstallation : {0}
setup.uninstall.error.title=Erreur de d\u00E9sinstallation

View File

@@ -5,10 +5,18 @@ work.button.export.soft.tooltip=Adds the subtitles to the video. This allows a v
work.button.extract.label=Extract subtitles
work.button.file.label=Open video...
work.button.reset.label=Reset subtitles
work.error.export.label=Error during the export : {0}
work.error.export.title=Error exporting
work.export.error.label=Error during the export : {0}
work.export.error.title=Error exporting
work.extract.error.label=Error extracting subtitles : {0}
work.extract.error.title=Error extracting
work.language.label=Video language
work.load.error.label=Error loading video : {0}
work.load.error.title=Error loading
work.status.exporting.label=Exporting...
work.status.extracting.label=Extracting...
work.status.idle.label=Idle
work.status.translating.label=Translating...
work.table.column.from.label=From
work.table.column.text.label=Text
work.table.column.to.label=To
work.translate.label=Automatic translation (for adding)
work.translate.tooltip=A comma-separated list of ISO 639-3 codes
work.translate.label=Automatic translations

View File

@@ -1,3 +1,22 @@
work.button.export.hard.label=Graver la vid\u00E9o...
work.button.export.hard.tooltip=Grave les sous-titres dans la vid\u00E9o. Cela veut dire que les sous-titres sont \u00E9crits directement dans l'image et ne peuvent pas \u00EAtre d\u00E9sactiv\u00E9s.
work.button.export.soft.label=Exporter la vid\u00E9o...
work.button.export.soft.tooltip=Ajoute les sous-titres \u00E0 la vid\u00E9o. Cela permet d'avoir plusieurs pistes de sous-titres dans une m\u00EAme vid\u00E9o et de les activer comme d\u00E9sir\u00E9.
work.button.extract.label=Extraire les sous-titres
work.button.file.label=Ouvrir une vid\u00E9o...
work.button.reset.label=R\u00E9initialiser les sous-titres
work.export.error.label=Erreur durant l''export : {0}
work.export.error.title=Erreur d'export
work.extract.error.label=Erreur durant l''extraction des sous-titres : {0}
work.extract.error.title=Erreur d'extraction
work.language.label=Language de la vid\u00E9o
work.load.error.label=Erreur lors du chargement de la vid\u00E9o : {0}
work.load.error.title=Erreur de chargement
work.status.exporting.label=Exportation en cours...
work.status.extracting.label=Extraction en cours...
work.status.idle.label=Idle
work.status.translating.label=Traduction en cours...
work.table.column.from.label=De
work.table.column.text.label=Texte
work.table.column.to.label=\u00C0
work.table.column.to.label=\u00C0
work.translate.label=Traductions automatiques