fix magic

This commit is contained in:
user 2025-04-26 13:24:35 +03:00
parent d2ff332490
commit 4483c194da
1 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ async def convert_loop(memory):
# ==== Новая логика: определение MIME-тип через python-magic ==== # ==== Новая логика: определение MIME-тип через python-magic ====
try: try:
mime_type = magic.from_file(input_file_path, mime=True) mime_type = magic.from_file(input_file_path.replace("/Storage/storedContent", "/app/data"), mime=True)
except Exception as e: except Exception as e:
make_log("ConvertProcess", f"magic probe failed: {e}", level="warning") make_log("ConvertProcess", f"magic probe failed: {e}", level="warning")
mime_type = "" mime_type = ""
@ -65,7 +65,7 @@ async def convert_loop(memory):
# Для прочих типов сохраняем raw копию и выходим # Для прочих типов сохраняем raw копию и выходим
if content_kind == "other": if content_kind == "other":
make_log("ConvertProcess", f"Content {unprocessed_encrypted_content.id} processed. Converted content: {converted_content}", level="info") make_log("ConvertProcess", f"Content {unprocessed_encrypted_content.id} processed. Not audio/video, copy just", level="info")
unprocessed_encrypted_content.btfs_cid = ContentId( unprocessed_encrypted_content.btfs_cid = ContentId(
version=2, content_hash=b58decode(converted_content['high' if content_kind=='video' else 'low']) version=2, content_hash=b58decode(converted_content['high' if content_kind=='video' else 'low'])
).serialize_v2() ).serialize_v2()