Adds tests for common whisper
This commit is contained in:
@@ -9,7 +9,7 @@ import java.io.InputStream;
|
||||
public interface Audio {
|
||||
|
||||
/**
|
||||
* @return The audio input stream
|
||||
* @return The input stream
|
||||
* @throws IOException If an I/O error occurs
|
||||
*/
|
||||
InputStream getInputStream() throws IOException;
|
||||
|
||||
@@ -4,13 +4,14 @@ package com.github.gtache.autosubtitle;
|
||||
* Represents info about an audio
|
||||
*/
|
||||
public interface AudioInfo {
|
||||
/**
|
||||
* @return The audio extension (mp3, etc.)
|
||||
*/
|
||||
String audioFormat();
|
||||
|
||||
/**
|
||||
* @return The audio duration in milliseconds
|
||||
* @return The extension (mp3, etc.)
|
||||
*/
|
||||
String format();
|
||||
|
||||
/**
|
||||
* @return The duration in milliseconds
|
||||
*/
|
||||
long duration();
|
||||
}
|
||||
|
||||
@@ -7,9 +7,8 @@ import java.io.InputStream;
|
||||
* Represents a video
|
||||
*/
|
||||
public interface Video {
|
||||
|
||||
/**
|
||||
* @return The video input stream
|
||||
* @return The input stream
|
||||
* @throws IOException If an I/O error occurs
|
||||
*/
|
||||
InputStream getInputStream() throws IOException;
|
||||
@@ -18,5 +17,4 @@ public interface Video {
|
||||
* @return The video info
|
||||
*/
|
||||
VideoInfo info();
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,7 @@ package com.github.gtache.autosubtitle;
|
||||
/**
|
||||
* Info about a video
|
||||
*/
|
||||
public interface VideoInfo {
|
||||
/**
|
||||
* @return The video extension (mp4, etc.)
|
||||
*/
|
||||
String videoFormat();
|
||||
public interface VideoInfo extends AudioInfo {
|
||||
|
||||
/**
|
||||
* @return The video width in pixels
|
||||
@@ -19,11 +15,6 @@ public interface VideoInfo {
|
||||
*/
|
||||
int height();
|
||||
|
||||
/**
|
||||
* @return The video duration in milliseconds
|
||||
*/
|
||||
long duration();
|
||||
|
||||
/**
|
||||
* @return The aspect ratio of the video
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface SubtitleExtractor<T extends Subtitle> {
|
||||
* Extracts the subtitles from a video
|
||||
*
|
||||
* @param video The video
|
||||
* @param language The language of the video
|
||||
* @param language The language of the audio
|
||||
* @param model The model to use
|
||||
* @return The extracted subtitle collection
|
||||
* @throws ExtractException If an error occurs
|
||||
|
||||
@@ -21,10 +21,10 @@ import static org.mockito.Mockito.when;
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class TestSubtitleConverter {
|
||||
|
||||
private final SubtitleConverter subtitleConverter;
|
||||
private final SubtitleConverter<Subtitle> subtitleConverter;
|
||||
private final SubtitleCollection<Subtitle> subtitleCollection;
|
||||
|
||||
TestSubtitleConverter(@Mock final SubtitleConverter subtitleConverter,
|
||||
TestSubtitleConverter(@Mock final SubtitleConverter<Subtitle> subtitleConverter,
|
||||
@Mock final SubtitleCollection<Subtitle> subtitleCollection) {
|
||||
this.subtitleConverter = Objects.requireNonNull(subtitleConverter);
|
||||
this.subtitleCollection = Objects.requireNonNull(subtitleCollection);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.github.gtache.autosubtitle.subtitle.extractor;
|
||||
import com.github.gtache.autosubtitle.Audio;
|
||||
import com.github.gtache.autosubtitle.Language;
|
||||
import com.github.gtache.autosubtitle.Video;
|
||||
import com.github.gtache.autosubtitle.subtitle.Subtitle;
|
||||
import com.github.gtache.autosubtitle.subtitle.SubtitleCollection;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@@ -18,14 +19,14 @@ import static org.mockito.Mockito.when;
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class TestSubtitleExtractor {
|
||||
|
||||
private final SubtitleExtractor subtitleExtractor;
|
||||
private final SubtitleCollection subtitleCollection;
|
||||
private final SubtitleExtractor<Subtitle> subtitleExtractor;
|
||||
private final SubtitleCollection<Subtitle> subtitleCollection;
|
||||
private final Audio audio;
|
||||
private final Video video;
|
||||
private final ExtractionModel extractionModel;
|
||||
|
||||
TestSubtitleExtractor(@Mock final SubtitleExtractor subtitleExtractor,
|
||||
@Mock final SubtitleCollection subtitleCollection,
|
||||
TestSubtitleExtractor(@Mock final SubtitleExtractor<Subtitle> subtitleExtractor,
|
||||
@Mock final SubtitleCollection<Subtitle> subtitleCollection,
|
||||
@Mock final Audio audio,
|
||||
@Mock final Video video,
|
||||
@Mock final ExtractionModel extractionModel) {
|
||||
|
||||
Reference in New Issue
Block a user