Stat Fehler Id angepasst
This commit is contained in:
parent
4fc5249c0b
commit
3f2bf175c7
2 changed files with 9 additions and 5 deletions
|
|
@ -7,7 +7,7 @@ class Media:
|
|||
|
||||
def __init__(self, path, streams_video, streams_audio, streams_subtitle, streams_format):
|
||||
# misc
|
||||
self.id = Media._id_counter
|
||||
self.id = int(f"{time.time()}{Media._id_counter}")
|
||||
# source
|
||||
self.source_file: str = path
|
||||
self.source_path: str = os.path.dirname(path)
|
||||
|
|
@ -99,9 +99,8 @@ class Media:
|
|||
}
|
||||
|
||||
def to_dict_stat(self):
|
||||
return {time.time(): {
|
||||
return {self.id: {
|
||||
# source
|
||||
"id": self.id,
|
||||
"source_file_name": self.source_file_name,
|
||||
"source_file": self.source_file,
|
||||
"source_duration": self.source_duration,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import logging
|
||||
|
||||
import yaml
|
||||
import os
|
||||
|
||||
|
|
@ -16,8 +18,11 @@ class Stat:
|
|||
daten["videos"].update(obj.to_dict_stat())
|
||||
|
||||
# Datei mit aktualisierten Daten speichern
|
||||
with open(self.path, "w", encoding="utf8") as file:
|
||||
yaml.dump(daten, file, default_flow_style=False, indent=4, allow_unicode=True)
|
||||
try:
|
||||
with open(self.path, "w", encoding="utf8") as file:
|
||||
yaml.dump(daten, file, default_flow_style=False, indent=4, allow_unicode=True)
|
||||
except Exception as e:
|
||||
logging.error(f"Save Stat Failure: {e}")
|
||||
|
||||
def read_stat(self):
|
||||
# Bestehende Daten laden
|
||||
|
|
|
|||
Loading…
Reference in a new issue