kenken999 commited on
Commit
a2ae555
1 Parent(s): a1b976a
Files changed (1) hide show
  1. 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('static', exist_ok=True)
156
- audio_file_path = os.path.join('static', 'audio.wav')
 
 
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-nodex-n8n.hf.space"+audio_file_path
162
- thread_name = send_google_chat_card_thread(webhook_url, "youtube audiofile", wavurl, link_text, link_url,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