Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2a980bbc
authored
Dec 13, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(audio): replace SysLog with logger for improved logging in GetAudioDuration
parent
da0d3ea9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
common/audio.go
+3
-2
No files found.
common/audio.go
View file @
2a980bbc
...
...
@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"github.com/QuantumNous/new-api/logger"
"github.com/abema/go-mp4"
"github.com/go-audio/aiff"
"github.com/go-audio/wav"
...
...
@@ -19,7 +20,7 @@ import (
// GetAudioDuration 使用纯 Go 库获取音频文件的时长(秒)。
// 它不再依赖外部的 ffmpeg 或 ffprobe 程序。
func
GetAudioDuration
(
ctx
context
.
Context
,
f
io
.
ReadSeeker
,
ext
string
)
(
duration
float64
,
err
error
)
{
SysLog
(
fmt
.
Sprintf
(
"GetAudioDuration: ext=%s"
,
ext
))
logger
.
LogInfo
(
ctx
,
fmt
.
Sprintf
(
"GetAudioDuration: ext=%s"
,
ext
))
// 根据文件扩展名选择解析器
switch
ext
{
case
".mp3"
:
...
...
@@ -44,7 +45,7 @@ func GetAudioDuration(ctx context.Context, f io.ReadSeeker, ext string) (duratio
default
:
return
0
,
fmt
.
Errorf
(
"unsupported audio format: %s"
,
ext
)
}
SysLog
(
fmt
.
Sprintf
(
"GetAudioDuration: duration=%f"
,
duration
))
logger
.
LogInfo
(
ctx
,
fmt
.
Sprintf
(
"GetAudioDuration: duration=%f"
,
duration
))
return
duration
,
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment