diff --git a/app/class_file_convert.py b/app/class_file_convert.py index a903fe0..910b3a6 100755 --- a/app/class_file_convert.py +++ b/app/class_file_convert.py @@ -77,16 +77,15 @@ class Convert: logging.error(f"Fehler in video_convert(): {e}") finally: logging.info(f"Prozess {result}({obj.process.returncode}): {obj.source_file_name}") - 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() + obj.convert_end = time.time() obj_stat.save_stat(obj) - obj.convert_end = time.time() + def convert_cmd(self, obj): command_convert = [ diff --git a/app/class_file_convert_read_out.py b/app/class_file_convert_read_out.py index bc6144e..b2a1cd8 100755 --- a/app/class_file_convert_read_out.py +++ b/app/class_file_convert_read_out.py @@ -34,7 +34,10 @@ class Process: self.process_line_extract(obj, line_decoded) #logging.info(line_decoded) - self.loading = (self.frames / obj.source_frames_total) * 100 + if obj.source_frames_total > 0: + self.loading = (self.frames / obj.source_frames_total) * 100 > 0 + else: + self.loading = 0 await self.obj_websocket.send_websocket(self.to_dict(obj)) diff --git a/app/class_file_path.py b/app/class_file_path.py index 8be4a1b..3789b2a 100755 --- a/app/class_file_path.py +++ b/app/class_file_path.py @@ -119,7 +119,7 @@ class Path: "stream=index,channels,codec_name,codec_type,pix_fmt,level," "film_grain,r_frame_rate,bit_rate,sample_rate,width,height,size,tags:stream_tags=language,duration", "-show_entries", - "format=size,bit_rate,nb_streams", + "format=size,bit_rate,nb_streams,duration", "-of", "json", path ] diff --git a/app/class_media_file.py b/app/class_media_file.py index db9738a..132a9f2 100755 --- a/app/class_media_file.py +++ b/app/class_media_file.py @@ -13,7 +13,7 @@ class Media: self.source_file: str = path self.source_path: str = os.path.dirname(path) self.source_file_name: str = os.path.basename(self.source_file) - self.source_duration: int = self.time_in_sec(streams_video[0]["tags"].get("DURATION" or "duration", "00:00:00")) + self.source_duration: int = self.time_in_sec(streams_format[0].get("duration", "00:00:00")) self.source_size: list = self.size_convert("B", None, "storage", int(streams_format[0].get("size"))) self.source_frame_rate: int = self.frame_rate(streams_video) self.source_frames_total: int = self.source_frame_rate * self.source_duration diff --git a/app/class_media_file_stat.py b/app/class_media_file_stat.py index 9e6440b..6b74215 100755 --- a/app/class_media_file_stat.py +++ b/app/class_media_file_stat.py @@ -26,6 +26,7 @@ class Stat: """ daten = self.read_stat() + daten.setdefault("videos", {}) try: # Neuen Eintrag hinzufügen @@ -36,7 +37,7 @@ class Stat: except Exception as e: logging.error(f"Save Stat Failure: {e}") - def read_stat(self) -> Dict[str, any]: + def read_stat(self) -> dict[str, any]: """ Read statistic from YAML file :return: Dictionary width statistics