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

fix query all bug, bugfix

parent 1b08a053
No related branches found
No related tags found
No related merge requests found
Showing with 50 additions and 17 deletions
......@@ -8,12 +8,17 @@ import java.util.List;
public class DummyClient implements RemoteClient {
private static final Logger log = LoggerFactory.getLogger(DummyClient.class);
private final String id;
private final int id;
public DummyClient(String id) {
public DummyClient(int id) {
this.id = id;
}
@Override
public int getId() {
return id;
}
@Override
public List<String> sendCmd(String msg, int expectedLines) {
log.warn("Attempt to send command to " + id + " with VlcIntegration disabled");
......
......@@ -4,6 +4,8 @@ import java.util.List;
public interface RemoteClient {
public int getId();
public List<String> sendCmd(String msg, int expectedLines);
public List<String> sendForPlaylist();
......
......@@ -208,6 +208,11 @@ public class VlcClient implements RemoteClient {
return List.of();
}
@Override
public int getId() {
return id;
}
public List<String> sendCmd(String msg, int expectedLines) {
if (!isConnectionReady()) {
log.warn("Attempt to send to non established connection");
......
......@@ -39,7 +39,7 @@ public class VlcConfig {
public List<RemoteClient> ClientsDummy() {
List<RemoteClient> clients = new ArrayList<>();
for (int i = 0; i < propertiesConfig.getClientCount(); i++) {
clients.add(new DummyClient("client" + i));
clients.add(new DummyClient(i));
}
return clients;
}
......
......@@ -57,8 +57,9 @@ public class ClientService {
@Scheduled(fixedRate = 200)
private void maintainCheck() throws InterruptedException {
if (config.getQueryAll()) {
for (int i = 0; i < config.getClientCount(); i++) {
querySingleClient(i);
for (var client : controlService.getConnectedClients()) {
querySingleClient(client.getId());
}
} else {
if (connectedClient == Integer.MAX_VALUE || !controlService.isConnected(connectedClient)) {
......
......@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class ControlService {
......@@ -90,6 +91,10 @@ public class ControlService {
return true;
}
public List<RemoteClient> getConnectedClients(){
return clients.stream().filter(RemoteClient::isConnected).collect(Collectors.toList());
}
public boolean isConnected(int clientId) {
return getRemoteClient(clientId).isConnected();
}
......
......@@ -30,7 +30,7 @@ app:
videoFolderPath: /home/otrojan/vid/
playlistFolderPath: /home/otrojan/playlists/
vlcVersionCheck: false
queryAll: true #all/first
queryAll: true
scheduling:
enabled: true
clientCount: 2
......@@ -93,18 +93,26 @@ app:
5d:
videoFolderPath: /data/vid/
playlistFolderPath: /data/playlists/
vlcVersionCheck: false
queryAll: true
scheduling:
enabled: true
clientCount: 2
clientIps:
- 172.19.0.1
- 172.19.0.1
- 192.168.0.113
- 192.168.0.112
clientVlcPorts:
- 5041
- 5051
- 5091
- 5081
clientSshPorts:
- 2222
- 2224
- 22
- 22
clientUsername:
- user
- user
clientPasswords:
- prahaKrasna.12
- prahaKrasna.12
################5D-projection-security###################
security:
......
......@@ -3,6 +3,7 @@ import {serverUrl, getCookie, sendHttpRequest} from './common.js';
let displaySetDetailContent = document.querySelector("div#videoSetDetail")
let videoSetPublishButtons = document.querySelectorAll(".videoset-publish")
let videoSetDetailButtons = document.querySelectorAll(".video-set-detail")
let formElement = document.querySelector(".sync-form")
videoSetPublishButtons.forEach(button => button.addEventListener('click', function () {
let publishedField = document.querySelector("span#field-publish-" + this.value.toString());
publishedField.innerText = "";
......@@ -22,6 +23,9 @@ videoSetDetailButtons.forEach(button => button.addEventListener('click', functio
}).catch(err => {
})
}));
formElement.addEventListener("submit", function () {
document.querySelector("div#spinnerPosition").classList.add("spinner-border");
});
function clearDetailContainer() {
displaySetDetailContent = document.querySelector("div#videoSetDetail")
......
......@@ -65,8 +65,8 @@
<a scope="row"> No videotracks to be displayed</a>
</div>
<div class="form-group row" th:each="displaySet, iter : ${displaySets}">
<label for="inputFilename" class="col-sm-2 col-form-label" th:text="${displaySet.getName()}"></label>
<div class="col-sm-10">
<label for="inputFilename" class="col-sm-3 col-form-label" th:text="${displaySet.getName()}"></label>
<div class="col-sm-1">
<select class="custom-select" th:field="*{autonomousSets[__${displaySet.id}__].order}">
<option value="0" selected>-</option>
<option th:value="${order}" th:text="${order}" th:each="order:${#numbers.sequence(1,iter.size)}">
......@@ -110,7 +110,7 @@
</thead>
<tbody>
<tr th:if="${displayTracksForDisplaySet.isEmpty()}">
<td scope="row"> No users to be displayed</td>
<td scope="row"> No displaySets to be displayed</td>
</tr>
<tr th:each="displayTrack : ${displayTracksForDisplaySet}">
<td scope="row"><span th:text="${displayTrack.getId()}"> Id </span></td>
......
......@@ -11,7 +11,7 @@
<div layout:fragment="content_videoedit">
<h1>Video set</h1>
<p>Video set is a set of video tracks</p>
<form class="card" th:classappend="${somethingIsPublished} ? bg-secondary : ''" th:method="post"
<form class="card sync-form" th:classappend="${somethingIsPublished} ? bg-secondary : ''" th:method="post"
th:action="@{/control/videoedit/videoset/synchronize}">
<div class="card-body">
<h3 th:if="${somethingIsPublished}">You have a set to synchronize!</h3>
......@@ -29,6 +29,9 @@
</button>
</div>
</div>
<div class="text-center">
<div id="spinnerPosition" class="" role="status"></div>
</div>
</div>
</form>
......@@ -50,7 +53,7 @@
</thead>
<tbody>
<tr th:if="${videosets.isEmpty()}">
<td scope="row"> No users to be displayed</td>
<td scope="row"> No displaySet to be displayed</td>
</tr>
<tr th:each="videoset : ${videosets}">
<td scope="row"><span th:text="${videoset.getId()}"> Id </span></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