Skip to content

Commit

Permalink
Merge pull request #345 from bcc-code/feat/softron-style-file-export
Browse files Browse the repository at this point in the history
Feat/softron style file export
  • Loading branch information
KillerX authored Nov 1, 2024
2 parents 0d68ea9 + ad54738 commit ca92dd2
Show file tree
Hide file tree
Showing 27 changed files with 939 additions and 154 deletions.
4 changes: 4 additions & 0 deletions activities/email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"go.temporal.io/sdk/testsuite"
"os"
"testing"
)

Expand All @@ -21,6 +22,9 @@ func (s *EmailTestSuite) SetupTest() {

func (s *EmailTestSuite) TestSimpleEmail() {
t := s.T()
if os.Getenv("SENDGRID_API_KEY") == "" {
t.Skip("SENDGRID_API_KEY not set")
}

ua := UtilActivities{}
s.env.RegisterActivity(ua.SendEmail)
Expand Down
69 changes: 69 additions & 0 deletions activities/transconde_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package activities

import (
"github.com/bcc-code/bcc-media-flows/common"
"github.com/bcc-code/bcc-media-flows/paths"
"github.com/bcc-code/bcc-media-flows/services/vidispine"
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"go.temporal.io/sdk/testsuite"
"os"
"testing"
)

type TranscodeTestSuite struct {
suite.Suite
testsuite.WorkflowTestSuite

env *testsuite.TestActivityEnvironment
}

func (s *TranscodeTestSuite) SetupTest() {
s.env = s.NewTestActivityEnvironment()
}

func (s *TranscodeTestSuite) TestAThing() {
t := s.T()
t.Skip("this test requires a special file that is rather large to commit")

// Change this path to where your test file is
testFilePath := "./testdata/5sec.mov"

os.MkdirAll("./testdata/generated/", 0755)

input := common.MergeInput{
Title: "Softron_20sec_64ch_1audio-por",
Items: []common.MergeInputItem{
{
Path: paths.MustParse(testFilePath),
Start: 0,
End: 3,
Streams: []vidispine.AudioStream{
{
StreamID: 2,
ChannelID: 16,
},
{
StreamID: 2,
ChannelID: 17,
},
},
},
},
OutputDir: paths.MustParse("./testdata/generated/"),
WorkDir: paths.MustParse("./testdata/generated/"),
Duration: 3,
}

aa := AudioActivities{}
s.env.RegisterActivity(aa.TranscodeMergeAudio)
res, err := s.env.ExecuteActivity(aa.TranscodeMergeAudio, input)

assert.NoError(t, err)
spew.Dump(res)
}

func TestTranscodeTestSuite(t *testing.T) {
suite.Run(t, new(TranscodeTestSuite))
}
3 changes: 2 additions & 1 deletion common/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package common

import (
"github.com/bcc-code/bcc-media-flows/paths"
"github.com/bcc-code/bcc-media-flows/services/vidispine"
)

type MergeInputItem struct {
Path paths.Path
Start float64
End float64
Streams []int
Streams []vidispine.AudioStream
}

type MergeInput struct {
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.22
require (
cloud.google.com/go/pubsub v1.38.0
github.com/Code-Hex/go-generics-cache v1.3.1
github.com/ansel1/merry v1.5.1
github.com/ansel1/merry/v2 v2.1.2
github.com/bcc-code/bcc-media-platform v0.0.0-20240610143247-2316a26ef460
github.com/cloudevents/sdk-go/v2 v2.15.2
Expand All @@ -20,6 +19,7 @@ require (
github.com/jlaffaye/ftp v0.2.0
github.com/orsinium-labs/enum v1.3.0
github.com/samber/lo v1.38.1
github.com/sashabaranov/go-openai v1.32.2
github.com/sendgrid/sendgrid-go v3.14.0+incompatible
github.com/stretchr/testify v1.9.0
github.com/teamwork/reload v1.4.2
Expand All @@ -43,7 +43,6 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
modernc.org/libc v1.24.1 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.7.2 // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/ansel1/merry v1.5.0/go.mod h1:wUy/yW0JX0ix9GYvUbciq+bi3jW/vlKPlbpI7qdZpOw=
github.com/ansel1/merry v1.5.1 h1:/MlZd3Irx2HQsUlOcXTTYev7N1t1Rsdnxwg6xkOVJp4=
github.com/ansel1/merry v1.5.1/go.mod h1:wUy/yW0JX0ix9GYvUbciq+bi3jW/vlKPlbpI7qdZpOw=
github.com/ansel1/merry/v2 v2.1.2 h1:r/qaM2l3UMtMSS12PH8weJ7LpqyIo39ODs7a3YVIRfc=
github.com/ansel1/merry/v2 v2.1.2/go.mod h1:4p/FFyQbCgqlDbseWOVQaL5USpgkE9sr5xh4V6Ry0JU=
Expand Down Expand Up @@ -1231,6 +1230,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb
github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8=
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/sashabaranov/go-openai v1.32.2 h1:8z9PfYaLPbRzmJIYpwcWu6z3XU8F+RwVMF1QRSeSF2M=
github.com/sashabaranov/go-openai v1.32.2/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sendgrid/rest v2.6.9+incompatible h1:1EyIcsNdn9KIisLW50MKwmSRSK+ekueiEMJ7NEoxJo0=
github.com/sendgrid/rest v2.6.9+incompatible/go.mod h1:kXX7q3jZtJXK5c5qK83bSGMdV6tsOE70KbHoqJls4lE=
Expand Down
30 changes: 30 additions & 0 deletions language_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Language struct {
MU2ChannelStart int
MU2ChannelCount int
RelatedMBFieldID string
SoftronStartCh int
}

type LanguageList []Language
Expand Down Expand Up @@ -123,6 +124,7 @@ var languages = LanguageList{
MU2ChannelStart: 1,
MU1ChannelCount: 2,
MU2ChannelCount: 2,
SoftronStartCh: 0,
RelatedMBFieldID: "portal_mf184670",
},
{
Expand All @@ -137,6 +139,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 2,
MU2ChannelCount: 0,
SoftronStartCh: 2,
RelatedMBFieldID: "portal_mf31408",
},
{
Expand All @@ -151,6 +154,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 2,
MU2ChannelCount: 0,
SoftronStartCh: 4,
RelatedMBFieldID: "portal_mf93393",
},
{
Expand All @@ -165,6 +169,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 2,
MU2ChannelCount: 0,
SoftronStartCh: 6,
RelatedMBFieldID: "portal_mf442906",
},
{
Expand All @@ -179,6 +184,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 1,
MU2ChannelCount: 0,
SoftronStartCh: 8,
RelatedMBFieldID: "portal_mf903178",
},
{
Expand All @@ -193,6 +199,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 1,
MU2ChannelCount: 0,
SoftronStartCh: 10,
RelatedMBFieldID: "portal_mf831437",
},
{
Expand All @@ -207,6 +214,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 1,
MU2ChannelCount: 0,
SoftronStartCh: 12,
RelatedMBFieldID: "portal_mf683496",
},
{
Expand All @@ -221,6 +229,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 1,
MU2ChannelCount: 0,
SoftronStartCh: 14,
RelatedMBFieldID: "portal_mf307547",
},
{
Expand All @@ -235,6 +244,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 1,
MU2ChannelCount: 0,
SoftronStartCh: 16,
RelatedMBFieldID: "portal_mf736581",
},
{
Expand All @@ -249,6 +259,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 1,
MU2ChannelCount: 0,
SoftronStartCh: 18,
RelatedMBFieldID: "portal_mf319181",
},
{
Expand All @@ -263,6 +274,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 1,
MU2ChannelCount: 0,
SoftronStartCh: 20,
RelatedMBFieldID: "portal_mf351607",
},
{
Expand All @@ -277,6 +289,7 @@ var languages = LanguageList{
MU2ChannelStart: -1,
MU1ChannelCount: 1,
MU2ChannelCount: 0,
SoftronStartCh: 22,
RelatedMBFieldID: "portal_mf299396",
},
{
Expand All @@ -291,6 +304,7 @@ var languages = LanguageList{
MU2ChannelStart: 3,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 24,
RelatedMBFieldID: "portal_mf176737",
},
{
Expand All @@ -305,6 +319,7 @@ var languages = LanguageList{
MU2ChannelStart: 4,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 26,
RelatedMBFieldID: "portal_mf122460",
},
{
Expand All @@ -319,6 +334,7 @@ var languages = LanguageList{
MU2ChannelStart: 5,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 28,
RelatedMBFieldID: "portal_mf384324",
},
{
Expand All @@ -333,6 +349,7 @@ var languages = LanguageList{
MU2ChannelStart: 6,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 30,
RelatedMBFieldID: "portal_mf223187",
},
{
Expand All @@ -347,6 +364,7 @@ var languages = LanguageList{
MU2ChannelStart: 7,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 32,
RelatedMBFieldID: "portal_mf890483",
},
{
Expand All @@ -361,6 +379,7 @@ var languages = LanguageList{
MU2ChannelStart: 8,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 34,
RelatedMBFieldID: "portal_mf848898",
},
{
Expand All @@ -375,6 +394,7 @@ var languages = LanguageList{
MU2ChannelStart: 9,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 36,
RelatedMBFieldID: "portal_mf162929",
},
{
Expand All @@ -389,6 +409,7 @@ var languages = LanguageList{
MU2ChannelStart: 10,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 38,
RelatedMBFieldID: "portal_mf961978",
},
{
Expand All @@ -403,6 +424,7 @@ var languages = LanguageList{
MU2ChannelStart: 11,
MU1ChannelCount: 0,
MU2ChannelCount: 1,
SoftronStartCh: 40,
RelatedMBFieldID: "portal_mf436337",
},
{
Expand All @@ -415,6 +437,7 @@ var languages = LanguageList{
ReaperChannel: 22,
MU1ChannelStart: -1,
MU2ChannelStart: -1,
SoftronStartCh: 42,
RelatedMBFieldID: "portal_mf954584",
},
{
Expand All @@ -427,6 +450,7 @@ var languages = LanguageList{
ReaperChannel: 23,
MU1ChannelStart: -1,
MU2ChannelStart: -1,
SoftronStartCh: 44,
RelatedMBFieldID: "portal_mf855789",
},
{
Expand All @@ -439,6 +463,7 @@ var languages = LanguageList{
ReaperChannel: 24,
MU1ChannelStart: -1,
MU2ChannelStart: -1,
SoftronStartCh: 48,
RelatedMBFieldID: "portal_mf355364",
},
{
Expand All @@ -451,6 +476,7 @@ var languages = LanguageList{
ReaperChannel: 25,
MU1ChannelStart: -1,
MU2ChannelStart: -1,
SoftronStartCh: 50,
RelatedMBFieldID: "portal_mf621489",
},
{
Expand All @@ -463,6 +489,7 @@ var languages = LanguageList{
ReaperChannel: 26,
MU1ChannelStart: -1,
MU2ChannelStart: -1,
SoftronStartCh: 52,
RelatedMBFieldID: "portal_mf447219",
},
{
Expand All @@ -476,6 +503,7 @@ var languages = LanguageList{
MU1ChannelStart: -1,
MU2ChannelStart: -1,
RelatedMBFieldID: "",
SoftronStartCh: 54,
},
{
LanguageNumber: 99,
Expand All @@ -488,6 +516,7 @@ var languages = LanguageList{
MU1ChannelStart: -1,
MU2ChannelStart: -1,
RelatedMBFieldID: "",
SoftronStartCh: 0,
},
{
LanguageNumber: 100,
Expand All @@ -500,5 +529,6 @@ var languages = LanguageList{
MU1ChannelStart: -2,
MU2ChannelStart: -2,
RelatedMBFieldID: "",
SoftronStartCh: 0,
},
}
2 changes: 1 addition & 1 deletion services/transcode/audio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Test_Audio(t *testing.T) {

func Test_AudioSplit_Stereo(t *testing.T) {
tempDstPath := paths.MustParse("./testdata/test" + t.Name() + ".wav")
testutils.GenerateStreoAudioFile(tempDstPath, 10)
testutils.GenerateMultichannelAudioFile(tempDstPath, 2, 10)

p, stop := printProgress()
defer close(stop)
Expand Down
Loading

0 comments on commit ca92dd2

Please sign in to comment.