convert fix

This commit is contained in:
user committed 2025-02-27 10:25:53 +03:00
1 parent a40e04943a
commit 17b0d37143
2 files changed
+21 -24

No files matched your search

+20 -19
View File
@@ -152,24 +152,25 @@ async def convert_loop():
# Process output.json: read its contents and update meta['ffprobe_meta']
output_json_path = os.path.join(output_dir.replace("/Storage/storedContent", "/app/data"), "output.json")
if os.path.exists(output_json_path) and unprocessed_encrypted_content.meta.get('ffprobe_meta') is None:
try:
with open(output_json_path, "r") as f:
output_json_content = f.read()
except Exception as e:
make_log("ConvertProcess", f"Error reading output.json for option {option}: {e}", level="error")
return
if os.path.exists(output_json_path):
if unprocessed_encrypted_content.meta.get('ffprobe_meta') is None:
try:
with open(output_json_path, "r") as f:
output_json_content = f.read()
except Exception as e:
make_log("ConvertProcess", f"Error reading output.json for option {option}: {e}", level="error")
return
try:
ffprobe_meta = json.loads(output_json_content)
except Exception as e:
make_log("ConvertProcess", f"Error parsing output.json for option {option}: {e}", level="error")
return
unprocessed_encrypted_content.meta = {
**unprocessed_encrypted_content.meta,
'ffprobe_meta': ffprobe_meta
}
try:
ffprobe_meta = json.loads(output_json_content)
except Exception as e:
make_log("ConvertProcess", f"Error parsing output.json for option {option}: {e}", level="error")
return
unprocessed_encrypted_content.meta = {
**unprocessed_encrypted_content.meta,
'ffprobe_meta': ffprobe_meta
}
else:
make_log("ConvertProcess", f"output.json not found for option {option}", level="error")
@@ -184,10 +185,10 @@ async def convert_loop():
unprocessed_encrypted_content.btfs_cid = ContentId(
version=2, content_hash=b58decode(converted_content['high'])
)
).serialize_v2()
unprocessed_encrypted_content.ipfs_cid = ContentId(
version=2, content_hash=b58decode(converted_content['low'])
)
).serialize_v2()
unprocessed_encrypted_content.meta = {
**unprocessed_encrypted_content.meta,
'converted_content': converted_content