chore(prod): sync with main #4
@@ -23,6 +23,9 @@ public class DirectoryService {
|
|||||||
@Value("${storage.outputs}")
|
@Value("${storage.outputs}")
|
||||||
private String outputDir;
|
private String outputDir;
|
||||||
|
|
||||||
|
@Value("${STREAM_DATA}")
|
||||||
|
private String streamDir;
|
||||||
|
|
||||||
@Value("${storage.temp.inputs}")
|
@Value("${storage.temp.inputs}")
|
||||||
private String tempInputsDir;
|
private String tempInputsDir;
|
||||||
|
|
||||||
@@ -77,6 +80,12 @@ public class DirectoryService {
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File getStreamDir(String streamKey) throws IOException {
|
||||||
|
File file = new File(streamDir + File.separator + streamKey);
|
||||||
|
createDirectory(file.getAbsolutePath());
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
public File getUserThumbnailsFile(Long userId, String filename) throws IOException {
|
public File getUserThumbnailsFile(Long userId, String filename) throws IOException {
|
||||||
if (filename == null || filename.isEmpty()) {
|
if (filename == null || filename.isEmpty()) {
|
||||||
throw new IllegalArgumentException("File name cannot be null or empty");
|
throw new IllegalArgumentException("File name cannot be null or empty");
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.ddf.vodsystem.repositories.StreamRepository;
|
|||||||
import com.ddf.vodsystem.services.media.StreamActionsService;
|
import com.ddf.vodsystem.services.media.StreamActionsService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -35,9 +34,6 @@ public class StreamService {
|
|||||||
private final StreamActionsService streamActionsService;
|
private final StreamActionsService streamActionsService;
|
||||||
private final DirectoryService directoryService;
|
private final DirectoryService directoryService;
|
||||||
|
|
||||||
@Value("${storage.stream}")
|
|
||||||
private String streamDataPath;
|
|
||||||
|
|
||||||
public StreamService(StreamRepository streamRepository,
|
public StreamService(StreamRepository streamRepository,
|
||||||
UserService userService,
|
UserService userService,
|
||||||
StreamActionsService streamActionsService,
|
StreamActionsService streamActionsService,
|
||||||
@@ -135,8 +131,8 @@ public class StreamService {
|
|||||||
User user = userService.getLoggedInUser()
|
User user = userService.getLoggedInUser()
|
||||||
.orElseThrow(() -> new NotAuthenticated("User is not authenticated"));
|
.orElseThrow(() -> new NotAuthenticated("User is not authenticated"));
|
||||||
|
|
||||||
String streamDirectory = streamDataPath + File.separator + user.getStreamKey();
|
File streamDirectory = directoryService.getStreamDir(user.getStreamKey());
|
||||||
List<File> fileSegments = getSegmentsInRange(streamDirectory, startTime, endTime);
|
List<File> fileSegments = getSegmentsInRange(streamDirectory.getAbsolutePath(), startTime, endTime);
|
||||||
|
|
||||||
if (fileSegments.isEmpty()) {
|
if (fileSegments.isEmpty()) {
|
||||||
throw new IllegalArgumentException("No stream segments found in the given time range");
|
throw new IllegalArgumentException("No stream segments found in the given time range");
|
||||||
|
|||||||
Reference in New Issue
Block a user