Jelajahi Sumber

尝试修复路径转换的 bug 00

Signed-off-by: allan716 <[email protected]>
allan716 3 tahun lalu
induk
melakukan
55ba061209

+ 1 - 1
cmd/chinesesubfinder/main.go

@@ -103,7 +103,7 @@ func main() {
 		common.SetApiToken("")
 	}
 	// 是否开启开发模式,跳过某些流程
-	settings.GetSettings().SpeedDevMode = false
+	settings.GetSettings().SpeedDevMode = true
 	if settings.GetSettings().SpeedDevMode == true {
 		loggerBase.Infoln("Speed Dev Mode is On")
 	} else {

+ 14 - 0
internal/backend/controllers/v1/manual_sub.go

@@ -0,0 +1,14 @@
+package v1
+
+import "github.com/gin-gonic/gin"
+
+// ManualSubUploadOneHandler 一次上传一个字幕
+func (cb *ControllerBase) ManualSubUploadOneHandler(c *gin.Context) {
+
+	var err error
+	defer func() {
+		// 统一的异常处理
+		cb.ErrorProcess(c, "ManualSubUploadOneHandler", err)
+	}()
+
+}

+ 8 - 9
internal/backend/controllers/v1/video_list.go

@@ -54,6 +54,14 @@ func (cb *ControllerBase) RefreshVideoListHandler(c *gin.Context) {
 		cb.log.Infoln("------------------------------------")
 		cb.log.Infoln("Video Scan Started By webui...")
 
+		pathUrlMap := cb.GetPathUrlMap()
+		cb.log.Infoln("---------------------------------")
+		cb.log.Infoln("GetPathUrlMap")
+		for s, s2 := range pathUrlMap {
+			cb.log.Infoln("pathUrlMap", s, s2)
+		}
+		cb.log.Infoln("---------------------------------")
+
 		defer func() {
 			cb.videoScanAndRefreshHelperIsRunning = false
 			cb.videoScanAndRefreshHelperLocker.Unlock()
@@ -77,15 +85,6 @@ func (cb *ControllerBase) RefreshVideoListHandler(c *gin.Context) {
 			return
 		}
 
-		pathUrlMap := cb.GetPathUrlMap()
-
-		cb.log.Debugln("---------------------------------")
-		cb.log.Debugln("GetPathUrlMap")
-		for s, s2 := range pathUrlMap {
-			cb.log.Debugln("pathUrlMap", s, s2)
-		}
-		cb.log.Debugln("---------------------------------")
-
 		MovieInfos, SeasonInfos := cb.videoScanAndRefreshHelper.ScrabbleUpVideoList(scanVideoResult, pathUrlMap)
 
 		cb.log.Debugln("---------------------------------")

+ 11 - 0
pkg/path_helper/path_helper.go

@@ -37,6 +37,17 @@ func ChangePhysicalPathToSharePath(physicalFullPath, pathUrlMapKey, sharePrefixP
 	dirName := strings.ReplaceAll(physicalFullPath, pathUrlMapKey, "")
 	outPath := filepath.Join(sharePrefixPath, dirName)
 	return outPath
+
+	/*
+		// 首先需要判断这个需要替换的部分是否是包含关系
+		if strings.HasPrefix(physicalFullPath, pathUrlMapKey) == true {
+			dirName := strings.ReplaceAll(physicalFullPath, pathUrlMapKey, "")
+			outPath := filepath.Join(sharePrefixPath, dirName)
+			return outPath
+		} else {
+			return ""
+		}
+	*/
 }
 
 const (