From a5b757b251a42a363d97467f8f7ed1bf07bc754e Mon Sep 17 00:00:00 2001 From: Xhofe Date: Sat, 26 Mar 2022 17:10:37 +0800 Subject: [PATCH] feat: customize audio/video types (close #819) --- bootstrap/setting.go | 14 ++++++++++++++ model/setting.go | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/bootstrap/setting.go b/bootstrap/setting.go index f999703e..88f2bb8c 100644 --- a/bootstrap/setting.go +++ b/bootstrap/setting.go @@ -73,6 +73,20 @@ func InitSettings() { Description: "text type extensions", Group: model.FRONT, }, + { + Key: "audio types", + Value: strings.Join(conf.AudioTypes, ","), + Type: "string", + Description: "audio type extensions", + Group: model.FRONT, + }, + { + Key: "video types", + Value: strings.Join(conf.VideoTypes, ","), + Type: "string", + Description: "video type extensions", + Group: model.FRONT, + }, { Key: "d_proxy types", Value: strings.Join(conf.DProxyTypes, ","), diff --git a/model/setting.go b/model/setting.go index 2bfc11d5..7cb7e26c 100644 --- a/model/setting.go +++ b/model/setting.go @@ -93,6 +93,14 @@ func LoadSettings() { if err == nil { conf.TextTypes = strings.Split(textTypes.Value, ",") } + audioTypes, err := GetSettingByKey("text types") + if err == nil { + conf.AudioTypes = strings.Split(audioTypes.Value, ",") + } + videoTypes, err := GetSettingByKey("text types") + if err == nil { + conf.VideoTypes = strings.Split(videoTypes.Value, ",") + } dProxyTypes, err := GetSettingByKey("d_proxy types") if err == nil { conf.DProxyTypes = strings.Split(dProxyTypes.Value, ",")