convert fix
This commit is contained in:
parent
a40e04943a
commit
17b0d37143
|
|
@ -152,24 +152,25 @@ async def convert_loop():
|
||||||
|
|
||||||
# Process output.json: read its contents and update meta['ffprobe_meta']
|
# 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")
|
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:
|
if os.path.exists(output_json_path):
|
||||||
try:
|
if unprocessed_encrypted_content.meta.get('ffprobe_meta') is None:
|
||||||
with open(output_json_path, "r") as f:
|
try:
|
||||||
output_json_content = f.read()
|
with open(output_json_path, "r") as f:
|
||||||
except Exception as e:
|
output_json_content = f.read()
|
||||||
make_log("ConvertProcess", f"Error reading output.json for option {option}: {e}", level="error")
|
except Exception as e:
|
||||||
return
|
make_log("ConvertProcess", f"Error reading output.json for option {option}: {e}", level="error")
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ffprobe_meta = json.loads(output_json_content)
|
ffprobe_meta = json.loads(output_json_content)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
make_log("ConvertProcess", f"Error parsing output.json for option {option}: {e}", level="error")
|
make_log("ConvertProcess", f"Error parsing output.json for option {option}: {e}", level="error")
|
||||||
return
|
return
|
||||||
|
|
||||||
unprocessed_encrypted_content.meta = {
|
unprocessed_encrypted_content.meta = {
|
||||||
**unprocessed_encrypted_content.meta,
|
**unprocessed_encrypted_content.meta,
|
||||||
'ffprobe_meta': ffprobe_meta
|
'ffprobe_meta': ffprobe_meta
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
make_log("ConvertProcess", f"output.json not found for option {option}", level="error")
|
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(
|
unprocessed_encrypted_content.btfs_cid = ContentId(
|
||||||
version=2, content_hash=b58decode(converted_content['high'])
|
version=2, content_hash=b58decode(converted_content['high'])
|
||||||
)
|
).serialize_v2()
|
||||||
unprocessed_encrypted_content.ipfs_cid = ContentId(
|
unprocessed_encrypted_content.ipfs_cid = ContentId(
|
||||||
version=2, content_hash=b58decode(converted_content['low'])
|
version=2, content_hash=b58decode(converted_content['low'])
|
||||||
)
|
).serialize_v2()
|
||||||
unprocessed_encrypted_content.meta = {
|
unprocessed_encrypted_content.meta = {
|
||||||
**unprocessed_encrypted_content.meta,
|
**unprocessed_encrypted_content.meta,
|
||||||
'converted_content': converted_content
|
'converted_content': converted_content
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,6 @@ class StoredContent(AlchemyBase, AudioContentMixin):
|
||||||
|
|
||||||
def json_format(self):
|
def json_format(self):
|
||||||
extra_fields = {}
|
extra_fields = {}
|
||||||
if self.btfs_cid:
|
|
||||||
extra_fields['btfs_cid'] = self.btfs_cid
|
|
||||||
if self.ipfs_cid:
|
|
||||||
extra_fields['ipfs_cid'] = self.ipfs_cid
|
|
||||||
if self.type.startswith('local'):
|
if self.type.startswith('local'):
|
||||||
extra_fields['filename'] = self.filename
|
extra_fields['filename'] = self.filename
|
||||||
extra_fields['encrypted'] = self.encrypted
|
extra_fields['encrypted'] = self.encrypted
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue