修改图片传入类型判断
This commit is contained in:
parent
f3c5cbff2a
commit
c72d45c020
@ -523,12 +523,19 @@ func matchArtistMedia(artists []ArtistMedia, unzipPath string) ([]ArtistMedia, e
|
||||
var err error
|
||||
var res []ArtistMedia
|
||||
for _, artist := range artists {
|
||||
oldImgPath := fmt.Sprintf("%s/%s/%s.jpg", unzipPath, artist.Name, artist.Id)
|
||||
var oldVideoPath, oldImgPath string
|
||||
for _, ext := range []string{".jpg", ".png", ".jpeg"} {
|
||||
p := fmt.Sprintf("%s/%s/%s%s", unzipPath, artist.Name, artist.Id, ext)
|
||||
if _, err = os.Stat(p); err == nil {
|
||||
oldImgPath = p
|
||||
break
|
||||
}
|
||||
}
|
||||
// 检查源文件是否存在
|
||||
if _, err = os.Stat(oldImgPath); os.IsNotExist(err) {
|
||||
fmt.Println("图片不存在: ", artist.Id, artist.Name, oldImgPath)
|
||||
continue
|
||||
}
|
||||
var oldVideoPath string
|
||||
for _, ext := range []string{".mp4", ".mov"} {
|
||||
p := fmt.Sprintf("%s/%s/%s%s", unzipPath, artist.Name, artist.Id, ext)
|
||||
if _, err = os.Stat(p); err == nil {
|
||||
@ -537,6 +544,7 @@ func matchArtistMedia(artists []ArtistMedia, unzipPath string) ([]ArtistMedia, e
|
||||
}
|
||||
}
|
||||
if oldVideoPath == "" {
|
||||
fmt.Println("视频不存在: ", artist.Id, artist.Name, oldVideoPath)
|
||||
continue
|
||||
}
|
||||
baseDir := filepath.Join(unzipPath, artist.Name)
|
||||
|
Loading…
Reference in New Issue
Block a user