refactor(command): inject CommandRunner instead of static
This commit is contained in:
@@ -19,9 +19,14 @@ import java.util.concurrent.Future;
|
||||
@Service
|
||||
public class MetadataService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MetadataService.class);
|
||||
public final CommandRunner commandRunner;
|
||||
|
||||
private static final String DURATION = "duration";
|
||||
|
||||
public MetadataService(CommandRunner commandRunner) {
|
||||
this.commandRunner = commandRunner;
|
||||
}
|
||||
|
||||
@Async("ffmpegTaskExecutor")
|
||||
public Future<ClipOptions> getVideoMetadata(Path file) {
|
||||
logger.info("Getting metadata for file {}", file);
|
||||
@@ -39,7 +44,7 @@ public class MetadataService {
|
||||
StringBuilder outputBuilder = new StringBuilder();
|
||||
|
||||
try {
|
||||
CommandOutput output = CommandRunner.run(command);
|
||||
CommandOutput output = commandRunner.run(command);
|
||||
|
||||
for (String line : output.getOutput()) {
|
||||
outputBuilder.append(line);
|
||||
|
||||
Reference in New Issue
Block a user