Skip to content
Snippets Groups Projects
Commit 41ed7d1e authored by Ondřej Trojan's avatar Ondřej Trojan
Browse files

frontend add attributes, changed display set

parent 5c03488c
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,10 @@ public class DisplayTrackDto {
private String createdCet;
private String trackType;
private String duration;
private String description;
public DisplayTrackDto(String id, String displaySet, String name, String createdByUsername, String createdCet, String trackType, String duration) {
public DisplayTrackDto(String id, String displaySet, String name, String createdByUsername, String createdCet, String trackType, String duration, String description) {
this.id = id;
this.displaySet = displaySet;
this.name = name;
......@@ -19,6 +20,7 @@ public class DisplayTrackDto {
this.createdCet = createdCet;
this.trackType = trackType;
this.duration = duration;
this.description = description;
}
public String getName() {
......@@ -64,4 +66,12 @@ public class DisplayTrackDto {
public void setDuration(String duration) {
this.duration = duration;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
......@@ -104,13 +104,12 @@ public class ClientService {
displayTracks.add(displayTrackFromParsed.getData().getName());
}
currentPlaylistTracks = displayTracks;
System.out.println(tracks.toString());
currentDisplayTrackId = displayTrack.getData().getId();
currentDisplayTrackName = displayTrack.getData().getName();
}
currentTrackLength = controlService.getLength(connectedClient);
//parse
System.out.println(LocalDateTime.now().toString() + " " + currentDisplaySetName + ", " + currentDisplayTrackName + ", " + split[2]);
log.debug(LocalDateTime.now().toString() + " " + currentDisplaySetName + ", " + currentDisplayTrackName + ", " + split[2]);
}
......
......@@ -8,7 +8,7 @@ import com.museum.projection.dao.DisplayTrackToVideoFileDaoService;
import com.museum.projection.dao.ResponseData;
import com.museum.projection.dto.DisplayTrackDto;
import com.museum.projection.dto.VideoFileDto;
import com.museum.projection.model.TrackTypes;
import com.museum.projection.model.DisplaySet;
import com.museum.projection.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -52,20 +52,24 @@ public class DisplayTrackService {
userService.getUserById(String.valueOf(displaytrack.getCreatedBy())).getData().getName(),
StringUtils.toDateTime(displaytrack.getCreatedCet()),
displaytrack.getTrackType(),
displaytrack.getDuration().toString())).collect(Collectors.toList());
displaytrack.getDuration().toString(),
displaytrack.getDescription())).collect(Collectors.toList());
return displaySet;
}
public ResponseData<Boolean> createDisplayTrack(String displaySetId, String currentUserId, String name, String description, List<String> videoFileIds) {
Optional<DisplaySet> displaySet = displaySetDaoService.getDisplaySetById(Integer.parseInt(displaySetId));
if (displaySet.isEmpty()) return new ResponseData<>(false, "cannot find displaySet with id " + displaySetId);
//test if all videosets
HashSet<String> types = new HashSet<>();
float shortest = Float.MAX_VALUE;
for (String videoFileId : videoFileIds) {
ResponseData<VideoFileDto> videoFile = videofileService.getVideoFileById(videoFileId, false);
if (videoFile.getData() == null) {
log.error("cannot find displayTrack with id " + videoFileId);
return new ResponseData<>(false, "cannot find displayTrack with id " + videoFileId);
log.error("cannot find videoFile with id " + videoFileId);
return new ResponseData<>(false, "cannot find videoFile with id " + videoFileId);
}
types.add(videoFile.getData().getVideoFileType().toUpperCase());
float durationOfCurrent = Float.parseFloat(videoFile.getData().getDuration());
......@@ -73,7 +77,7 @@ public class DisplayTrackService {
}
//create videoTrack
Optional<Long> createdDisplayTrackId = displayTrackDaoService.insertDisplayTrack(name, displaySetId, Integer.parseInt(currentUserId), shortest, description, String.join(",",types));
Optional<Long> createdDisplayTrackId = displayTrackDaoService.insertDisplayTrack(name, displaySetId, Integer.parseInt(currentUserId), shortest, description, String.join(",", types));
if (createdDisplayTrackId.isEmpty()) {
return new ResponseData<>(false, "display track could not be created");
}
......@@ -84,6 +88,8 @@ public class DisplayTrackService {
if (createdDisplayTrackToVideoFileId.isEmpty())
return new ResponseData<>(false, "display track to video file could not be created");
}
//set displayset as changed
displaySetDaoService.updateDisplaySet(displaySetId, displaySet.get().getName(), displaySet.get().getPublished(), displaySet.get().getAutonomous(), true);
return new ResponseData<>(true);
}
......@@ -99,12 +105,13 @@ public class DisplayTrackService {
userService.getUserById(String.valueOf(displaytrack.getCreatedBy())).getData().getName(),
StringUtils.toDateTime(displaytrack.getCreatedCet()),
displaytrack.getTrackType(),
displaytrack.getDuration().toString()))).orElseThrow();
displaytrack.getDuration().toString(),
displaytrack.getDescription()))).orElseThrow();
} catch (EmptyResultDataAccessException e) {
return new ResponseData(null, String.format("Display track with id %s not found", displayTrackId), "displayTrack");
}
return ret == null ? new ResponseData<>(null, "unkown error") : ret;
return ret == null ? new ResponseData<>(null, "unknown error") : ret;
}
......@@ -117,7 +124,8 @@ public class DisplayTrackService {
userService.getUserById(String.valueOf(displaytrack.getCreatedBy())).getData().getName(),
StringUtils.toDateTime(displaytrack.getCreatedCet()),
displaytrack.getTrackType(),
displaytrack.getDuration().toString())).collect(Collectors.toList());
displaytrack.getDuration().toString(),
displaytrack.getDescription())).collect(Collectors.toList());
return displaySet;
}
......
......@@ -105,39 +105,6 @@ public class SynchronizationService {
}
session.close();
return new ResponseData<>(true);
// for each displaySet
// create folder u klienta
// for each display track
// create folder u clienta
// for each video track
// copy renamed video to klient
//COPY DATA
// File videoFolder = new File(config.getVideoFolderPath());
// if (!videoFolder.exists() || !videoFolder.isDirectory()) {
// String msg = "Folder " + config.getPlaylistFolderPath() + (clientId + 1) + " does not exist, or is not directory";
// log.error(msg);
// return new ResponseData<Boolean>(false, msg);
// }
// String path = "";
// ArrayDeque<File> folderQueue = new ArrayDeque<>();
// folderQueue.offer(videoFolder);
// while (folderQueue.peek() != null) {
// File folder = folderQueue.poll();
// for (File file : Objects.requireNonNull(folder.listFiles())) {
// if (file.isDirectory()) {
// folderQueue.offer(file);
// createFolder(clientId, session, file.getAbsolutePath().replace("otrojan", "user")); //TODO remove otrojan only for dev
// continue;
// }
// dest = file.getAbsolutePath().replace("otrojan", "user"); //TODO remove otrojan only for dev
// uploadFile(clientId, session, dest, file);
// }
// }
// session.close();
// return new ResponseData<>(true);
}
private void uploadFile(int clientId, SftpSession session, String dest, File file) {
......
......@@ -14,6 +14,7 @@
<th scope="col">Path</th>
<th scope="col">Duration</th>
<th scope="col">Size</th>
<th scope="col">Track type</th>
<th scope="col">Description</th>
<th scope="col">Synchronized</th>
<th scope="col">Created</th>
......@@ -31,6 +32,7 @@
<td><span th:text="${videofile.filepath}"> path </span></td>
<td><span th:text="${videofile.duration}"> duration </span></td>
<td><span th:text="${videofile.fileSize}"> size </span></td>
<td><span th:text="${videofile.videoFileType}"> videoFileType </span></td>
<td><span th:text="${videofile.description}"> description</span></td>
<td><span th:text="${videofile.clientSynchronized}"> synchronized </span></td>
<td><span th:text="${videofile.createdByUsername}"> created by </span></td>
......
......@@ -31,6 +31,8 @@
<th scope="col">Id</th>
<th scope="col">Name</th>
<th scope="col">Published</th>
<th scope="col">Changed</th>
<th scope="col">Description</th>
<th scope="col">Created by</th>
<th scope="col">Created</th>
<th scope="col">Actions</th>
......@@ -45,6 +47,8 @@
<td><span th:text="${videoset.getName()}"> name </span></td>
<td><span th:id="'field-publish-'+${videoset.getId()}"
th:text="${videoset.getPublished()}"> published </span></td>
<td><span th:text="${videoset.isChanged()}"> changed </span></td>
<td><span th:text="${videoset.getDescription()}"> description </span></td>
<td><span th:text="${videoset.getCreatedByUsername()}"> createdby </span></td>
<td><span th:text="${videoset.getCreatedCet()}"> created </span></td>
<td>
......
......@@ -17,6 +17,9 @@
<th scope="col">Id</th>
<th scope="col">Display set</th>
<th scope="col">Name</th>
<th scope="col">Duration</th>
<th scope="col">Track types</th>
<th scope="col">Description</th>
<th scope="col">Created by</th>
<th scope="col">Created</th>
<th scope="col"></th>
......@@ -32,6 +35,9 @@
<td><span th:text="${videotrack.getDisplaySet()}"> display set Id </span></td>
<td><span th:text="${videotrack.getName()}"> name </span></td>
<td><span th:text="${videotrack.getDuration()}"> duration </span></td>
<td><span th:text="${videotrack.getTrackType()}"> trackTypes </span></td>
<td><span th:text="${videotrack.getDescription()}"> description </span></td>
<td><span th:text="${videotrack.getCreatedByUsername()}"> createdby </span></td>
<td><span th:text="${videotrack.getCreatedCet()}"> created </span></td>
<td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment