This commit is contained in:
骑着蜗牛追导弹 2024-05-13 16:39:27 +08:00
parent 7da8ca2319
commit fcc42041ca
3 changed files with 156 additions and 126 deletions

Binary file not shown.

View File

@ -28,6 +28,7 @@ var supportImageTypes = []string{
// 水平图片
var normalImageList []string
var horizontalUnHandleImageList []string
var horizontalGifImageList []string
var horizontal2KImageList []string
var horizontal1KImageList []string
@ -43,11 +44,14 @@ var horizontalHKImageList []string
// 标准横向图片
var horizontalStandard720PImageList []string
var horizontalStandard1080PImageList []string
var horizontalStandard2KImageList []string
var horizontalStandard4KImageList []string
var horizontalStandard5KImageList []string
var horizontalStandard8KImageList []string
// 垂直图片
var verticalGifImageList []string
var verticalUnHandleImageList []string
var vertical1KImageList []string
var vertical2KImageList []string
var vertical3KImageList []string
@ -60,6 +64,7 @@ var vertical9KImageList []string
var verticalHKImageList []string
// 等比图片
var squareUnHandleImageList []string
var squareGifImageList []string
var square1KImageList []string
var square2KImageList []string
@ -71,13 +76,6 @@ var square7KImageList []string
var square8KImageList []string
var square9KImageList []string
var squareHKImageList []string
// 标准等比图片
var squareStandard720PImageList []string
var squareStandard1080PImageList []string
var squareStandard4KImageList []string
var squareStandard8KImageList []string
var psdImageList []string
func DoHandleImage(rootDir string) {
@ -173,7 +171,7 @@ func doPickImageFile(uid string, rootDir string, imagePath2WidthHeightMap map[st
handleVerticalImage(currentImagePath, height, suffix)
continue
}
handleSquareImage(currentImagePath, width, height, suffix)
handleSquareImage(currentImagePath, width, suffix)
}
moveNormalImage(rootDir, uid)
moveHorizontalImage(rootDir, uid)
@ -183,6 +181,7 @@ func doPickImageFile(uid string, rootDir string, imagePath2WidthHeightMap map[st
func moveSquareImage(rootDir string, uid string) {
pathSeparator := string(os.PathSeparator)
squareUnHandleImagePath := rootDir + pathSeparator + uid + "_图片_等比_未处理"
squareGifImagePath := rootDir + pathSeparator + uid + "_图片_等比_GIF"
square1KImagePath := rootDir + pathSeparator + uid + "_图片_等比_1k"
square2KImagePath := rootDir + pathSeparator + uid + "_图片_等比_2k"
@ -194,6 +193,10 @@ func moveSquareImage(rootDir string, uid string) {
square8KImagePath := rootDir + pathSeparator + uid + "_图片_等比_8k"
square9KImagePath := rootDir + pathSeparator + uid + "_图片_等比_9k"
squareHKImagePath := rootDir + pathSeparator + uid + "_图片_等比_原图"
if len(squareUnHandleImageList) > 0 {
util.CreateDir(squareUnHandleImagePath)
doMoveFileToDir(squareUnHandleImageList, squareUnHandleImagePath)
}
if len(squareGifImageList) > 0 {
util.CreateDir(squareGifImagePath)
doMoveFileToDir(squareGifImageList, squareGifImagePath)
@ -240,53 +243,36 @@ func moveSquareImage(rootDir string, uid string) {
}
}
func handleSquareImage(currentImagePath string, width int, height int, suffix string) {
func handleSquareImage(currentImagePath string, width int, suffix string) {
if strings.EqualFold(suffix, ".gif") {
squareGifImageList = append(squareGifImageList, currentImagePath)
return
}
if width < 1000 {
if width < caleHorizontalPix(1) {
normalImageList = append(normalImageList, currentImagePath)
} else if width >= 1000 && width < 2000 {
// 1280 x 720 -> 720p
if width == 1280 && height == 720 {
squareStandard720PImageList = append(squareStandard720PImageList, currentImagePath)
return
}
// 1920 x 1080 -> 1080p
if width == 1920 && height == 1080 {
squareStandard1080PImageList = append(squareStandard1080PImageList, currentImagePath)
return
}
} else if width >= caleHorizontalPix(1) && width < caleHorizontalPix(2) {
square1KImageList = append(square1KImageList, currentImagePath)
} else if width >= 2000 && width < 3000 {
} else if width >= caleHorizontalPix(2) && width < caleHorizontalPix(3) {
square2KImageList = append(square2KImageList, currentImagePath)
} else if width >= 3000 && width < 4000 {
// 3840 x 2160 -> 4k
if width == 3840 && height == 2160 {
squareStandard4KImageList = append(squareStandard4KImageList, currentImagePath)
return
}
} else if width >= caleHorizontalPix(3) && width < caleHorizontalPix(4) {
square3KImageList = append(square3KImageList, currentImagePath)
} else if width >= 4000 && width < 5000 {
} else if width >= caleHorizontalPix(4) && width < caleHorizontalPix(5) {
square4KImageList = append(square4KImageList, currentImagePath)
} else if width >= 5000 && width < 6000 {
} else if width >= caleHorizontalPix(5) && width < caleHorizontalPix(6) {
square5KImageList = append(square5KImageList, currentImagePath)
} else if width >= 6000 && width < 7000 {
} else if width >= caleHorizontalPix(6) && width < caleHorizontalPix(7) {
square6KImageList = append(square6KImageList, currentImagePath)
} else if width >= 7000 && width < 8000 {
// 7680 x 4320 -> 8k
if width == 7680 && height == 4320 {
squareStandard8KImageList = append(squareStandard8KImageList, currentImagePath)
return
}
} else if width >= caleHorizontalPix(7) && width < caleHorizontalPix(8) {
square7KImageList = append(square7KImageList, currentImagePath)
} else if width >= 8000 && width < 9000 {
} else if width >= caleHorizontalPix(8) && width < caleHorizontalPix(9) {
square8KImageList = append(square8KImageList, currentImagePath)
} else if width >= 9000 && width < 10000 {
} else if width >= caleHorizontalPix(9) && width < caleHorizontalPix(10) {
square9KImageList = append(square9KImageList, currentImagePath)
} else if width >= 10000 {
} else if width >= caleHorizontalPix(10) {
squareHKImageList = append(squareHKImageList, currentImagePath)
} else {
// 未处理的等比图片
squareUnHandleImageList = append(squareUnHandleImageList, currentImagePath)
}
}
@ -294,6 +280,7 @@ func handleSquareImage(currentImagePath string, width int, height int, suffix st
func moveVerticalImage(rootDir string, uid string) {
pathSeparator := string(os.PathSeparator)
verticalGifImagePath := rootDir + pathSeparator + uid + "_图片_竖屏_GIF"
verticalUnHandleImagePath := rootDir + pathSeparator + uid + "_图片_竖屏_未处理"
vertical1KImagePath := rootDir + pathSeparator + uid + "_图片_竖屏_1k"
vertical2KImagePath := rootDir + pathSeparator + uid + "_图片_竖屏_2k"
vertical3KImagePath := rootDir + pathSeparator + uid + "_图片_竖屏_3k"
@ -308,6 +295,10 @@ func moveVerticalImage(rootDir string, uid string) {
util.CreateDir(verticalGifImagePath)
doMoveFileToDir(verticalGifImageList, verticalGifImagePath)
}
if len(verticalUnHandleImageList) > 0 {
util.CreateDir(verticalUnHandleImagePath)
doMoveFileToDir(verticalUnHandleImageList, verticalUnHandleImagePath)
}
if len(vertical1KImageList) > 0 {
util.CreateDir(vertical1KImagePath)
doMoveFileToDir(vertical1KImageList, vertical1KImagePath)
@ -353,6 +344,7 @@ func moveVerticalImage(rootDir string, uid string) {
// 移动水平图片
func moveHorizontalImage(rootDir string, uid string) {
pathSeparator := string(os.PathSeparator)
horizontalUnHandleImagePath := rootDir + pathSeparator + uid + "_图片_横屏_未处理"
horizontalGifImagePath := rootDir + pathSeparator + uid + "_图片_横屏_GIF"
horizontal1KImagePath := rootDir + pathSeparator + uid + "_图片_横屏_1k"
horizontal2KImagePath := rootDir + pathSeparator + uid + "_图片_横屏_2k"
@ -366,8 +358,14 @@ func moveHorizontalImage(rootDir string, uid string) {
horizontalHKImagePath := rootDir + pathSeparator + uid + "_图片_横屏_原图"
horizontalStandard720PImagePath := rootDir + pathSeparator + uid + "_图片_横屏_720P"
horizontalStandard1080PImagePath := rootDir + pathSeparator + uid + "_图片_横屏_1080P"
horizontalStandard2KImagePath := rootDir + pathSeparator + uid + "_图片_横屏_2KP"
horizontalStandard4KImagePath := rootDir + pathSeparator + uid + "_图片_横屏_4KP"
horizontalStandard5KImagePath := rootDir + pathSeparator + uid + "_图片_横屏_5KP"
horizontalStandard8KImagePath := rootDir + pathSeparator + uid + "_图片_横屏_8KP"
if len(horizontalUnHandleImageList) > 0 {
util.CreateDir(horizontalUnHandleImagePath)
doMoveFileToDir(horizontalUnHandleImageList, horizontalUnHandleImagePath)
}
if len(horizontalGifImageList) > 0 {
util.CreateDir(horizontalGifImagePath)
doMoveFileToDir(horizontalGifImageList, horizontalGifImagePath)
@ -420,10 +418,18 @@ func moveHorizontalImage(rootDir string, uid string) {
util.CreateDir(horizontalStandard1080PImagePath)
doMoveFileToDir(horizontalStandard1080PImageList, horizontalStandard1080PImagePath)
}
if len(horizontalStandard2KImageList) > 0 {
util.CreateDir(horizontalStandard2KImagePath)
doMoveFileToDir(horizontalStandard2KImageList, horizontalStandard2KImagePath)
}
if len(horizontalStandard4KImageList) > 0 {
util.CreateDir(horizontalStandard4KImagePath)
doMoveFileToDir(horizontalStandard4KImageList, horizontalStandard4KImagePath)
}
if len(horizontalStandard5KImageList) > 0 {
util.CreateDir(horizontalStandard5KImagePath)
doMoveFileToDir(horizontalStandard5KImageList, horizontalStandard5KImagePath)
}
if len(horizontalStandard8KImageList) > 0 {
util.CreateDir(horizontalStandard8KImagePath)
doMoveFileToDir(horizontalStandard8KImageList, horizontalStandard8KImagePath)
@ -446,28 +452,31 @@ func handleVerticalImage(currentImagePath string, height int, suffix string) {
verticalGifImageList = append(verticalGifImageList, currentImagePath)
return
}
if height < 1000 {
if height < caleVerticalPix(1) {
normalImageList = append(normalImageList, currentImagePath)
} else if height >= 1000 && height < 2000 {
} else if height >= caleVerticalPix(1) && height < caleVerticalPix(2) {
vertical1KImageList = append(vertical1KImageList, currentImagePath)
} else if height >= 2000 && height < 3000 {
} else if height >= caleVerticalPix(2) && height < caleVerticalPix(3) {
vertical2KImageList = append(vertical2KImageList, currentImagePath)
} else if height >= 3000 && height < 4000 {
} else if height >= caleVerticalPix(3) && height < caleVerticalPix(4) {
vertical3KImageList = append(vertical3KImageList, currentImagePath)
} else if height >= 4000 && height < 5000 {
} else if height >= caleVerticalPix(4) && height < caleVerticalPix(5) {
vertical4KImageList = append(vertical4KImageList, currentImagePath)
} else if height >= 5000 && height < 6000 {
} else if height >= caleVerticalPix(5) && height < caleVerticalPix(6) {
vertical5KImageList = append(vertical5KImageList, currentImagePath)
} else if height >= 6000 && height < 7000 {
} else if height >= caleVerticalPix(6) && height < caleVerticalPix(7) {
vertical6KImageList = append(vertical6KImageList, currentImagePath)
} else if height >= 7000 && height < 8000 {
} else if height >= caleVerticalPix(7) && height < caleVerticalPix(8) {
vertical7KImageList = append(vertical7KImageList, currentImagePath)
} else if height >= 8000 && height < 9000 {
} else if height >= caleVerticalPix(8) && height < caleVerticalPix(9) {
vertical8KImageList = append(vertical8KImageList, currentImagePath)
} else if height >= 9000 && height < 10000 {
} else if height >= caleVerticalPix(9) && height < caleVerticalPix(10) {
vertical9KImageList = append(vertical9KImageList, currentImagePath)
} else if height >= 10000 {
} else if height >= caleVerticalPix(10) {
verticalHKImageList = append(verticalHKImageList, currentImagePath)
} else {
// 未处理的垂直图片
verticalUnHandleImageList = append(verticalUnHandleImageList, currentImagePath)
}
}
@ -477,9 +486,9 @@ func handleHorizontalImage(currentImagePath string, width int, height int, suffi
horizontalGifImageList = append(horizontalGifImageList, currentImagePath)
return
}
if width < 1000 {
if width < caleHorizontalPix(1) {
normalImageList = append(normalImageList, currentImagePath)
} else if width >= 1000 && width < 2000 {
} else if width >= caleHorizontalPix(1) && width < caleHorizontalPix(2) {
// 1280 x 720 -> 720p
if width == 1280 && height == 720 {
horizontalStandard720PImageList = append(horizontalStandard720PImageList, currentImagePath)
@ -491,34 +500,47 @@ func handleHorizontalImage(currentImagePath string, width int, height int, suffi
return
}
horizontal1KImageList = append(horizontal1KImageList, currentImagePath)
} else if width >= 2000 && width < 3000 {
} else if width >= caleHorizontalPix(2) && width < caleHorizontalPix(3) {
// 2560 x 1440 -> 2k
if width == 2560 && height == 1440 {
horizontalStandard2KImageList = append(horizontalStandard2KImageList, currentImagePath)
return
}
horizontal2KImageList = append(horizontal2KImageList, currentImagePath)
} else if width >= 3000 && width < 4000 {
} else if width >= caleHorizontalPix(3) && width < caleHorizontalPix(4) {
// 3840 x 2160 -> 4k
if width == 3840 && height == 2160 {
horizontalStandard4KImageList = append(horizontalStandard4KImageList, currentImagePath)
return
}
horizontal3KImageList = append(horizontal3KImageList, currentImagePath)
} else if width >= 4000 && width < 5000 {
} else if width >= caleHorizontalPix(4) && width < caleHorizontalPix(5) {
horizontal4KImageList = append(horizontal4KImageList, currentImagePath)
} else if width >= 5000 && width < 6000 {
} else if width >= caleHorizontalPix(5) && width < caleHorizontalPix(6) {
// 5120 x 2880 -> 5k
if width == 5120 && height == 2880 {
horizontalStandard5KImageList = append(horizontalStandard5KImageList, currentImagePath)
return
}
horizontal5KImageList = append(horizontal5KImageList, currentImagePath)
} else if width >= 6000 && width < 7000 {
} else if width >= caleHorizontalPix(6) && width < caleHorizontalPix(7) {
horizontal6KImageList = append(horizontal6KImageList, currentImagePath)
} else if width >= 7000 && width < 8000 {
} else if width >= caleHorizontalPix(7) && width < caleHorizontalPix(8) {
// 7680 x 4320 -> 8k
if width == 7680 && height == 4320 {
horizontalStandard8KImageList = append(horizontalStandard8KImageList, currentImagePath)
return
}
horizontal7KImageList = append(horizontal7KImageList, currentImagePath)
} else if width >= 8000 && width < 9000 {
} else if width >= caleHorizontalPix(8) && width < caleHorizontalPix(9) {
horizontal8KImageList = append(horizontal8KImageList, currentImagePath)
} else if width >= 9000 && width < 10000 {
} else if width >= caleHorizontalPix(9) && width < caleHorizontalPix(10) {
horizontal9KImageList = append(horizontal9KImageList, currentImagePath)
} else if width >= 10000 {
} else if width >= caleHorizontalPix(10) {
horizontalHKImageList = append(horizontalHKImageList, currentImagePath)
} else {
// 未分类的横向图片
horizontalUnHandleImageList = append(horizontalUnHandleImageList, currentImagePath)
}
}

View File

@ -44,7 +44,9 @@ var supportVideoTypes = []string{
// 水平视频
var horizontalNormalVideoList []string
var horizontalUnHandleVideoList []string
var horizontalGifVideoList []string
var horizontal1KVideoList []string
var horizontal2KVideoList []string
var horizontal3KVideoList []string
@ -59,7 +61,9 @@ var horizontalHKVideoList []string
// 标准横向视频
var horizontalStandard720PVideoList []string
var horizontalStandard1080PVideoList []string
var horizontalStandard2KVideoList []string
var horizontalStandard4KVideoList []string
var horizontalStandard5KVideoList []string
var horizontalStandard8KVideoList []string
// 垂直视频
@ -75,6 +79,7 @@ var vertical7KVideoList []string
var vertical8KVideoList []string
var vertical9KVideoList []string
var verticalHKVideoList []string
var verticalUnHandleVideoList []string
// 等比视频
var squareNormalVideoList []string
@ -89,10 +94,7 @@ var square7KVideoList []string
var square8KVideoList []string
var square9KVideoList []string
var squareHKVideoList []string
var squareStandard720PVideoList []string
var squareStandard1080PVideoList []string
var squareStandard4KVideoList []string
var squareStandard8KVideoList []string
var squareUnHandleVideoList []string
func DoHandleVideo(rootDir string) {
// 释放ffprobe
@ -121,7 +123,7 @@ func DoHandleVideo(rootDir string) {
fmt.Printf("=== Video总数: %d, 已读取Info: %d, 成功数: %d, 失败数: %d \n", total, successCount+errorCount+ignoreCount, successCount, errorCount)
duration := readVideoDuration(videoFilePath)
if duration == 0 {
videoPath2DurationMap[videoFilePath] = "0H0M0S"
videoPath2DurationMap[videoFilePath] = "00-00-00"
} else {
videoPath2DurationMap[videoFilePath] = util.SecondsToHms(duration)
}
@ -304,6 +306,9 @@ func moveVerticalVideo(rootDir string) {
if len(verticalHKVideoList) > 0 {
renameFileV2("[V][原]", verticalHKVideoList)
}
if len(verticalUnHandleVideoList) > 0 {
renameFileV2("[V][UnHandle]", verticalUnHandleVideoList)
}
}
// 移动文件到根目录
@ -411,12 +416,21 @@ func moveHorizontalVideo(rootDir string) {
if len(horizontalStandard1080PVideoList) > 0 {
renameFileV2("[H][1080P]", horizontalStandard1080PVideoList)
}
if len(horizontalStandard2KVideoList) > 0 {
renameFileV2("[H][2KP]", horizontalStandard2KVideoList)
}
if len(horizontalStandard4KVideoList) > 0 {
renameFileV2("[H][4KP]", horizontalStandard4KVideoList)
}
if len(horizontalStandard5KVideoList) > 0 {
renameFileV2("[H][5KP]", horizontalStandard5KVideoList)
}
if len(horizontalStandard8KVideoList) > 0 {
renameFileV2("[H][8KP]", horizontalStandard8KVideoList)
}
if len(horizontalUnHandleVideoList) > 0 {
renameFileV2("[H][UnHandle]", horizontalUnHandleVideoList)
}
}
// 移动等比视频
@ -451,17 +465,8 @@ func moveSquareVideo(rootDir string) {
if len(squareHKVideoList) > 0 {
renameFileV2("[M][原]", squareHKVideoList)
}
if len(squareStandard720PVideoList) > 0 {
renameFileV2("[M][720P]", squareStandard720PVideoList)
}
if len(squareStandard1080PVideoList) > 0 {
renameFileV2("[M][1080P]", squareStandard1080PVideoList)
}
if len(squareStandard4KVideoList) > 0 {
renameFileV2("[M][4KP]", squareStandard4KVideoList)
}
if len(squareStandard8KVideoList) > 0 {
renameFileV2("[M][8KP]", squareStandard8KVideoList)
if len(squareUnHandleVideoList) > 0 {
renameFileV2("[M][UnHandle]", squareUnHandleVideoList)
}
}
@ -469,7 +474,6 @@ func moveSquareVideo(rootDir string) {
func moveNormalVideo(rootDir string) {
//pathSeparator := string(os.PathSeparator)
if len(horizontalNormalVideoList) > 0 {
//renameFile(rootDir, "[L]", horizontalNormalVideoList, pathSeparator)
renameFileV2("[L]", horizontalNormalVideoList)
}
if len(verticalNormalVideoList) > 0 {
@ -508,23 +512,31 @@ func handleVerticalVideo(currentVideoPath string, height int, suffix string) {
vertical9KVideoList = append(vertical9KVideoList, currentVideoPath)
} else if height >= 10000 {
verticalHKVideoList = append(verticalHKVideoList, currentVideoPath)
} else {
// 未分类的垂直视频
verticalUnHandleVideoList = append(verticalUnHandleVideoList, currentVideoPath)
}
}
// 计算水平分辨率
func caleHorizontalPix(level int) int {
return 1024 * level
}
// 计算垂直分辨率
func caleVerticalPix(level int) int {
return 768 * level
}
// 处理横向视频
func handleHorizontalVideo(currentVideoPath string, width int, height int, suffix string) {
if strings.EqualFold(suffix, ".gif") {
horizontalGifVideoList = append(horizontalGifVideoList, currentVideoPath)
return
}
if width < 1000 {
// 160 × 120
// 320 × 180
// 320 × 240
// 640 × 360
// 640 × 480
if width < caleHorizontalPix(1) {
horizontalNormalVideoList = append(horizontalNormalVideoList, currentVideoPath)
} else if width >= 1000 && width < 2000 {
} else if width >= caleHorizontalPix(1) && width < caleHorizontalPix(2) {
// 1280 x 720 -> 720p
if width == 1280 && height == 720 {
horizontalStandard720PVideoList = append(horizontalStandard720PVideoList, currentVideoPath)
@ -536,34 +548,47 @@ func handleHorizontalVideo(currentVideoPath string, width int, height int, suffi
return
}
horizontal1KVideoList = append(horizontal1KVideoList, currentVideoPath)
} else if width >= 2000 && width < 3000 {
} else if width >= caleHorizontalPix(2) && width < caleHorizontalPix(3) {
// 2560 x 1440 -> 2k
if width == 2560 && height == 1440 {
horizontalStandard2KVideoList = append(horizontalStandard2KVideoList, currentVideoPath)
return
}
horizontal2KVideoList = append(horizontal2KVideoList, currentVideoPath)
} else if width >= 3000 && width < 4000 {
} else if width >= caleHorizontalPix(3) && width < caleHorizontalPix(4) {
// 3840 x 2160 -> 4k
if width == 3840 && height == 2160 {
horizontalStandard4KVideoList = append(horizontalStandard4KVideoList, currentVideoPath)
return
}
horizontal3KVideoList = append(horizontal3KVideoList, currentVideoPath)
} else if width >= 4000 && width < 5000 {
} else if width >= caleHorizontalPix(4) && width < caleHorizontalPix(5) {
horizontal4KVideoList = append(horizontal4KVideoList, currentVideoPath)
} else if width >= 5000 && width < 6000 {
} else if width >= caleHorizontalPix(5) && width < caleHorizontalPix(6) {
// 5120 x 2880 -> 5k
if width == 5120 && height == 2880 {
horizontalStandard5KVideoList = append(horizontalStandard5KVideoList, currentVideoPath)
return
}
horizontal5KVideoList = append(horizontal5KVideoList, currentVideoPath)
} else if width >= 6000 && width < 7000 {
} else if width >= caleHorizontalPix(6) && width < caleHorizontalPix(7) {
horizontal6KVideoList = append(horizontal6KVideoList, currentVideoPath)
} else if width >= 7000 && width < 8000 {
} else if width >= caleHorizontalPix(7) && width < caleHorizontalPix(8) {
// 7680 x 4320 -> 8k
if width == 7680 && height == 4320 {
horizontalStandard8KVideoList = append(horizontalStandard8KVideoList, currentVideoPath)
return
}
horizontal7KVideoList = append(horizontal7KVideoList, currentVideoPath)
} else if width >= 8000 && width < 9000 {
} else if width >= caleHorizontalPix(8) && width < caleHorizontalPix(9) {
horizontal8KVideoList = append(horizontal8KVideoList, currentVideoPath)
} else if width >= 9000 && width < 10000 {
} else if width >= caleHorizontalPix(9) && width < caleHorizontalPix(10) {
horizontal9KVideoList = append(horizontal9KVideoList, currentVideoPath)
} else if width >= 10000 {
} else if width >= caleHorizontalPix(10) {
horizontalHKVideoList = append(horizontalHKVideoList, currentVideoPath)
} else {
// 未分类的视频
horizontalUnHandleVideoList = append(horizontalUnHandleVideoList, currentVideoPath)
}
}
@ -573,48 +598,31 @@ func handleSquareVideo(currentVideoPath string, width int, height int, suffix st
squareGifVideoList = append(squareGifVideoList, currentVideoPath)
return
}
if width < 1000 {
if width < caleHorizontalPix(1) {
squareNormalVideoList = append(squareNormalVideoList, currentVideoPath)
} else if width >= 1000 && width < 2000 {
// 1280 x 720 -> 720p
if width == 1280 && height == 720 {
squareStandard720PVideoList = append(squareStandard720PVideoList, currentVideoPath)
return
}
// 1920 x 1080 -> 1080p
if width == 1920 && height == 1080 {
squareStandard1080PVideoList = append(squareStandard1080PVideoList, currentVideoPath)
return
}
} else if width >= caleHorizontalPix(1) && width < caleHorizontalPix(2) {
square1KVideoList = append(square1KVideoList, currentVideoPath)
} else if width >= 2000 && width < 3000 {
} else if width >= caleHorizontalPix(2) && width < caleHorizontalPix(3) {
square2KVideoList = append(square2KVideoList, currentVideoPath)
} else if width >= 3000 && width < 4000 {
// 3840 x 2160 -> 4k
if width == 3840 && height == 2160 {
squareStandard4KVideoList = append(squareStandard4KVideoList, currentVideoPath)
return
}
} else if width >= caleHorizontalPix(3) && width < caleHorizontalPix(4) {
square3KVideoList = append(square3KVideoList, currentVideoPath)
} else if width >= 4000 && width < 5000 {
} else if width >= caleHorizontalPix(4) && width < caleHorizontalPix(5) {
square4KVideoList = append(square4KVideoList, currentVideoPath)
} else if width >= 5000 && width < 6000 {
} else if width >= caleHorizontalPix(5) && width < caleHorizontalPix(6) {
square5KVideoList = append(square5KVideoList, currentVideoPath)
} else if width >= 6000 && width < 7000 {
} else if width >= caleHorizontalPix(6) && width < caleHorizontalPix(7) {
square6KVideoList = append(square6KVideoList, currentVideoPath)
} else if width >= 7000 && width < 8000 {
// 7680 x 4320 -> 8k
if width == 7680 && height == 4320 {
squareStandard8KVideoList = append(squareStandard8KVideoList, currentVideoPath)
return
}
} else if width >= caleHorizontalPix(7) && width < caleHorizontalPix(8) {
square7KVideoList = append(square7KVideoList, currentVideoPath)
} else if width >= 8000 && width < 9000 {
} else if width >= caleHorizontalPix(8) && width < caleHorizontalPix(9) {
square8KVideoList = append(square8KVideoList, currentVideoPath)
} else if width >= 9000 && width < 10000 {
} else if width >= caleHorizontalPix(9) && width < caleHorizontalPix(10) {
square9KVideoList = append(square9KVideoList, currentVideoPath)
} else if width >= 10000 {
} else if width >= caleHorizontalPix(10) {
squareHKVideoList = append(squareHKVideoList, currentVideoPath)
} else {
// 未处理的等比视频
squareUnHandleVideoList = append(squareUnHandleVideoList, currentVideoPath)
}
}