mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 13:07:36 +03:00
Change default transcodings to a proper typed struct
This commit is contained in:
parent
62cc8a2d4b
commit
eb93136b3f
2 changed files with 19 additions and 14 deletions
|
@ -88,24 +88,29 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DefaultDownsamplingFormat = "opus"
|
DefaultDownsamplingFormat = "opus"
|
||||||
DefaultTranscodings = []map[string]interface{}{
|
DefaultTranscodings = []struct {
|
||||||
|
Name string
|
||||||
|
TargetFormat string
|
||||||
|
DefaultBitRate int
|
||||||
|
Command string
|
||||||
|
}{
|
||||||
{
|
{
|
||||||
"name": "mp3 audio",
|
Name: "mp3 audio",
|
||||||
"targetFormat": "mp3",
|
TargetFormat: "mp3",
|
||||||
"defaultBitRate": 192,
|
DefaultBitRate: 192,
|
||||||
"command": "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -f mp3 -",
|
Command: "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -f mp3 -",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "opus audio",
|
Name: "opus audio",
|
||||||
"targetFormat": "opus",
|
TargetFormat: "opus",
|
||||||
"defaultBitRate": 128,
|
DefaultBitRate: 128,
|
||||||
"command": "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -c:a libopus -f opus -",
|
Command: "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -c:a libopus -f opus -",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "aac audio",
|
Name: "aac audio",
|
||||||
"targetFormat": "aac",
|
TargetFormat: "aac",
|
||||||
"defaultBitRate": 256,
|
DefaultBitRate: 256,
|
||||||
"command": "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -c:a aac -f adts -",
|
Command: "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -c:a aac -f adts -",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ func upAddDefaultTranscodings(_ context.Context, tx *sql.Tx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, t := range consts.DefaultTranscodings {
|
for _, t := range consts.DefaultTranscodings {
|
||||||
_, err := stmt.Exec(uuid.NewString(), t["name"], t["targetFormat"], t["defaultBitRate"], t["command"])
|
_, err := stmt.Exec(uuid.NewString(), t.Name, t.TargetFormat, t.DefaultBitRate, t.Command)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue