改为一般环境能启动
This commit is contained in:
@@ -47,7 +47,7 @@ func initMovie() {
|
||||
width := 160
|
||||
height := 120
|
||||
log.Println(filename)
|
||||
cmd := exec.Command("ffmpeg", "-i", filename, "-vframes", "1", "-s", fmt.Sprintf("%dx%d", width, height), "movie/"+key+".webp")
|
||||
cmd := exec.Command("ffmpeg", "-i", filename, "-vframes", "1", "-s", fmt.Sprintf("%dx%d", width, height), "movie/"+key+".png")
|
||||
var buffer bytes.Buffer
|
||||
cmd.Stdout = &buffer
|
||||
if cmd.Run() != nil {
|
||||
@@ -56,12 +56,12 @@ func initMovie() {
|
||||
}
|
||||
|
||||
filepath.Walk("./movie", func(path string, info fs.FileInfo, err error) error {
|
||||
if !info.IsDir() && filepath.Ext(info.Name()) != ".webp" {
|
||||
if !info.IsDir() && filepath.Ext(info.Name()) != ".png" {
|
||||
base := info.Name()
|
||||
log.Println(path, info.Name())
|
||||
movies = append(movies, Movie{
|
||||
Name: info.Name(),
|
||||
Image: base[:strings.IndexByte(base, '.')] + ".webp",
|
||||
Image: base[:strings.IndexByte(base, '.')] + ".png",
|
||||
})
|
||||
}
|
||||
return nil
|
||||
|
||||
7
server/main_test.go
Normal file
7
server/main_test.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestMain(t *testing.T) {
|
||||
main()
|
||||
}
|
||||
Reference in New Issue
Block a user