tangtang369 最近的时间轴更新
tangtang369

tangtang369

V2EX 第 392926 号会员,加入于 2019-03-17 18:27:02 +08:00
根据 tangtang369 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
tangtang369 最近回复了
39 天前
回复了 jiaokuniu 创建的主题 计算机 有没有必要等 Zen5 的迷你主机?
amd 真的有 ai 生态吗 认清现实
后端 python 或者 go 工作好像很多的
@drymonfidelia #25 你是 windows 吗 这个我 mac 和 linux 测了没啥问题
52 天前
回复了 hello267015 创建的主题 分享发现 曝光滴滴的骚操作
是不是自动把紧急联系人给你强制关联了支付
52 天前
回复了 Grocker 创建的主题 程序员 分辨多个用户之间是否是分身的算法?
建议放弃,以前不学,现在是很难学的进去的,或者是说自制力不行
这样好像可以删除掉
```
from flask import Flask, request, send_file, abort,after_this_request
import ffmpeg
import os
import tempfile
import time

app = Flask(__name__)

@app.route('/audio_appledevices/<name>.m4a', methods=['GET'])
def convert_audio(name):
ogg_path = f'./audio/{name}.ogg'
if not os.path.exists(ogg_path):
abort(404)
with tempfile.NamedTemporaryFile(delete=False, suffix='.m4a') as temp_file:
m4a_path = temp_file.name
try:
ffmpeg.input(ogg_path).output(m4a_path, codec='alac').run(overwrite_output=True)
response = send_file(m4a_path, as_attachment=True, download_name=f'{name}.m4a', mimetype='audio/mp4')
print("run m4a_path",m4a_path)

@after_this_request
def cleanup(response):
print("run cleanup")
time.sleep(1)
if os.path.exists(m4a_path):
os.remove(m4a_path)
return response
return response
except ffmpeg.Error as e:
abort(500)


if __name__ == '__main__':
app.run(host='127.0.0.1', port=3389)
```
52 天前
回复了 opsonly 创建的主题 深圳 30 岁买房问题
建议再等等,光明、沙井现在都还是 5w ,没怎么动,如果你一定要买坪山,我只能说从深圳去坪山还要坐高铁
52 天前
回复了 CNN 创建的主题 生活 你们家里用哪款打印机?
惠普 410 当年看王自如测评买的,非常拉垮,每次用之前都要清洁打印头
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   976 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 22:07 · PVG 06:07 · LAX 15:07 · JFK 18:07
Developed with CodeLauncher
♥ Do have faith in what you're doing.