Compare commits
No commits in common. "main" and "v1.0" have entirely different histories.
29
README.md
29
README.md
@ -48,26 +48,9 @@ pip install -r requirements.txt
|
|||||||
|
|
||||||
### 2. 启动服务器
|
### 2. 启动服务器
|
||||||
```bash
|
```bash
|
||||||
python main.py --port 5000
|
python main.py
|
||||||
```
|
|
||||||
### 3. 指定公网地址
|
|
||||||
```python
|
|
||||||
##sanjuuni_utils.py
|
|
||||||
return {
|
|
||||||
'status': 'success',
|
|
||||||
'download_url': f"http://ffmpeg.liulikeji.cn/download/{output_id}/{output_filename}", #外部访问地址
|
|
||||||
'file_id': output_id,
|
|
||||||
'temp_dir': temp_dir # 返回临时目录路径
|
|
||||||
}
|
|
||||||
|
|
||||||
##ffmpeg_utils.py
|
|
||||||
return {
|
|
||||||
'status': 'success',
|
|
||||||
'download_url': f"http://ffmpeg.liulikeji.cn/download/{output_id}/{output_filename}", #外部访问地址
|
|
||||||
'file_id': output_id,
|
|
||||||
'temp_dir': temp_dir # 返回临时目录路径
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ⏰ 自动缓存清理配置
|
## ⏰ 自动缓存清理配置
|
||||||
@ -78,6 +61,14 @@ python main.py --port 5000
|
|||||||
CLEANUP_INTERVAL = 3600 # 清理临时文件的间隔(秒)
|
CLEANUP_INTERVAL = 3600 # 清理临时文件的间隔(秒)
|
||||||
FILE_EXPIRY = 7200 # 文件过期时间(秒)
|
FILE_EXPIRY = 7200 # 文件过期时间(秒)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 端口配置
|
||||||
|
- **默认端口**: 5000
|
||||||
|
- **自定义配置**:
|
||||||
|
```python
|
||||||
|
# 在main.py文件底部中修改
|
||||||
|
app.run(debug=True,port=5000)
|
||||||
|
```
|
||||||
---
|
---
|
||||||
|
|
||||||
## ⚠️ 注意事项
|
## ⚠️ 注意事项
|
||||||
|
20
main.py
20
main.py
@ -4,7 +4,6 @@ from flask import Flask, request, jsonify
|
|||||||
import threading
|
import threading
|
||||||
import queue
|
import queue
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
from ffmpeg_utils import process_ffmpeg
|
from ffmpeg_utils import process_ffmpeg
|
||||||
from sanjuuni_utils import process_sanjuuni
|
from sanjuuni_utils import process_sanjuuni
|
||||||
from file_cleanup import start_cleanup_thread
|
from file_cleanup import start_cleanup_thread
|
||||||
@ -123,22 +122,7 @@ def download_file_endpoint(file_id, filename):
|
|||||||
logging.error(f"下载文件时出错: {e}")
|
logging.error(f"下载文件时出错: {e}")
|
||||||
return jsonify({'status': 'error', 'error': str(e)}), 500
|
return jsonify({'status': 'error', 'error': str(e)}), 500
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/health', methods=['GET'])
|
|
||||||
def health_check():
|
|
||||||
"""健康检查接口,直接返回 'ok'"""
|
|
||||||
return "OK"
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# 配置命令行参数解析
|
logging.basicConfig(level=logging.INFO)
|
||||||
parser = argparse.ArgumentParser(description='启动FFmpeg处理服务')
|
|
||||||
parser.add_argument('--port', type=int, default=5000, help='服务监听的端口号(默认: 5000)')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
logging.info(f"启动应用程序,端口: {args.port}...")
|
|
||||||
start_cleanup_thread()
|
start_cleanup_thread()
|
||||||
app.run(host='0.0.0.0', port=args.port, threaded=True)
|
app.run(debug=True)
|
Loading…
x
Reference in New Issue
Block a user