Skip to content

Commit

Permalink
支持不依赖ffmpeg运行
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaner committed Sep 17, 2019
1 parent 112aefa commit 7ce25d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Yet another telegram youtbe bot
- [x] 音频分段发送
- [x] ACME Support
- [x] 音频封面
- [ ] 支持无依赖 FFMPEG 运行
- [x] 支持不依赖 FFMPEG 运行
- [ ] 同时处理同一个 Youtube 请求

### 参数
Expand Down
3 changes: 3 additions & 0 deletions audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func cvt(input, output string) error {
}

func duration(input string) int {
if !config.hasFfprobe {
return 0
}
// ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1
ctx, cfn := context.WithTimeout(context.Background(), time.Second*5)
defer cfn()
Expand Down
3 changes: 3 additions & 0 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func startBot(updates tgbotapi.UpdatesChannel, bot *tgbotapi.BotAPI) {
//TODO: backoff retry?
continue
}
if !config.hasFfmpeg {
continue
}
t.chatID = update.Message.Chat.ID
t.msgID = resp.MessageID
select {
Expand Down

0 comments on commit 7ce25d0

Please sign in to comment.