- 新增ReadPsdImage函数支持PSD/PSB格式图片信息读取 - 修改文件扫描逻辑,将视频处理改为媒体候选处理,使用ffprobe统一判定 - 添加对PSB格式的支持,与PSD共享相同8BPS文件头处理 - 重构handle_image.go中的图片处理逻辑,优化错误处理和记录保存 - 更新文件扫描过滤规则,支持更多图片格式并跳过数据库文件 - 添加文件MD5计算功能用于文件唯一性标识 - 修改媒体处理流程,支持音频文件识别和分类处理 - 移除废弃的视频时长转换函数和相关依赖 - 更新依赖版本并添加SQLite支持用于媒体信息存储
509 lines
20 KiB
Go
509 lines
20 KiB
Go
package core
|
||
|
||
import (
|
||
"fmt"
|
||
"kenaito-media-picker/util"
|
||
"kenaito-media-picker/vars"
|
||
"os"
|
||
"strings"
|
||
)
|
||
|
||
// DoHandleMedia 处理所有媒体候选文件:ffprobe判定视频/音频/不支持
|
||
func DoHandleMedia(pickerDir string) {
|
||
total := len(vars.GlobalMediaPathList)
|
||
videoCount := 0 // 视频数
|
||
audioCount := 0 // 音频数
|
||
errorCount := 0 // 异常数
|
||
ignoreCount := 0
|
||
for _, mediaFilePath := range vars.GlobalMediaPathList {
|
||
fileMime := vars.GlobalFilePath2MimeInfoMap[mediaFilePath]
|
||
probe, err := util.ProbeMediaFile(util.FFprobeExePath(), mediaFilePath)
|
||
if err != nil {
|
||
if strings.Contains(fileMime, "video/") {
|
||
// mime是视频但ffprobe读不出来,视为损坏/异常视频
|
||
errorCount = errorCount + 1
|
||
vars.VideoReadErrorPathList = append(vars.VideoReadErrorPathList, mediaFilePath)
|
||
fmt.Printf("=== 异常视频: %s \n", mediaFilePath)
|
||
} else {
|
||
ignoreCount = ignoreCount + 1
|
||
vars.VideoIgnorePathList = append(vars.VideoIgnorePathList, mediaFilePath)
|
||
}
|
||
continue
|
||
}
|
||
width, height := probe.VideoResolution()
|
||
if width > 0 && height > 0 { // 有视频流
|
||
videoCount = videoCount + 1
|
||
vars.VideoPath2WidthHeightMap[mediaFilePath] = fmt.Sprintf("%d-%d", width, height)
|
||
saveMediaRecord(mediaFilePath, "video", width, height, probe.DurationSeconds(), probe.VideoCodec(), probe.FormatName(), probe.RawJSON())
|
||
fmt.Printf("=== 媒体总数: %d, 已处理: %d, 视频: %d, 音频: %d, 异常: %d, 忽略: %d \n", total, videoCount+audioCount+errorCount+ignoreCount, videoCount, audioCount, errorCount, ignoreCount)
|
||
continue
|
||
}
|
||
if probe.HasAudio() { // 仅有音频流
|
||
audioCount = audioCount + 1
|
||
vars.GlobalAudioPathList = append(vars.GlobalAudioPathList, mediaFilePath)
|
||
saveMediaRecord(mediaFilePath, "audio", 0, 0, probe.DurationSeconds(), probe.AudioCodec(), probe.FormatName(), probe.RawJSON())
|
||
continue
|
||
}
|
||
// 既无视频也无音频(字幕流等)
|
||
ignoreCount = ignoreCount + 1
|
||
vars.VideoIgnorePathList = append(vars.VideoIgnorePathList, mediaFilePath)
|
||
}
|
||
if len(vars.VideoReadErrorPathList) > 0 {
|
||
readInfoErrorPath := pickerDir + string(os.PathSeparator) + "视频_读取异常"
|
||
if util.CreateDir(readInfoErrorPath) {
|
||
util.DoMoveFileToDir(vars.VideoReadErrorPathList, readInfoErrorPath)
|
||
}
|
||
}
|
||
if len(vars.GlobalAudioPathList) > 0 {
|
||
audioPath := pickerDir + string(os.PathSeparator) + "音频"
|
||
if util.CreateDir(audioPath) {
|
||
util.DoMoveFileToDir(vars.GlobalAudioPathList, audioPath)
|
||
}
|
||
}
|
||
if len(vars.VideoIgnorePathList) > 0 {
|
||
ignorePath := pickerDir + string(os.PathSeparator) + "已忽略"
|
||
if util.CreateDir(ignorePath) {
|
||
util.DoMoveFileToDir(vars.VideoIgnorePathList, ignorePath)
|
||
}
|
||
}
|
||
doPickVideoFile(pickerDir, vars.VideoPath2WidthHeightMap)
|
||
fmt.Printf("=== 视频/音频处理完毕 \n\n")
|
||
}
|
||
|
||
// 条件视频并分组存放
|
||
func doPickVideoFile(pickerDir string, videoPath2WidthHeightMap map[string]string) {
|
||
if len(videoPath2WidthHeightMap) == 0 {
|
||
fmt.Printf("=== 当前目录下没有扫描到视频文件, %s \n", pickerDir)
|
||
return
|
||
}
|
||
for currentVideoPath, infoStr := range videoPath2WidthHeightMap {
|
||
width2Height := strings.Split(infoStr, "-")
|
||
width := util.String2int(width2Height[0])
|
||
height := util.String2int(width2Height[1])
|
||
suffix := vars.GlobalFilePath2FileExtMap[currentVideoPath]
|
||
if width > height {
|
||
handleHorizontalVideo(currentVideoPath, width, height, suffix)
|
||
continue
|
||
}
|
||
if width < height {
|
||
handleVerticalVideo(currentVideoPath, height, suffix)
|
||
continue
|
||
}
|
||
handleSquareVideo(currentVideoPath, width, height, suffix)
|
||
}
|
||
moveNormalVideo(pickerDir)
|
||
moveHorizontalVideo(pickerDir)
|
||
moveVerticalVideo(pickerDir)
|
||
moveSquareVideo(pickerDir)
|
||
moveGifVideo(pickerDir)
|
||
}
|
||
|
||
// 移动垂直视频
|
||
func moveVerticalVideo(pickerDir string) {
|
||
pathSeparator := string(os.PathSeparator)
|
||
if len(vars.VideoVertical1KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_1k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical1KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVertical2KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_2k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical2KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVertical3KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_3k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical3KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVertical4KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_4k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical4KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVertical5KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_5k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical5KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVertical6KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_6k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical6KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVertical7KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_7k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical7KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVertical8KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_8k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical8KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVertical9KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_9k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVertical9KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVerticalHKList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_原画质"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVerticalHKList, videoDirPath)
|
||
}
|
||
}
|
||
|
||
// 移动水平视频
|
||
func moveHorizontalVideo(pickerDir string) {
|
||
pathSeparator := string(os.PathSeparator)
|
||
if len(vars.VideoHorizontal1KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_1k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal1KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontal2KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_2k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal2KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontal3KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_3k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal3KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontal4KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_4k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal4KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontal5KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_5k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal5KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontal6KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_6k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal6KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontal7KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_7k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal7KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontal8KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_8k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal8KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontal9KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_9k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontal9KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalHKList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_原画质"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalHKList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandard720PList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_720P"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandard720PList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandard1D5PList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_1D5KP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandard1D5PList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandard1080PList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_1080P"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandard1080PList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandard2DKList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_2DKP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandard2DKList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandard2D5KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_2D5KP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandard2D5KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandardUltraWide2List) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_UltraWide2KP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandardUltraWide2List, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandardUltraWide3List) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_UltraWide3KP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandardUltraWide3List, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandardUltraWide4List) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_UltraWide4KP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandardUltraWide4List, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandard4KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_4KP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandard4KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandard4KHList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_4KHP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandard4KHList, videoDirPath)
|
||
}
|
||
if len(vars.VideoHorizontalStandard8KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_8KP"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalStandard8KList, videoDirPath)
|
||
}
|
||
}
|
||
|
||
// 移动等比视频
|
||
func moveSquareVideo(pickerDir string) {
|
||
pathSeparator := string(os.PathSeparator)
|
||
if len(vars.VideoSquare1KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_1k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare1KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquare2KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_2k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare2KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquare3KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_3k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare3KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquare4KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_4k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare4KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquare5KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_5k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare5KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquare6KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_6k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare6KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquare7KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_7k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare7KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquare8KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_8k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare8KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquare9KList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_9k"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquare9KList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquareHKList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_原画质"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquareHKList, videoDirPath)
|
||
}
|
||
}
|
||
|
||
// 移动gif视频
|
||
func moveGifVideo(pickerDir string) {
|
||
pathSeparator := string(os.PathSeparator)
|
||
if len(vars.VideoHorizontalGifList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_GIF"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalGifList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVerticalGifList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_GIF"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVerticalGifList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquareGifList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_GIF"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquareGifList, videoDirPath)
|
||
}
|
||
}
|
||
|
||
// 移动普通视频
|
||
func moveNormalVideo(pickerDir string) {
|
||
pathSeparator := string(os.PathSeparator)
|
||
if len(vars.VideoHorizontalNormalList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_横屏_普通"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoHorizontalNormalList, videoDirPath)
|
||
}
|
||
if len(vars.VideoVerticalNormalList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_竖屏_普通"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoVerticalNormalList, videoDirPath)
|
||
}
|
||
if len(vars.VideoSquareNormalList) > 0 {
|
||
videoDirPath := pickerDir + pathSeparator + "视频_等比_普通"
|
||
util.CreateDir(videoDirPath)
|
||
util.DoMoveFileToDir(vars.VideoSquareNormalList, videoDirPath)
|
||
}
|
||
}
|
||
|
||
// 处理垂直视频
|
||
func handleVerticalVideo(currentVideoPath string, height int, suffix string) {
|
||
if strings.EqualFold(suffix, ".gif") {
|
||
vars.VideoVerticalGifList = append(vars.VideoVerticalGifList, currentVideoPath)
|
||
return
|
||
}
|
||
if height < 1000 {
|
||
vars.VideoVerticalNormalList = append(vars.VideoVerticalNormalList, currentVideoPath)
|
||
} else if height < 2000 {
|
||
vars.VideoVertical1KList = append(vars.VideoVertical1KList, currentVideoPath)
|
||
} else if height < 3000 {
|
||
vars.VideoVertical2KList = append(vars.VideoVertical2KList, currentVideoPath)
|
||
} else if height < 4000 {
|
||
vars.VideoVertical3KList = append(vars.VideoVertical3KList, currentVideoPath)
|
||
} else if height < 5000 {
|
||
vars.VideoVertical4KList = append(vars.VideoVertical4KList, currentVideoPath)
|
||
} else if height < 6000 {
|
||
vars.VideoVertical5KList = append(vars.VideoVertical5KList, currentVideoPath)
|
||
} else if height < 7000 {
|
||
vars.VideoVertical6KList = append(vars.VideoVertical6KList, currentVideoPath)
|
||
} else if height < 8000 {
|
||
vars.VideoVertical7KList = append(vars.VideoVertical7KList, currentVideoPath)
|
||
} else if height < 9000 {
|
||
vars.VideoVertical8KList = append(vars.VideoVertical8KList, currentVideoPath)
|
||
} else if height < 10000 {
|
||
vars.VideoVertical9KList = append(vars.VideoVertical9KList, currentVideoPath)
|
||
} else if height >= 10000 {
|
||
vars.VideoVerticalHKList = append(vars.VideoVerticalHKList, currentVideoPath)
|
||
}
|
||
}
|
||
|
||
// 处理横向视频
|
||
func handleHorizontalVideo(currentVideoPath string, width int, height int, suffix string) {
|
||
if strings.EqualFold(suffix, ".gif") {
|
||
vars.VideoHorizontalGifList = append(vars.VideoHorizontalGifList, currentVideoPath)
|
||
return
|
||
}
|
||
// 1280×720(720p)—— 标准高清(HD),常用于早期高清视频或小型屏幕
|
||
if width == 1280 && height == 720 {
|
||
vars.VideoHorizontalStandard720PList = append(vars.VideoHorizontalStandard720PList, currentVideoPath)
|
||
return
|
||
}
|
||
// 1600×900—— 介于HD和FHD之间
|
||
if width == 1600 && height == 900 {
|
||
vars.VideoHorizontalStandard1D5PList = append(vars.VideoHorizontalStandard1D5PList, currentVideoPath)
|
||
return
|
||
}
|
||
// 1920×1080(1080p)—— 全高清,主流显示器、电视和视频的分辨率
|
||
if width == 1920 && height == 1080 {
|
||
vars.VideoHorizontalStandard1080PList = append(vars.VideoHorizontalStandard1080PList, currentVideoPath)
|
||
return
|
||
}
|
||
// 2048×1080(2dk)—— 影院2k
|
||
if width == 2048 && height == 1080 {
|
||
vars.VideoHorizontalStandard2DKList = append(vars.VideoHorizontalStandard2DKList, currentVideoPath)
|
||
return
|
||
}
|
||
// 2560×1440(1440p)—— 俗称“2.5K”,电竞显示器或高端手机屏幕
|
||
if width == 2560 && height == 1440 {
|
||
vars.VideoHorizontalStandard2D5KList = append(vars.VideoHorizontalStandard2D5KList, currentVideoPath)
|
||
return
|
||
}
|
||
// 2560×1080—— 带鱼屏显示器(超宽屏)
|
||
if width == 2560 && height == 1080 {
|
||
vars.VideoHorizontalStandardUltraWide2List = append(vars.VideoHorizontalStandardUltraWide2List, currentVideoPath)
|
||
return
|
||
}
|
||
// 3440×1440—— 带鱼屏显示器(超宽屏)
|
||
if width == 3440 && height == 1440 {
|
||
vars.VideoHorizontalStandardUltraWide3List = append(vars.VideoHorizontalStandardUltraWide3List, currentVideoPath)
|
||
return
|
||
}
|
||
// 5120×2160—— 带鱼屏显示器(超宽屏)
|
||
if width == 5120 && height == 2160 {
|
||
vars.VideoHorizontalStandardUltraWide4List = append(vars.VideoHorizontalStandardUltraWide4List, currentVideoPath)
|
||
return
|
||
}
|
||
// 3840×2160(主流4K)—— 超高清,现代高端显示器、电视和影视制作
|
||
if width == 3840 && height == 2160 {
|
||
vars.VideoHorizontalStandard4KList = append(vars.VideoHorizontalStandard4KList, currentVideoPath)
|
||
return
|
||
}
|
||
// 4096×2160(DCI 4K)—— 电影行业标准
|
||
if width == 4096 && height == 2160 {
|
||
vars.VideoHorizontalStandard4KHList = append(vars.VideoHorizontalStandard4KHList, currentVideoPath)
|
||
return
|
||
}
|
||
// 7680×4320—— 超高清,用于专业影视或高端设备
|
||
if width == 7680 && height == 4320 {
|
||
vars.VideoHorizontalStandard8KList = append(vars.VideoHorizontalStandard8KList, currentVideoPath)
|
||
return
|
||
}
|
||
// 非标规格
|
||
if width < 1000 {
|
||
vars.VideoHorizontalNormalList = append(vars.VideoHorizontalNormalList, currentVideoPath)
|
||
} else if width < 2000 {
|
||
vars.VideoHorizontal1KList = append(vars.VideoHorizontal1KList, currentVideoPath)
|
||
} else if width < 3000 {
|
||
vars.VideoHorizontal2KList = append(vars.VideoHorizontal2KList, currentVideoPath)
|
||
} else if width < 4000 {
|
||
vars.VideoHorizontal3KList = append(vars.VideoHorizontal3KList, currentVideoPath)
|
||
} else if width < 5000 {
|
||
vars.VideoHorizontal4KList = append(vars.VideoHorizontal4KList, currentVideoPath)
|
||
} else if width < 6000 {
|
||
vars.VideoHorizontal5KList = append(vars.VideoHorizontal5KList, currentVideoPath)
|
||
} else if width < 7000 {
|
||
vars.VideoHorizontal6KList = append(vars.VideoHorizontal6KList, currentVideoPath)
|
||
} else if width < 8000 {
|
||
vars.VideoHorizontal7KList = append(vars.VideoHorizontal7KList, currentVideoPath)
|
||
} else if width < 9000 {
|
||
vars.VideoHorizontal8KList = append(vars.VideoHorizontal8KList, currentVideoPath)
|
||
} else if width < 10000 {
|
||
vars.VideoHorizontal9KList = append(vars.VideoHorizontal9KList, currentVideoPath)
|
||
} else if width >= 10000 { // 提示请忽略
|
||
vars.VideoHorizontalHKList = append(vars.VideoHorizontalHKList, currentVideoPath)
|
||
}
|
||
}
|
||
|
||
// 处理等比视频
|
||
func handleSquareVideo(currentVideoPath string, width int, height int, suffix string) {
|
||
if strings.EqualFold(suffix, ".gif") {
|
||
vars.VideoSquareGifList = append(vars.VideoSquareGifList, currentVideoPath)
|
||
return
|
||
}
|
||
if width < 1000 {
|
||
vars.VideoSquareNormalList = append(vars.VideoSquareNormalList, currentVideoPath)
|
||
} else if width < 2000 {
|
||
vars.VideoSquare1KList = append(vars.VideoSquare1KList, currentVideoPath)
|
||
} else if width < 3000 {
|
||
vars.VideoSquare2KList = append(vars.VideoSquare2KList, currentVideoPath)
|
||
} else if width < 4000 {
|
||
vars.VideoSquare3KList = append(vars.VideoSquare3KList, currentVideoPath)
|
||
} else if width < 5000 {
|
||
vars.VideoSquare4KList = append(vars.VideoSquare4KList, currentVideoPath)
|
||
} else if width < 6000 {
|
||
vars.VideoSquare5KList = append(vars.VideoSquare5KList, currentVideoPath)
|
||
} else if width < 7000 {
|
||
vars.VideoSquare6KList = append(vars.VideoSquare6KList, currentVideoPath)
|
||
} else if width < 8000 {
|
||
vars.VideoSquare7KList = append(vars.VideoSquare7KList, currentVideoPath)
|
||
} else if width < 9000 {
|
||
vars.VideoSquare8KList = append(vars.VideoSquare8KList, currentVideoPath)
|
||
} else if width < 10000 {
|
||
vars.VideoSquare9KList = append(vars.VideoSquare9KList, currentVideoPath)
|
||
} else if width >= 10000 {
|
||
vars.VideoSquareHKList = append(vars.VideoSquareHKList, currentVideoPath)
|
||
}
|
||
}
|