Skip to content

Commit

Permalink
fix audio media type
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsmh authored Jan 7, 2024
1 parent 9fee404 commit 0cb252a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Deploy to Fly
on:
push:
branches:
- master
jobs:
deploy:
name: Deploy proxy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
22 changes: 22 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
app = "bilifeedbot"
primary_region = "nrt"
swap_size_mb = 1024

[build]

[http_service]
internal_port = 9000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
[http_service.concurrency]
type = "connections"
soft_limit = 50
hard_limit = 100

[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 256
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def get_media(
if response.status_code != 200:
raise NetworkError(f"媒体文件获取错误: {response.status_code} {url}->{f.url}")
mediatype = response.headers.get("content-type").split("/")
if mediatype[0] in ["video", "audio"]:
if mediatype[0] in ["video", "audio", "application"]:
if not os.path.exists(".tmp"):
os.mkdir(".tmp")
filename = f"{time.time()}.{mediatype[1]}"
Expand Down Expand Up @@ -696,6 +696,7 @@ def add_handler(application: Application):
port=int(os.environ.get("PORT", 9000)),
url_path=TOKEN,
webhook_url=f'{os.environ.get("DOMAIN")}{TOKEN}',
max_connections=100,
)
else:
application.run_polling()

0 comments on commit 0cb252a

Please sign in to comment.