mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: thumbnails
This commit is contained in:
parent
c39d9d5340
commit
3413e6ca73
33 changed files with 161 additions and 740 deletions
|
|
@ -6,7 +6,7 @@ from config.config import get_learnhouse_config
|
|||
|
||||
|
||||
async def upload_content(
|
||||
directory: str, org_id: str, file_binary: bytes, file_and_format: str
|
||||
directory: str, org_uuid: str, file_binary: bytes, file_and_format: str
|
||||
):
|
||||
# Get Learnhouse Config
|
||||
learnhouse_config = get_learnhouse_config()
|
||||
|
|
@ -16,12 +16,12 @@ async def upload_content(
|
|||
|
||||
if content_delivery == "filesystem":
|
||||
# create folder for activity
|
||||
if not os.path.exists(f"content/{org_id}/{directory}"):
|
||||
if not os.path.exists(f"content/{org_uuid}/{directory}"):
|
||||
# create folder for activity
|
||||
os.makedirs(f"content/{org_id}/{directory}")
|
||||
os.makedirs(f"content/{org_uuid}/{directory}")
|
||||
# upload file to server
|
||||
with open(
|
||||
f"content/{org_id}/{directory}/{file_and_format}",
|
||||
f"content/{org_uuid}/{directory}/{file_and_format}",
|
||||
"wb",
|
||||
) as f:
|
||||
f.write(file_binary)
|
||||
|
|
@ -37,13 +37,13 @@ async def upload_content(
|
|||
)
|
||||
|
||||
# Create folder for activity
|
||||
if not os.path.exists(f"content/{org_id}/{directory}"):
|
||||
if not os.path.exists(f"content/{org_uuid}/{directory}"):
|
||||
# create folder for activity
|
||||
os.makedirs(f"content/{org_id}/{directory}")
|
||||
os.makedirs(f"content/{org_uuid}/{directory}")
|
||||
|
||||
# Upload file to server
|
||||
with open(
|
||||
f"content/{org_id}/{directory}/{file_and_format}",
|
||||
f"content/{org_uuid}/{directory}/{file_and_format}",
|
||||
"wb",
|
||||
) as f:
|
||||
f.write(file_binary)
|
||||
|
|
@ -52,9 +52,9 @@ async def upload_content(
|
|||
print("Uploading to s3 using boto3...")
|
||||
try:
|
||||
s3.upload_file(
|
||||
f"content/{org_id}/{directory}/{file_and_format}",
|
||||
f"content/{org_uuid}/{directory}/{file_and_format}",
|
||||
"learnhouse-media",
|
||||
f"content/{org_id}/{directory}/{file_and_format}",
|
||||
f"content/{org_uuid}/{directory}/{file_and_format}",
|
||||
)
|
||||
except ClientError as e:
|
||||
print(e)
|
||||
|
|
@ -63,7 +63,7 @@ async def upload_content(
|
|||
try:
|
||||
s3.head_object(
|
||||
Bucket="learnhouse-media",
|
||||
Key=f"content/{org_id}/{directory}/{file_and_format}",
|
||||
Key=f"content/{org_uuid}/{directory}/{file_and_format}",
|
||||
)
|
||||
print("File upload successful!")
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue