diff --git a/src/Applications/Brain.elm b/src/Applications/Brain.elm index f9668d44..b39c74bc 100644 --- a/src/Applications/Brain.elm +++ b/src/Applications/Brain.elm @@ -119,6 +119,15 @@ update msg model = , msg = debouncerMsg } + Process { origin, sources } -> + { origin = origin + , sources = sources + , tracks = model.hypaethralUserData.tracks + } + |> Processing.Process + |> ProcessingMsg + |> updateWithModel model + ToCache alienEvent -> alienEvent |> Brain.Ports.toCache @@ -436,9 +445,7 @@ translateAlienData tag data = -- otherwise report an error in the UI. case Json.decodeValue Processing.argumentsDecoder data of Ok arguments -> - arguments - |> Processing.Process - |> ProcessingMsg + Process arguments Err err -> report Alien.ProcessSources (Json.errorToString err) diff --git a/src/Applications/Brain/Core.elm b/src/Applications/Brain/Core.elm index 67385718..7d0b498d 100644 --- a/src/Applications/Brain/Core.elm +++ b/src/Applications/Brain/Core.elm @@ -7,6 +7,7 @@ import Brain.Sources.Processing.Common as Processing import Brain.Tracks as Tracks import Debouncer.Basic as Debouncer exposing (Debouncer) import Json.Decode as Json +import Sources.Processing as Processing @@ -39,6 +40,7 @@ type Msg | Initialize String | NotifyUI Alien.Event | NotSoFast (Debouncer.Msg Msg) + | Process Processing.Arguments | ToCache Alien.Event ----------------------------------------- -- Authentication diff --git a/src/Applications/Brain/Sources/Processing/Common.elm b/src/Applications/Brain/Sources/Processing/Common.elm index 37923c72..03966d7a 100644 --- a/src/Applications/Brain/Sources/Processing/Common.elm +++ b/src/Applications/Brain/Sources/Processing/Common.elm @@ -30,7 +30,7 @@ type alias Model = type Msg - = Process Arguments + = Process { origin : String, sources : List Source, tracks : List Track } | NextInLine ----------------------------------------- -- Steps diff --git a/src/Applications/UI.elm b/src/Applications/UI.elm index a74c5e97..31f01c6a 100644 --- a/src/Applications/UI.elm +++ b/src/Applications/UI.elm @@ -952,8 +952,6 @@ translateReply reply model = return model ProcessSources -> - -- TODO: - -- Don't process disabled sources? let notification = Notifications.stickyWarning "Processing sources …" @@ -974,10 +972,9 @@ translateReply reply model = , Json.Encode.string (Common.urlOrigin model.url) ) , ( "sources" - , Json.Encode.list Sources.Encoding.encode model.sources.collection - ) - , ( "tracks" - , Json.Encode.list Tracks.Encoding.encodeTrack model.tracks.collection.untouched + , model.sources.collection + |> List.filter (.enabled >> (==) True) + |> Json.Encode.list Sources.Encoding.encode ) ] |> Json.Encode.object diff --git a/src/Applications/UI/Authentication.elm b/src/Applications/UI/Authentication.elm index f4181430..6bb00ea0 100644 --- a/src/Applications/UI/Authentication.elm +++ b/src/Applications/UI/Authentication.elm @@ -723,8 +723,7 @@ choiceButton { action, icon, infoLink, isLast, label, outOfOrder } = , T.pv3 , T.tl ] - [ -- TODO: Remove `chunk` + outOfOrder when everything is implemented - chunk + [ chunk [ T.flex , T.items_center diff --git a/src/Library/Sources/Processing.elm b/src/Library/Sources/Processing.elm index 1d2d1522..09dc4099 100644 --- a/src/Library/Sources/Processing.elm +++ b/src/Library/Sources/Processing.elm @@ -16,7 +16,6 @@ type Status type alias Arguments = { origin : String , sources : List Source - , tracks : List Track } diff --git a/src/Library/Sources/Processing/Encoding.elm b/src/Library/Sources/Processing/Encoding.elm index c698cf75..0401f6ea 100644 --- a/src/Library/Sources/Processing/Encoding.elm +++ b/src/Library/Sources/Processing/Encoding.elm @@ -6,7 +6,6 @@ module Sources.Processing.Encoding exposing (argumentsDecoder) import Json.Decode as Decode exposing (Decoder) import Sources.Encoding as Sources import Sources.Processing exposing (Arguments) -import Tracks.Encoding as Tracks @@ -15,7 +14,6 @@ import Tracks.Encoding as Tracks argumentsDecoder : Decoder Arguments argumentsDecoder = - Decode.map3 Arguments + Decode.map2 Arguments (Decode.field "origin" Decode.string) (Decode.field "sources" <| Decode.list Sources.decoder) - (Decode.field "tracks" <| Decode.list Tracks.trackDecoder)