fix
This commit is contained in:
parent
bff53e6b07
commit
8446d83896
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user