Skip to content

Commit

Permalink
implementing the interface
Browse files Browse the repository at this point in the history
  • Loading branch information
James Yeh committed Dec 28, 2016
1 parent a34faef commit 595dce8
Showing 1 changed file with 41 additions and 22 deletions.
63 changes: 41 additions & 22 deletions provider/bitmovin/bitmovin.go
Original file line number Diff line number Diff line change
@@ -1,41 +1,52 @@
package bitmovin

import "github.com/NYTimes/video-transcoding-api/provider"
import (
"errors"

"github.com/NYTimes/video-transcoding-api/db"
"github.com/NYTimes/video-transcoding-api/provider"
"github.com/bitmovin/bitmovin-go/bitmovin"
"github.com/bitmovin/video-transcoding-api/config"
)

// Name is the name used for registering the bitmovin provider in the
// registry of providers.
const Name = "bitmovin"

var errBitmovinInvalidConfig = provider.InvalidConfigError("missing Bitmovin api key. Please define the environment variable BITMOVIN_API_KEY set this value in the configuration file")

type bitmovinProvider struct {
client *bitmovin.Bitmovin
config *config.Bitmovin
}

// func (p *bitmovinProvider) CreatePreset(db.Preset) (string, error) {

// }

// func (p *bitmovinProvider) DeletePreset(presetID string) error {

// }

// func (p *bitmovinProvider) GetPreset(presetID string) (interface{}, error) {

// }

// func (p *bitmovinProvider) Transcode(db.Job) (*provider.JobStatus, error) {

// }
func (p *bitmovinProvider) CreatePreset(db.Preset) (string, error) {
return "", errors.New("Not implemented")
}

// func (p *bitmovinProvider) JobStatus(db.Job) (*provider.JobStatus, error) {
func (p *bitmovinProvider) DeletePreset(presetID string) error {
return errors.New("Not implemented")
}

// }
func (p *bitmovinProvider) GetPreset(presetID string) (interface{}, error) {
return nil, errors.New("Not implemented")
}

// func (p *bitmovinProvider) CancelJob(jobID string) error {
func (p *bitmovinProvider) Transcode(*db.Job) (*provider.JobStatus, error) {
return nil, errors.New("Not implemented")
}

// }
func (p *bitmovinProvider) JobStatus(*db.Job) (*provider.JobStatus, error) {
return nil, errors.New("Not implemented")
}

// func (p *bitmovinProvider) Healthcheck() error {
func (p *bitmovinProvider) CancelJob(jobID string) error {
return errors.New("Not implemented")
}

// }
func (p *bitmovinProvider) Healthcheck() error {
return errors.New("Not implemented")
}

func (p *bitmovinProvider) Capabilities() provider.Capabilities {
return provider.Capabilities{
Expand All @@ -44,3 +55,11 @@ func (p *bitmovinProvider) Capabilities() provider.Capabilities {
Destinations: []string{"s3"},
}
}

func bitmovinFactory(cfg *config.Config) (provider.TranscodingProvider, error) {
if cfg.Bitmovin.APIKey == "" {
return nil, errBitmovinInvalidConfig
}
client := bitmovin.NewBitmovin(cfg.Bitmovin.APIKey, cfg.Bitmovin.Endpoint, int64(cfg.Bitmovin.Timeout))
return &bitmovinProvider{client: client, config: cfg.Bitmovin}, nil
}

0 comments on commit 595dce8

Please sign in to comment.