ADD logging to MetadataService
This commit is contained in:
@@ -4,6 +4,8 @@ import com.ddf.vodsystem.entities.VideoMetadata;
|
|||||||
import com.ddf.vodsystem.exceptions.FFMPEGException;
|
import com.ddf.vodsystem.exceptions.FFMPEGException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.vaadin.flow.server.auth.AnonymousAllowed;
|
||||||
|
import com.vaadin.hilla.Endpoint;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -14,10 +16,14 @@ import java.io.IOException;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Endpoint
|
||||||
|
@AnonymousAllowed
|
||||||
public class MetadataService {
|
public class MetadataService {
|
||||||
private static Logger logger = LoggerFactory.getLogger(MetadataService.class);
|
private static Logger logger = LoggerFactory.getLogger(MetadataService.class);
|
||||||
|
|
||||||
public VideoMetadata getVideoMetadata(File file) {
|
public VideoMetadata getVideoMetadata(File file) {
|
||||||
|
logger.info("Getting metadata for file {}", file.getAbsolutePath());
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder("ffprobe",
|
ProcessBuilder pb = new ProcessBuilder("ffprobe",
|
||||||
"-v", "quiet",
|
"-v", "quiet",
|
||||||
"-print_format", "json",
|
"-print_format", "json",
|
||||||
@@ -30,6 +36,7 @@ public class MetadataService {
|
|||||||
try {
|
try {
|
||||||
process = pb.start();
|
process = pb.start();
|
||||||
handleFfprobeError(process);
|
handleFfprobeError(process);
|
||||||
|
logger.info("Metadata for file {} finished with exit code {}", file.getAbsolutePath(), process.exitValue());
|
||||||
return parseVideoMetadata(readStandardOutput(process));
|
return parseVideoMetadata(readStandardOutput(process));
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
|
|||||||
Reference in New Issue
Block a user