Skip to content

Commit

Permalink
保存配置的时候,更新视频后缀名列表的缓存
Browse files Browse the repository at this point in the history
Signed-off-by: allan716 <525223688@qq.com>
  • Loading branch information
allanpk716 committed Apr 13, 2023
1 parent 10b13ac commit 017ffb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions internal/backend/controllers/v1/settings.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package v1

import (
"github.com/ChineseSubFinder/ChineseSubFinder/pkg"
"net/http"

"github.com/ChineseSubFinder/ChineseSubFinder/pkg/types/backend"
Expand Down Expand Up @@ -38,6 +39,7 @@ func (cb *ControllerBase) SettingsHandler(c *gin.Context) {
if err != nil {
return
}
pkg.ResetWantedVideoExt()
// ----------------------------------------
// 设置接口的 API TOKEN
if settings.Get().ExperimentalFunction.ApiKeySettings.Enabled == true {
Expand Down
10 changes: 8 additions & 2 deletions pkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ func FileNameIsBDMV(id_bdmv_fileFPath string) (bool, string) {
return false, ""
}

// ResetWantedVideoExt 重置视频后缀名
func ResetWantedVideoExt() {
_wantedExtMap = make(map[string]string)
_defExtMap = make(map[string]string)
}

// IsWantedVideoExtDef 后缀名是否符合规则
func IsWantedVideoExtDef(fileName string) bool {

Expand Down Expand Up @@ -730,6 +736,6 @@ func GetMaxSizeFile(path string) string {
}

var (
_wantedExtMap = make(map[string]string) // 人工确认的需要监控的视频后缀名
_defExtMap = make(map[string]string) // 内置支持的视频后缀名列表
_wantedExtMap = make(map[string]string) // 人工确认的需要监控的视频后缀名
_defExtMap = make(map[string]string) // 内置支持的视频后缀名列表
)

0 comments on commit 017ffb9

Please sign in to comment.