Queue Java Script angefangen
This commit is contained in:
parent
ba84fae116
commit
a8968a2ebd
11 changed files with 50 additions and 17 deletions
2
app/class_file_convert.py
Normal file → Executable file
2
app/class_file_convert.py
Normal file → Executable file
|
|
@ -48,6 +48,7 @@ class Convert:
|
||||||
|
|
||||||
logging.info(f"Starte Konvertierung: {command}")
|
logging.info(f"Starte Konvertierung: {command}")
|
||||||
await self.obj_websocket.send_websocket(self.obj_path.active_path_to_dict())
|
await self.obj_websocket.send_websocket(self.obj_path.active_path_to_dict())
|
||||||
|
await self.obj_websocket.send_websocket(self.obj_path.queue_path_to_dict())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Starte den Subprozess asynchron
|
# Starte den Subprozess asynchron
|
||||||
|
|
@ -79,6 +80,7 @@ class Convert:
|
||||||
await self.obj_websocket.send_websocket(obj.to_dict())
|
await self.obj_websocket.send_websocket(obj.to_dict())
|
||||||
|
|
||||||
await self.obj_websocket.send_websocket(self.obj_path.active_path_to_dict())
|
await self.obj_websocket.send_websocket(self.obj_path.active_path_to_dict())
|
||||||
|
await self.obj_websocket.send_websocket(self.obj_path.queue_path_to_dict())
|
||||||
self.active_process.discard(obj)
|
self.active_process.discard(obj)
|
||||||
self.active_tasks.discard(obj)
|
self.active_tasks.discard(obj)
|
||||||
self.obj_path.save_paths()
|
self.obj_path.save_paths()
|
||||||
|
|
|
||||||
0
app/class_file_convert_read_out.py
Normal file → Executable file
0
app/class_file_convert_read_out.py
Normal file → Executable file
9
app/class_file_path.py
Normal file → Executable file
9
app/class_file_path.py
Normal file → Executable file
|
|
@ -185,4 +185,13 @@ class Path:
|
||||||
|
|
||||||
return {"data_convert": list_active_paths}
|
return {"data_convert": list_active_paths}
|
||||||
|
|
||||||
|
def queue_path_to_dict(self):
|
||||||
|
list_active_paths = {}
|
||||||
|
|
||||||
|
for obj in self.paths.values():
|
||||||
|
if obj.status is None:
|
||||||
|
list_active_paths.update({obj.id: obj.to_dict_active_paths()})
|
||||||
|
|
||||||
|
return {"data_queue": list_active_paths}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
0
app/class_media_file.py
Normal file → Executable file
0
app/class_media_file.py
Normal file → Executable file
0
app/class_media_file_stat.py
Normal file → Executable file
0
app/class_media_file_stat.py
Normal file → Executable file
0
app/class_settings.py
Normal file → Executable file
0
app/class_settings.py
Normal file → Executable file
18
app/main_server.py
Normal file → Executable file
18
app/main_server.py
Normal file → Executable file
|
|
@ -43,6 +43,7 @@ class Server:
|
||||||
if websocket not in self.clients:
|
if websocket not in self.clients:
|
||||||
self.clients.add(websocket)
|
self.clients.add(websocket)
|
||||||
await self.send_websocket(self.obj_path.active_path_to_dict())
|
await self.send_websocket(self.obj_path.active_path_to_dict())
|
||||||
|
await self.send_websocket(self.obj_path.queue_path_to_dict())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async for message in websocket:
|
async for message in websocket:
|
||||||
|
|
@ -84,31 +85,24 @@ class Server:
|
||||||
|
|
||||||
# WebServer --------------------------------------------------------------------------------------------------------
|
# WebServer --------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def handle_index(request):
|
async def handle_index(request):
|
||||||
query = request.rel_url.query
|
|
||||||
if "debug" in query:
|
|
||||||
logging.info("Debug-Modus aktiv beim Seitenaufruf")
|
|
||||||
|
|
||||||
return web.FileResponse("./client/index.html")
|
return web.FileResponse("./client/index.html")
|
||||||
|
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
async def handle_ip(self, request):
|
async def handle_ip(self, request):
|
||||||
query = request.rel_url.query
|
|
||||||
if "debug" in query:
|
|
||||||
logging.info("Debug-Modus aktiv beim Seitenaufruf")
|
|
||||||
|
|
||||||
url = self.yaml["extern_websocket_url"]
|
url = self.yaml["extern_websocket_url"]
|
||||||
port = self.yaml["websocket_port"]
|
port = self.yaml["websocket_port"]
|
||||||
websocket_https = self.yaml["websocket_https"]
|
websocket_https = self.yaml["websocket_https"]
|
||||||
|
|
||||||
return web.json_response({"extern_websocket_url": url, "websocket_port": port, "websocket_https": websocket_https})
|
return web.json_response({"extern_websocket_url": url, "websocket_port": port, "websocket_https": websocket_https})
|
||||||
|
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def handle_stat(request):
|
async def handle_stat(request):
|
||||||
query = request.rel_url.query
|
|
||||||
if "debug" in query:
|
|
||||||
logging.info("Debug-Modus aktiv beim Seitenaufruf")
|
|
||||||
|
|
||||||
obj_stat = Stat()
|
obj_stat = Stat()
|
||||||
|
|
||||||
return web.json_response(obj_stat.read_stat())
|
return web.json_response(obj_stat.read_stat())
|
||||||
|
|
||||||
async def server_http(self):
|
async def server_http(self):
|
||||||
|
|
|
||||||
BIN
client/icons/close-144.png
Normal file
BIN
client/icons/close-144.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
client/icons/muell-128.png
Executable file
BIN
client/icons/muell-128.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
client/icons/stat-100.png
Normal file
BIN
client/icons/stat-100.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
|
|
@ -17,20 +17,19 @@ async function getMediaStat() {
|
||||||
getServerConfig()
|
getServerConfig()
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const externWebsocketUrl = data.extern_websocket_url;
|
const externWebsocketUrl = data.extern_websocket_url;
|
||||||
const websocketPort = data.websocket_port;
|
|
||||||
const websocketHttps = data.websocket_https
|
const websocketHttps = data.websocket_https
|
||||||
|
|
||||||
if (websocketHttps === 1){
|
if (websocketHttps === 1){
|
||||||
connect = "wss"
|
connect = `wss://${externWebsocketUrl}`
|
||||||
} else {
|
} else {
|
||||||
connect = "ws"
|
connect = `ws://${externWebsocketUrl}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ws = new WebSocket(`${connect}://${externWebsocketUrl}:${websocketPort}`);
|
const ws = new WebSocket(connect);
|
||||||
|
|
||||||
ws.onopen = function() {
|
ws.onopen = function() {
|
||||||
console.log("WebSocket ist geöffnet");
|
console.log("WebSocket ist geöffnet");
|
||||||
ws.send(JSON.stringify({"data_message": "Server Adresse: " + externWebsocketUrl + ":" + websocketPort}));
|
ws.send(JSON.stringify({"data_message": "Server Adresse: " + externWebsocketUrl}));
|
||||||
};
|
};
|
||||||
|
|
||||||
ws.onmessage = function(messageEvent) {
|
ws.onmessage = function(messageEvent) {
|
||||||
|
|
@ -42,6 +41,8 @@ getServerConfig()
|
||||||
updateVideoElement(packet);
|
updateVideoElement(packet);
|
||||||
} else if(packet.data_convert !== undefined){
|
} else if(packet.data_convert !== undefined){
|
||||||
createVideoElement(packet);
|
createVideoElement(packet);
|
||||||
|
} else if(packet.data_queue !== undefined){
|
||||||
|
createWaitingSnake(packet);
|
||||||
}
|
}
|
||||||
} catch (e){
|
} catch (e){
|
||||||
console.error("Error parsing data flow");
|
console.error("Error parsing data flow");
|
||||||
|
|
@ -99,6 +100,33 @@ function createVideoElement(packet){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createWaitingSnake(packet){
|
||||||
|
const queue = document.getElementById('queue');
|
||||||
|
|
||||||
|
Object.keys(packet.data_convert).forEach(key => {
|
||||||
|
const video = packet.data_convert[key];
|
||||||
|
|
||||||
|
if(!videoActive[key]){
|
||||||
|
const card = document.createElement('div');
|
||||||
|
card.className = 'video-card';
|
||||||
|
card.id = key
|
||||||
|
|
||||||
|
card.innerHTML = `
|
||||||
|
<h3 title="${video.source_path}" align="center">${video.source_file_name}</h3>
|
||||||
|
<div>
|
||||||
|
<div class="delete-button"><img src="/client/icons/muell-128.png" class="conversion_icons"></div>
|
||||||
|
</div>
|
||||||
|
<div class="tooltip">
|
||||||
|
Quelle: ${video.key}<br>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
|
||||||
|
queue.appendChild(card)
|
||||||
|
videoActive[key] = video;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function updateVideoElement(packet){
|
function updateVideoElement(packet){
|
||||||
let video = packet.data_flow;
|
let video = packet.data_flow;
|
||||||
let container = document.getElementById(video.id);
|
let container = document.getElementById(video.id);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue