refactor: GIF 单独归类、跨文件系统复制回退与异常处理优化

This commit is contained in:
2025-03-12 21:01:04 +08:00
parent 9ed579d04e
commit 0ebd84d3fe
6 changed files with 83 additions and 14 deletions
+23 -2
View File
@@ -102,6 +102,7 @@ func doPickVideoFile(rootDir string, videoPath2WidthHeightMap map[string]string)
moveHorizontalVideo(uid, rootDir)
moveVerticalVideo(uid, rootDir)
moveSquareVideo(uid, rootDir)
moveGifVideo(uid, rootDir)
}
// 移动垂直视频
@@ -324,6 +325,26 @@ func moveSquareVideo(uid string, rootDir string) {
}
}
// 移动gif视频
func moveGifVideo(uid string, rootDir string) {
pathSeparator := string(os.PathSeparator)
if len(vars.VideoHorizontalGifList) > 0 {
videoDirPath := rootDir + pathSeparator + uid + "-视频_横屏_GIF"
util.CreateDir(videoDirPath)
util.DoMoveFileToDir(vars.VideoHorizontalGifList, videoDirPath)
}
if len(vars.VideoVerticalGifList) > 0 {
videoDirPath := rootDir + pathSeparator + uid + "-视频_竖屏_GIF"
util.CreateDir(videoDirPath)
util.DoMoveFileToDir(vars.VideoVerticalGifList, videoDirPath)
}
if len(vars.VideoSquareGifList) > 0 {
videoDirPath := rootDir + pathSeparator + uid + "-视频_等比_GIF"
util.CreateDir(videoDirPath)
util.DoMoveFileToDir(vars.VideoSquareGifList, videoDirPath)
}
}
// 移动普通视频
func moveNormalVideo(uid string, rootDir string) {
pathSeparator := string(os.PathSeparator)
@@ -370,7 +391,7 @@ func handleVerticalVideo(currentVideoPath string, height int, suffix string) {
vars.VideoVertical8KList = append(vars.VideoVertical8KList, currentVideoPath)
} else if height < 10000 {
vars.VideoVertical9KList = append(vars.VideoVertical9KList, currentVideoPath)
} else if height > 10000 {
} else if height >= 10000 {
vars.VideoVerticalHKList = append(vars.VideoVerticalHKList, currentVideoPath)
}
}
@@ -488,7 +509,7 @@ func handleSquareVideo(currentVideoPath string, width int, height int, suffix st
vars.VideoSquare8KList = append(vars.VideoSquare8KList, currentVideoPath)
} else if width < 10000 {
vars.VideoSquare9KList = append(vars.VideoSquare9KList, currentVideoPath)
} else if width > 10000 {
} else if width >= 10000 {
vars.VideoSquareHKList = append(vars.VideoSquareHKList, currentVideoPath)
}
}