diff --git a/app/class_file_convert.py b/app/class_file_convert.py old mode 100644 new mode 100755 index 374f2c2..a903fe0 --- a/app/class_file_convert.py +++ b/app/class_file_convert.py @@ -48,6 +48,7 @@ class Convert: 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.queue_path_to_dict()) try: # 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(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_tasks.discard(obj) self.obj_path.save_paths() diff --git a/app/class_file_convert_read_out.py b/app/class_file_convert_read_out.py old mode 100644 new mode 100755 diff --git a/app/class_file_path.py b/app/class_file_path.py old mode 100644 new mode 100755 index 12161c0..8be4a1b --- a/app/class_file_path.py +++ b/app/class_file_path.py @@ -185,4 +185,13 @@ class Path: 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} + diff --git a/app/class_media_file.py b/app/class_media_file.py old mode 100644 new mode 100755 diff --git a/app/class_media_file_stat.py b/app/class_media_file_stat.py old mode 100644 new mode 100755 diff --git a/app/class_settings.py b/app/class_settings.py old mode 100644 new mode 100755 diff --git a/app/main_server.py b/app/main_server.py old mode 100644 new mode 100755 index bf4cc42..2c3c835 --- a/app/main_server.py +++ b/app/main_server.py @@ -43,6 +43,7 @@ class Server: if websocket not in self.clients: self.clients.add(websocket) await self.send_websocket(self.obj_path.active_path_to_dict()) + await self.send_websocket(self.obj_path.queue_path_to_dict()) try: async for message in websocket: @@ -84,31 +85,24 @@ class Server: # WebServer -------------------------------------------------------------------------------------------------------- + # noinspection PyUnusedLocal @staticmethod 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") + # noinspection PyUnusedLocal 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"] port = self.yaml["websocket_port"] websocket_https = self.yaml["websocket_https"] + return web.json_response({"extern_websocket_url": url, "websocket_port": port, "websocket_https": websocket_https}) + # noinspection PyUnusedLocal @staticmethod async def handle_stat(request): - query = request.rel_url.query - if "debug" in query: - logging.info("Debug-Modus aktiv beim Seitenaufruf") - obj_stat = Stat() + return web.json_response(obj_stat.read_stat()) async def server_http(self): diff --git a/client/icons/close-144.png b/client/icons/close-144.png new file mode 100644 index 0000000..296635b Binary files /dev/null and b/client/icons/close-144.png differ diff --git a/client/icons/muell-128.png b/client/icons/muell-128.png new file mode 100755 index 0000000..e254b39 Binary files /dev/null and b/client/icons/muell-128.png differ diff --git a/client/icons/stat-100.png b/client/icons/stat-100.png new file mode 100644 index 0000000..5851d7e Binary files /dev/null and b/client/icons/stat-100.png differ diff --git a/client/media_conversion.js b/client/media_conversion.js index ed22a64..e1c4ac8 100755 --- a/client/media_conversion.js +++ b/client/media_conversion.js @@ -17,20 +17,19 @@ async function getMediaStat() { getServerConfig() .then(data => { const externWebsocketUrl = data.extern_websocket_url; - const websocketPort = data.websocket_port; const websocketHttps = data.websocket_https if (websocketHttps === 1){ - connect = "wss" + connect = `wss://${externWebsocketUrl}` } else { - connect = "ws" + connect = `ws://${externWebsocketUrl}` } - const ws = new WebSocket(`${connect}://${externWebsocketUrl}:${websocketPort}`); + const ws = new WebSocket(connect); ws.onopen = function() { 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) { @@ -42,6 +41,8 @@ getServerConfig() updateVideoElement(packet); } else if(packet.data_convert !== undefined){ createVideoElement(packet); + } else if(packet.data_queue !== undefined){ + createWaitingSnake(packet); } } catch (e){ 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 = ` +