finished upload images

This commit is contained in:
bluebamus committed 2025-12-26 13:27:39 +09:00
1 parent 03a80afc71
commit 6917a76d60
14 files changed
+1359 -208

No files matched your search

+4 -4
View File
@@ -31,8 +31,8 @@ async def download_and_save_song(
"""
print(f"[download_and_save_song] START - task_id: {task_id}, store_name: {store_name}")
try:
# 저장 경로 생성: media/{날짜}/{uuid7}/{store_name}.mp3
today = date.today().isoformat()
# 저장 경로 생성: media/song/{날짜}/{uuid7}/{store_name}.mp3
today = date.today().strftime("%Y-%m-%d")
unique_id = await generate_task_id()
# 파일명에 사용할 수 없는 문자 제거
safe_store_name = "".join(
@@ -42,7 +42,7 @@ async def download_and_save_song(
file_name = f"{safe_store_name}.mp3"
# 절대 경로 생성
media_dir = Path("media") / today / unique_id
media_dir = Path("media") / "song" / today / unique_id
media_dir.mkdir(parents=True, exist_ok=True)
file_path = media_dir / file_name
print(f"[download_and_save_song] Directory created - path: {file_path}")
@@ -58,7 +58,7 @@ async def download_and_save_song(
print(f"[download_and_save_song] File saved - task_id: {task_id}, path: {file_path}")
# 프론트엔드에서 접근 가능한 URL 생성
relative_path = f"/media/{today}/{unique_id}/{file_name}"
relative_path = f"/media/song/{today}/{unique_id}/{file_name}"
base_url = f"http://{prj_settings.PROJECT_DOMAIN}"
file_url = f"{base_url}{relative_path}"
print(f"[download_and_save_song] URL generated - task_id: {task_id}, url: {file_url}")