Beispiel #1
0
func ks3_flv_upload(c *s3.S3, idx_cfg IndexConfigT, ak string, sk string, key string, file string) bool {

	if len(idx_cfg.vdoid) == 0 {
		return true
	}

	pfile, err := os.Open(file)
	if err != nil {
		return false
	}

	bucket := idx_cfg.bucket
	contenttype := "application/ocet-stream"
	_, err = c.PutObject(
		&s3.PutObjectInput{
			Bucket:      &bucket,
			Key:         &key,
			Body:        aws.ReadSeekCloser(pfile),
			ContentType: &contenttype,
		},
	)

	if err != nil {
		return false
	}

	log.Info(fmt.Sprintf("[upload flv] bucket: %s key: %s file: %s\n", bucket, key, file))

	return true
}