Skip to content

Instantly share code, notes, and snippets.

@liangchaoboy
Created May 14, 2018 17:11
Show Gist options
  • Save liangchaoboy/50478c7cd458959296ade5a0236b2cde to your computer and use it in GitHub Desktop.
Save liangchaoboy/50478c7cd458959296ade5a0236b2cde to your computer and use it in GitHub Desktop.
get_vframe
package qiniustg
import (
"config"
"fmt"
"strings"
"strconv"
"github.com/qiniu/api.v7/auth/qbox"
"github.com/qiniu/api.v7/storage"
)
func HttpReq(recordsCh, retCh chan string, cg config.Config) {
for record := range recordsCh {
fs := strings.Split(record, "\t")
key := fs[0]
duration := fs[1]
imagekey := strings.Split(key, ".mp4")
time, _:=strconv.Atoi(duration)
var list int = time/5
for i:=1 ; i <= list; i++{
keyplus := i*5
mac := qbox.NewMac(ak, sk)
cfg := storage.Config{
UseHTTPS: false,
}
operationManager := storage.NewOperationManager(mac, &cfg)
fops_key := imagekey[0] + "_" + strconv.Itoa(keyplus) + ".jpg"
fops := fmt.Sprintf("vframe/jpg/offset/"+strconv.Itoa(keyplus)+"|saveas/%s", storage.EncodedEntry("vdownlog",fops_key ))
force := true
pipeline := "image"
operationManager.Pfop("vdown", key, fops, pipeline, "", force)
fmt.Printf("%s\t%d\t%d\t%s\n",key, i, keyplus, fops_key)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment