openshot

package
v0.0.0-...-1a959dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2019 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package openshot is a Go SDK for the OpenShot Cloud API.

Index

Constants

View Source
const (
	LocationX = "location_x"
)

Constants representing clip JSON property names More details at: http://cloud.openshot.org/doc/api_endpoints.html#clips

Variables

This section is empty.

Functions

This section is empty.

Types

type Clip

type Clip struct {
	URL        string                 `json:"url"`
	ID         int                    `json:"id"`
	JSON       map[string]interface{} `json:"json"`
	FileURL    string                 `json:"file"`
	Position   float32                `json:"position"`
	Start      float32                `json:"start"`
	End        float32                `json:"end"`
	Actions    []string               `json:"actions"`
	ProjectURL string                 `json:"project"`
}

Clip represents http://cloud.openshot.org/doc/api_endpoints.html#clips

func CreateClipStruct

func CreateClipStruct(file *File, project *Project) *Clip

CreateClipStruct creates a minimum Clip struct required for input to CreateClip

type Clips

type Clips struct {
	Results []Clip `json:"results"`
	// contains filtered or unexported fields
}

Clips is the response data for /projects/{projectID}/clips/

type Cord

type Cord struct {
	X int     `json:"X"` // frame number
	Y float64 `json:"Y"` // value
}

Cord contains a frame number, X, and a value, Y. OpenShot will change the value of the parent Property to Y by frame X, either gradually / instantly (based on the interpolation mode).

type Export

type Export struct {
	URL          string                 `json:"url"`
	ID           int                    `json:"id"`
	JSON         map[string]interface{} `json:"json"`
	Output       string                 `json:"output"`
	ExportType   string                 `json:"export_type"`
	VideoFormat  string                 `json:"video_format"`
	VideoCodec   string                 `json:"video_codec"`
	VideoBitrate int                    `json:"video_bitrate"`
	AudioCodec   string                 `json:"ac3"`
	AudioBitrate int                    `json:"audio_bitrate"`
	StartFrame   int                    `json:"start_frame"`
	EndFrame     int                    `json:"end_frame"`
	Actions      []string               `json:"actions"`
	ProjectURL   string                 `json:"project"`
	Webhook      string                 `json:"webhook"`
	Progress     float32                `json:"progress"`
	Status       string                 `json:"status"`
	DateCreated  string                 `json:"date_created"`
	DateUpdated  string                 `json:"date_updated"`
}

Export represents http://cloud.openshot.org/doc/api_endpoints.html#exports

func CreateDefaultExportStruct

func CreateDefaultExportStruct(project *Project) *Export

CreateDefaultExportStruct creates an Export struct with default settings

type Exports

type Exports struct {
	Results []Export `json:"results"`
	// contains filtered or unexported fields
}

Exports is the response data for /projects/{projectID}/exports/

type File

type File struct {
	URL         string      `json:"url"`
	ID          int         `json:"id"`
	JSON        interface{} `json:"json"`
	Media       string      `json:"media"`
	Project     string      `json:"project"`
	Actions     []string    `json:"actions"`
	DateCreated string      `json:"date_created"`
	DateUpdated string      `json:"date_updated"`
}

File represents http://cloud.openshot.org/doc/api_endpoints.html#files

type FileS3Info

type FileS3Info struct {
	URL    string `json:"url"`
	Bucket string `json:"bucket"`
	Name   string `json:"name"`
}

FileS3Info represents http://cloud.openshot.org/doc/api_endpoints.html#id20

func CreateFileS3InfoStruct

func CreateFileS3InfoStruct(testFileName string, folder string, bucket string) *FileS3Info

CreateFileS3InfoStruct creates a minimum FileS3Info struct required for input to CreateFileStruct

type FileUploadS3

type FileUploadS3 struct {
	ProjectURL string     `json:"project"`
	JSON       FileS3Info `json:"json"`
}

FileUploadS3 represents http://cloud.openshot.org/doc/api_endpoints.html#files

func CreateFileStruct

func CreateFileStruct(fileS3Info *FileS3Info) *FileUploadS3

CreateFileStruct creates a minimum FileUploadS3 struct required for input to CreateFile

type Files

type Files struct {
	Results []File `json:"results"`
	// contains filtered or unexported fields
}

Files is the response data for /projects/{projectID}/files/

type OpenShot

type OpenShot struct {
	BaseURL string
	// contains filtered or unexported fields
}

OpenShot is the main entry point into the sdk

func New

func New(BaseURL string, Username string, Password string) *OpenShot

New creates a new instance of OpenShot with default settings

func (*OpenShot) AddPropertyPoint

func (o *OpenShot) AddPropertyPoint(clip *Clip, key string, frame int, value float64)

AddPropertyPoint sets a JSON property of the provided clip object at the specified frame. DOES NOT set value on server, requires call to UpdateClip

func (*OpenShot) ClearPropertyPoints

func (o *OpenShot) ClearPropertyPoints(clip *Clip, key string)

ClearPropertyPoints clears all property point entires from clip for the specified property key.

func (*OpenShot) CreateClip

func (o *OpenShot) CreateClip(project *Project, clip *Clip) (*Clip, error)

CreateClip creates a clip for the specified project

func (*OpenShot) CreateExport

func (o *OpenShot) CreateExport(project *Project, input *Export) (*Export, error)

CreateExport triggers exporting the specified project with the given export settings on the OpenShot server

func (*OpenShot) CreateFile

func (o *OpenShot) CreateFile(project *Project, file *FileUploadS3) (*File, error)

CreateFile adds file to openshot from location on s3. The projectURL of the given file (if empty) is overridden with one matching the specified projectID. The URL (if empty) is overridden with "files/NAME"

func (*OpenShot) CreateProject

func (o *OpenShot) CreateProject(project *Project) (*Project, error)

CreateProject creates the given project on the OpenShot server

func (*OpenShot) DeleteClip

func (o *OpenShot) DeleteClip(clipID int) error

DeleteClip deletes the clip from openshot

func (*OpenShot) DeleteExport

func (o *OpenShot) DeleteExport(exportID int) error

DeleteExport deletes the export from openshot

func (*OpenShot) DeleteFile

func (o *OpenShot) DeleteFile(fileID int) error

DeleteFile deletes the file from openshot and associated storage

func (*OpenShot) DeleteProject

func (o *OpenShot) DeleteProject(projectID int) error

DeleteProject deletes a project on the OpenShot server. Note that this deletion will trigger deletion of all associated files and clips. There is also no (easy) way to recover a deleted project so this method should only be exposed to trusted sources and through an "are you sure" or equivalent confirmation dialog.

func (*OpenShot) GetClip

func (o *OpenShot) GetClip(clipID int) (*Clip, error)

GetClip gets the server version of the specified clip

func (*OpenShot) GetClips

func (o *OpenShot) GetClips(projectID int) (*Clips, error)

GetClips returns a list of all clips created for a particular project

func (*OpenShot) GetExport

func (o *OpenShot) GetExport(exportID int) (*Export, error)

GetExport gets the server version of the specified export

func (*OpenShot) GetExports

func (o *OpenShot) GetExports(projectID int) (*Exports, error)

GetExports returns a list of all exports created for a particular project

func (*OpenShot) GetFiles

func (o *OpenShot) GetFiles(project *Project) (*Files, error)

GetFiles returns a list of all files created for a particular project

func (*OpenShot) GetProjects

func (o *OpenShot) GetProjects() (*Projects, error)

GetProjects returns a list of all projects created on the OpenShot server

func (*OpenShot) GetProperty

func (o *OpenShot) GetProperty(clip *Clip, key string) *Property

GetProperty returns a json object type-asserted to an openshot.Property object

func (*OpenShot) SetScale

func (o *OpenShot) SetScale(clip *Clip, scale int)

SetScale sets the scale of the provided clip object DOES NOT set value on server, requires call to UpdateClip

func (*OpenShot) UpdateClip

func (o *OpenShot) UpdateClip(clip *Clip) (*Clip, error)

UpdateClip updates a clip on the OpenShot server

type Point

type Point struct {
	Co            Cord `json:"co"`
	Interpolation int  `json:"interpolation"`
}

Point represents a single point in animation properties. It contains the value and interpolation mode. Interpolation can be set to: 0 - Bézier, 1 - Linear, or 2 - Constant Read more about interpolation at http://cloud.openshot.org/doc/animation.html#key-frames

type Project

type Project struct {
	URL            string      `json:"url"`
	ID             int         `json:"id"`
	JSON           interface{} `json:"json"`
	Name           string      `json:"name"`
	Width          int         `json:"width"`
	Height         int         `json:"height"`
	FPSNumerator   int         `json:"fps_num"`
	FPSDenominator int         `json:"fps_den"`
	SampleRate     int         `json:"sample_rate"`
	Channels       int         `json:"channels"`
	ChannelLayout  int         `json:"channel_layout"`
	FileURLs       []string    `json:"files"`
	ClipURLs       []string    `json:"clips"`
	ExportURLs     []string    `json:"exports"`
	Actions        []string    `json:"actions"`
	DateCreated    string      `json:"date_created"`
	DateUpdated    string      `json:"date_updated"`
}

Project represents http://cloud.openshot.org/doc/api_endpoints.html#projects

type Projects

type Projects struct {
	Results []Project `json:"results"`
	// contains filtered or unexported fields
}

Projects is the response data for /projects/

type Property

type Property struct {
	Points []Point `json:"Points"`
}

Property represents the JSON structure of points in animations More details at http://cloud.openshot.org/doc/animation.html#json-structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL