Skip to content

Commit ffcf588

Browse files
encodingcom: Maps the converted file size to a local field
1 parent 4afa607 commit ffcf588

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

media_status.go

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type FormatStatus struct {
4848
AudioCodec string
4949
Destinations []DestinationStatus
5050
Stream []Stream
51+
FileSize string
5152
}
5253

5354
// DestinationStatus represents the status of a given destination.
@@ -166,6 +167,7 @@ func (s *statusJSON) toStruct() StatusResponse {
166167
Output: formatStatus.Output,
167168
VideoCodec: formatStatus.VideoCodec,
168169
Stream: formatStatus.Stream,
170+
FileSize: formatStatus.FileSize,
169171
}
170172

171173
switch dest := formatStatus.Destinations.(type) {
@@ -214,4 +216,5 @@ type formatStatusJSON struct {
214216
VideoCodec string `json:"video_codec"`
215217
Output string `json:"output"`
216218
Stream []Stream `json:"stream"`
219+
FileSize string `json:"convertedsize"`
217220
}

media_status_test.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func (s *S) TestGetStatusSingle(c *check.C) {
1010
server, requests := s.startServer(`
1111
{
1212
"response": {
13-
"job": {
13+
"job": {
1414
"id": "abc123",
1515
"userid": "myuser",
1616
"sourcefile": "http://some.video/file.mp4",
@@ -35,6 +35,7 @@ func (s *S) TestGetStatusSingle(c *check.C) {
3535
"finished": "2015-12-31 21:00:03",
3636
"s3_destination": "https://s3.amazonaws.com/not-really/valid.mp4",
3737
"cf_destination": "https://blablabla.cloudfront.net/not-valid.mp4",
38+
"convertedsize": "65723",
3839
"destination": "s3://mynicebucket",
3940
"destination_status": "Saved"
4041
}
@@ -79,6 +80,7 @@ func (s *S) TestGetStatusSingle(c *check.C) {
7980
FinishDate: expectedFinishDate,
8081
S3Destination: "https://s3.amazonaws.com/not-really/valid.mp4",
8182
CFDestination: "https://blablabla.cloudfront.net/not-valid.mp4",
83+
FileSize: "65723",
8284
Destinations: []DestinationStatus{{Name: "s3://mynicebucket", Status: "Saved"}},
8385
},
8486
},
@@ -122,6 +124,7 @@ func (s *S) TestGetStatusMultiple(c *check.C) {
122124
"finished": "2015-12-31 21:00:03",
123125
"s3_destination": "https://s3.amazonaws.com/not-really/valid.mp4",
124126
"cf_destination": "https://blablabla.cloudfront.net/not-valid.mp4",
127+
"convertedsize": "65724",
125128
"destination": [
126129
null,
127130
"s3://myunclebucket/file.mp4"
@@ -139,6 +142,7 @@ func (s *S) TestGetStatusMultiple(c *check.C) {
139142
"finished": "2015-12-31 21:00:03",
140143
"s3_destination": "https://s3.amazonaws.com/not-really/valid.mp4",
141144
"cf_destination": "https://blablabla.cloudfront.net/not-valid.mp4",
145+
"convertedsize": "65725",
142146
"destination": [
143147
"s3://mynicebucket/file.mp4",
144148
"s3://myunclebucket/file.mp4"
@@ -171,6 +175,7 @@ func (s *S) TestGetStatusMultiple(c *check.C) {
171175
"finished": "2015-12-31 21:00:03",
172176
"s3_destination": "https://s3.amazonaws.com/not-really/valid.mp4",
173177
"cf_destination": "https://blablabla.cloudfront.net/not-valid.mp4",
178+
"convertedsize": "65726",
174179
"destination": [
175180
"s3://mynicebucket/file.mp4",
176181
"s3://myunclebucket/file.mp4"
@@ -221,6 +226,7 @@ func (s *S) TestGetStatusMultiple(c *check.C) {
221226
FinishDate: expectedFinishDate,
222227
S3Destination: "https://s3.amazonaws.com/not-really/valid.mp4",
223228
CFDestination: "https://blablabla.cloudfront.net/not-valid.mp4",
229+
FileSize: "65724",
224230
Destinations: []DestinationStatus{
225231
{Name: "", Status: ""},
226232
{Name: "s3://myunclebucket/file.mp4", Status: "Saved"},
@@ -234,6 +240,7 @@ func (s *S) TestGetStatusMultiple(c *check.C) {
234240
FinishDate: expectedFinishDate,
235241
S3Destination: "https://s3.amazonaws.com/not-really/valid.mp4",
236242
CFDestination: "https://blablabla.cloudfront.net/not-valid.mp4",
243+
FileSize: "65725",
237244
Destinations: []DestinationStatus{
238245
{Name: "s3://mynicebucket/file.mp4", Status: ""},
239246
{Name: "s3://myunclebucket/file.mp4", Status: ""},
@@ -266,6 +273,7 @@ func (s *S) TestGetStatusMultiple(c *check.C) {
266273
FinishDate: expectedFinishDate,
267274
S3Destination: "https://s3.amazonaws.com/not-really/valid.mp4",
268275
CFDestination: "https://blablabla.cloudfront.net/not-valid.mp4",
276+
FileSize: "65726",
269277
Destinations: []DestinationStatus{
270278
{Name: "s3://mynicebucket/file.mp4", Status: "Saved"},
271279
{Name: "s3://myunclebucket/file.mp4", Status: "Saved"},
@@ -320,6 +328,7 @@ func (s *S) TestGetStatusNotExtended(c *check.C) {
320328
Output: "mp4",
321329
VideoCodec: "libx264",
322330
AudioCodec: "dolby_aac",
331+
FileSize: "78544430",
323332
},
324333
},
325334
},

0 commit comments

Comments
 (0)