This commit is contained in:
Robert 2024-04-11 23:36:40 +07:00
parent bff53e6b07
commit 8446d83896
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22

View File

@ -41,13 +41,19 @@ class FileUploaderService:
if uploaded_file: if uploaded_file:
return return
converted_content = await self.audio_converter_service.audio_to_ogg( if file_url.endswith(".ogg") or file_url.endswith(".mp3"):
audio=BytesIO((await self.client.get(file_url)).read()) content = await self.audio_converter_service.audio_to_ogg(
) audio=BytesIO((await self.client.get(file_url)).read())
)
uploaded_file_id = await self.planfix_client.upload_file( uploaded_file_id = await self.planfix_client.upload_file(
file_content=converted_content file_content=content
) )
else:
uploaded_file_id = await self.planfix_client.upload_file_from_url(
file_url
)
await self.uploaded_file_repository.upsert( await self.uploaded_file_repository.upsert(
UploadedFile(file_id=uploaded_file_id, file_url=file_url) UploadedFile(file_id=uploaded_file_id, file_url=file_url)