This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve error messages * Add `subtitlesTracks` event
- Loading branch information
Showing
17 changed files
with
208 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module Jawa.Event.SubtitlesTracks exposing (SubtitlesTracks, decoder, encode, tag) | ||
|
||
{-| | ||
@docs SubtitlesTracks, decoder, encode, tag | ||
-} | ||
|
||
import Jawa.SubtitleTrack | ||
import Json.Decode | ||
import Json.Encode | ||
|
||
|
||
{-| This event is not documented. | ||
-} | ||
type alias SubtitlesTracks = | ||
{ tracks : List Jawa.SubtitleTrack.SubtitleTrack | ||
} | ||
|
||
|
||
{-| A JSON decoder. | ||
-} | ||
decoder : Json.Decode.Decoder SubtitlesTracks | ||
decoder = | ||
Json.Decode.map SubtitlesTracks | ||
(Json.Decode.field "tracks" (Json.Decode.list Jawa.SubtitleTrack.decoder)) | ||
|
||
|
||
{-| A JSON encoder. | ||
-} | ||
encode : SubtitlesTracks -> Json.Encode.Value | ||
encode x = | ||
Json.Encode.object | ||
[ ( "tracks", Json.Encode.list Jawa.SubtitleTrack.encode x.tracks ) | ||
] | ||
|
||
|
||
{-| The tag that describes this type. | ||
-} | ||
tag : String | ||
tag = | ||
"subtitlesTracks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module Jawa.SubtitleTrack exposing (SubtitleTrack, decoder, encode) | ||
|
||
{-| | ||
@docs SubtitleTrack, decoder, encode | ||
-} | ||
|
||
import Jawa.Metadata | ||
import Json.Decode | ||
import Json.Encode | ||
|
||
|
||
{-| This type is not documented. | ||
-} | ||
type alias SubtitleTrack = | ||
{ data : List Jawa.Metadata.Metadata | ||
, default : Bool | ||
, id : String | ||
, kind : String | ||
, label : String | ||
, name : String | ||
, subtitleTrack : Jawa.Metadata.Metadata | ||
} | ||
|
||
|
||
{-| A JSON decoder. | ||
-} | ||
decoder : Json.Decode.Decoder SubtitleTrack | ||
decoder = | ||
Json.Decode.map7 SubtitleTrack | ||
(Json.Decode.field "data" (Json.Decode.list Jawa.Metadata.decoder)) | ||
(Json.Decode.field "default" Json.Decode.bool) | ||
(Json.Decode.field "_id" Json.Decode.string) | ||
(Json.Decode.field "kind" Json.Decode.string) | ||
(Json.Decode.field "label" Json.Decode.string) | ||
(Json.Decode.field "name" Json.Decode.string) | ||
(Json.Decode.field "subtitleTrack" Jawa.Metadata.decoder) | ||
|
||
|
||
{-| A JSON encoder. | ||
-} | ||
encode : SubtitleTrack -> Json.Encode.Value | ||
encode x = | ||
Json.Encode.object | ||
[ ( "data", Json.Encode.list Jawa.Metadata.encode x.data ) | ||
, ( "default", Json.Encode.bool x.default ) | ||
, ( "_id", Json.Encode.string x.id ) | ||
, ( "kind", Json.Encode.string x.kind ) | ||
, ( "label", Json.Encode.string x.label ) | ||
, ( "name", Json.Encode.string x.name ) | ||
, ( "subtitleTrack", Jawa.Metadata.encode x.subtitleTrack ) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Jawa.Event.SubtitlesTracksTest exposing | ||
( fuzzer | ||
, test | ||
) | ||
|
||
import Fuzz | ||
import Jawa.Event.SubtitlesTracks | ||
import Jawa.Extra.Test | ||
import Jawa.SubtitleTrackTest | ||
import Test | ||
|
||
|
||
test : Test.Test | ||
test = | ||
Test.describe "Jawa.Event.SubtitlesTracks" | ||
[ Jawa.Extra.Test.fuzzCodec "round trips" Jawa.Event.SubtitlesTracks.decoder Jawa.Event.SubtitlesTracks.encode fuzzer | ||
, Jawa.Extra.Test.testCodec "works" | ||
Jawa.Event.SubtitlesTracks.decoder | ||
Jawa.Event.SubtitlesTracks.encode | ||
""" { | ||
"tracks": [] | ||
} """ | ||
{ tracks = [] | ||
} | ||
] | ||
|
||
|
||
fuzzer : Fuzz.Fuzzer Jawa.Event.SubtitlesTracks.SubtitlesTracks | ||
fuzzer = | ||
Fuzz.map Jawa.Event.SubtitlesTracks.SubtitlesTracks | ||
(Fuzz.listOfLengthBetween 0 2 Jawa.SubtitleTrackTest.fuzzer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module Jawa.SubtitleTrackTest exposing | ||
( fuzzer | ||
, test | ||
) | ||
|
||
import Fuzz | ||
import Jawa.Extra.Test | ||
import Jawa.Metadata | ||
import Jawa.MetadataTest | ||
import Jawa.SubtitleTrack | ||
import Json.Encode | ||
import Test | ||
|
||
|
||
test : Test.Test | ||
test = | ||
Test.describe "Jawa.SubtitleTrack" | ||
[ Jawa.Extra.Test.fuzzCodec "round trips" Jawa.SubtitleTrack.decoder Jawa.SubtitleTrack.encode fuzzer | ||
, Jawa.Extra.Test.testCodec "works" | ||
Jawa.SubtitleTrack.decoder | ||
Jawa.SubtitleTrack.encode | ||
""" { | ||
"data": [], | ||
"default": false, | ||
"_id": "a", | ||
"kind": "b", | ||
"label": "c", | ||
"name": "d", | ||
"subtitleTrack": {} | ||
} """ | ||
{ data = [] | ||
, default = False | ||
, id = "a" | ||
, kind = "b" | ||
, label = "c" | ||
, name = "d" | ||
, subtitleTrack = Jawa.Metadata.Metadata (Json.Encode.object []) | ||
} | ||
] | ||
|
||
|
||
fuzzer : Fuzz.Fuzzer Jawa.SubtitleTrack.SubtitleTrack | ||
fuzzer = | ||
Fuzz.map7 Jawa.SubtitleTrack.SubtitleTrack | ||
(Fuzz.list Jawa.MetadataTest.fuzzer) | ||
Fuzz.bool | ||
Fuzz.string | ||
Fuzz.string | ||
Fuzz.string | ||
Fuzz.string | ||
Jawa.MetadataTest.fuzzer |