Extraction works
This commit is contained in:
@@ -71,7 +71,7 @@ public class FFmpegVideoConverter extends AbstractProcessRunner implements Video
|
||||
args.add("-map");
|
||||
args.add(String.valueOf(n));
|
||||
args.add("-metadata:s:s:" + n);
|
||||
args.add("language=" + c.locale().getISO3Language());
|
||||
args.add("language=" + c.language().iso3());
|
||||
});
|
||||
args.add(out.toString());
|
||||
run(args);
|
||||
@@ -114,7 +114,7 @@ public class FFmpegVideoConverter extends AbstractProcessRunner implements Video
|
||||
);
|
||||
run(args);
|
||||
Files.deleteIfExists(dumpVideoPath);
|
||||
return new FileAudioImpl(audioPath, new AudioInfoImpl("wav"));
|
||||
return new FileAudioImpl(audioPath, new AudioInfoImpl("wav", video.info().duration()));
|
||||
}
|
||||
|
||||
private static Path getPath(final Video video) throws IOException {
|
||||
|
||||
@@ -7,17 +7,12 @@ import com.github.gtache.autosubtitle.ffmpeg.FFprobeVideoLoader;
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Module
|
||||
public interface FFmpegModule {
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
VideoConverter bindsVideoConverter(final FFmpegVideoConverter converter);
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
VideoLoader bindsVideoLoader(final FFprobeVideoLoader loader);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.setup.modules.ffmpeg;
|
||||
package com.github.gtache.autosubtitle.modules.setup.ffmpeg;
|
||||
|
||||
import com.github.gtache.autosubtitle.modules.ffmpeg.FFBundledRoot;
|
||||
import com.github.gtache.autosubtitle.modules.ffmpeg.FFmpegBundledPath;
|
||||
@@ -7,9 +7,9 @@ import com.github.gtache.autosubtitle.modules.ffmpeg.FFmpegVersion;
|
||||
import com.github.gtache.autosubtitle.modules.ffmpeg.FFprobeBundledPath;
|
||||
import com.github.gtache.autosubtitle.modules.ffmpeg.FFprobeSystemPath;
|
||||
import com.github.gtache.autosubtitle.modules.impl.ExecutableExtension;
|
||||
import com.github.gtache.autosubtitle.modules.setup.impl.VideoConverterSetup;
|
||||
import com.github.gtache.autosubtitle.setup.SetupManager;
|
||||
import com.github.gtache.autosubtitle.setup.ffmpeg.FFmpegSetupManager;
|
||||
import com.github.gtache.autosubtitle.setup.modules.impl.VideoConverterSetup;
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
@@ -5,10 +5,9 @@ import com.github.gtache.autosubtitle.impl.OS;
|
||||
import com.github.gtache.autosubtitle.modules.ffmpeg.FFmpegBundledPath;
|
||||
import com.github.gtache.autosubtitle.modules.ffmpeg.FFmpegSystemPath;
|
||||
import com.github.gtache.autosubtitle.modules.ffmpeg.FFmpegVersion;
|
||||
import com.github.gtache.autosubtitle.process.impl.AbstractProcessRunner;
|
||||
import com.github.gtache.autosubtitle.setup.SetupException;
|
||||
import com.github.gtache.autosubtitle.setup.SetupManager;
|
||||
import com.github.gtache.autosubtitle.setup.SetupStatus;
|
||||
import com.github.gtache.autosubtitle.setup.impl.AbstractSetupManager;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -21,7 +20,7 @@ import java.util.Objects;
|
||||
/**
|
||||
* Manager managing the FFmpeg installation
|
||||
*/
|
||||
public class FFmpegSetupManager extends AbstractProcessRunner implements SetupManager {
|
||||
public class FFmpegSetupManager extends AbstractSetupManager {
|
||||
private static final Logger logger = LogManager.getLogger(FFmpegSetupManager.class);
|
||||
private final Path bundledPath;
|
||||
private final Path systemPath;
|
||||
@@ -46,16 +45,17 @@ public class FFmpegSetupManager extends AbstractProcessRunner implements SetupMa
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetupStatus status() {
|
||||
public SetupStatus getStatus() throws SetupException {
|
||||
try {
|
||||
if (checkSystemFFmpeg() || checkBundledFFmpeg()) {
|
||||
return SetupStatus.INSTALLED;
|
||||
if (checkSystemFFmpeg()) {
|
||||
return SetupStatus.SYSTEM_INSTALLED;
|
||||
} else if (checkBundledFFmpeg()) {
|
||||
return SetupStatus.BUNDLE_INSTALLED;
|
||||
} else {
|
||||
return SetupStatus.NOT_INSTALLED;
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error("Error checking status of {}", name(), e);
|
||||
return SetupStatus.ERRORED;
|
||||
throw new SetupException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class FFmpegSetupManager extends AbstractProcessRunner implements SetupMa
|
||||
}
|
||||
|
||||
private boolean checkSystemFFmpeg() throws IOException {
|
||||
final var result = run(systemPath.toString(), "-h");
|
||||
final var result = run(systemPath.toString(), "-version");
|
||||
return result.exitCode() == 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ module com.github.gtache.autosubtitle.ffmpeg {
|
||||
requires org.apache.logging.log4j;
|
||||
|
||||
exports com.github.gtache.autosubtitle.ffmpeg;
|
||||
exports com.github.gtache.autosubtitle.modules.ffmpeg;
|
||||
exports com.github.gtache.autosubtitle.setup.ffmpeg;
|
||||
exports com.github.gtache.autosubtitle.setup.modules.ffmpeg;
|
||||
|
||||
exports com.github.gtache.autosubtitle.modules.ffmpeg;
|
||||
exports com.github.gtache.autosubtitle.modules.setup.ffmpeg;
|
||||
}
|
||||
Reference in New Issue
Block a user