Compare commits
	
		
			1 Commits
		
	
	
		
			gallery
			...
			thumbnail_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ef5bc2f597 | 
@@ -1,9 +1,12 @@
 | 
				
			|||||||
package videoparser
 | 
					package videoparser
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
	"encoding/base64"
 | 
						"encoding/base64"
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"image/jpeg"
 | 
				
			||||||
 | 
						"log"
 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -76,6 +79,16 @@ func parseFFmpegPic(path string) (*string, error) {
 | 
				
			|||||||
	if strEncPic == "" {
 | 
						if strEncPic == "" {
 | 
				
			||||||
		return nil, nil
 | 
							return nil, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// extract dimensions of picture
 | 
				
			||||||
 | 
						reader := bytes.NewReader(stdout)
 | 
				
			||||||
 | 
						im, err := jpeg.DecodeConfig(reader)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							log.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						fmt.Printf("%d %d\n", im.Width, im.Height)
 | 
				
			||||||
 | 
						// todo use this information somewhere...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	backpic64 := fmt.Sprintf("data:image/jpeg;base64,%s", strEncPic)
 | 
						backpic64 := fmt.Sprintf("data:image/jpeg;base64,%s", strEncPic)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &backpic64, nil
 | 
						return &backpic64, nil
 | 
				
			||||||
@@ -106,6 +119,11 @@ func getVideoAttributes(path string) *VideoAttributes {
 | 
				
			|||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// nil slice check of track array
 | 
				
			||||||
 | 
						if len(t.Media.Track) == 0 {
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	duration, err := strconv.ParseFloat(t.Media.Track[0].Duration, 32)
 | 
						duration, err := strconv.ParseFloat(t.Media.Track[0].Duration, 32)
 | 
				
			||||||
	filesize, err := strconv.Atoi(t.Media.Track[0].FileSize)
 | 
						filesize, err := strconv.Atoi(t.Media.Track[0].FileSize)
 | 
				
			||||||
	width, err := strconv.Atoi(t.Media.Track[1].Width)
 | 
						width, err := strconv.Atoi(t.Media.Track[1].Width)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user