Spaces:
Running
on
Zero
Running
on
Zero
df
Browse files- routers/webhook.py +8 -4
routers/webhook.py
CHANGED
@@ -23,6 +23,8 @@ from command.line_get_user_profile import get_user_profile
|
|
23 |
from command.n8n import post_data,post_data_line
|
24 |
import time
|
25 |
import traceback
|
|
|
|
|
26 |
logger = logging.getLogger(__name__)
|
27 |
##
|
28 |
#router = APIRouter()
|
@@ -152,14 +154,16 @@ async def webhook(request: Request):
|
|
152 |
)
|
153 |
|
154 |
# staticフォルダに音声ファイルを保存
|
155 |
-
os.makedirs('
|
156 |
-
|
|
|
|
|
157 |
with open(audio_file_path, 'wb') as file:
|
158 |
file.write(response.content)
|
159 |
|
160 |
print(f"Audio saved as {audio_file_path}")
|
161 |
-
wavurl = "https://kenken999-
|
162 |
-
thread_name =
|
163 |
|
164 |
|
165 |
|
|
|
23 |
from command.n8n import post_data,post_data_line
|
24 |
import time
|
25 |
import traceback
|
26 |
+
from pathlib import Path
|
27 |
+
|
28 |
logger = logging.getLogger(__name__)
|
29 |
##
|
30 |
#router = APIRouter()
|
|
|
154 |
)
|
155 |
|
156 |
# staticフォルダに音声ファイルを保存
|
157 |
+
os.makedirs('staticfiles', exist_ok=True)
|
158 |
+
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
|
159 |
+
audio_file_name = f"audio_{timestamp}.wav"
|
160 |
+
audio_file_path = os.path.join('staticfiles', audio_file_name)
|
161 |
with open(audio_file_path, 'wb') as file:
|
162 |
file.write(response.content)
|
163 |
|
164 |
print(f"Audio saved as {audio_file_path}")
|
165 |
+
wavurl = "https://kenken999-fastapi-django-main.hf.space/static/"+audio_file_path
|
166 |
+
thread_name = send_google_chat_card(webhook_url, "youtube audiofile", wavurl, link_text, link_url,thmbnail)#thread_name)
|
167 |
|
168 |
|
169 |
|