convert fix

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

View File

@ -152,7 +152,8 @@ 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:
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()
@ -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

View File

@ -98,10 +98,6 @@ class StoredContent(AlchemyBase, AudioContentMixin):
def json_format(self):
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'):
extra_fields['filename'] = self.filename
extra_fields['encrypted'] = self.encrypted