A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Show processing progress on sources screen

+99 -14
+1
CHANGELOG.md
··· 6 6 - **Automatically prepend `_dnslink.` when using a domain name with an IPFS source** 7 7 - Explain more things in the UI and on the about page 8 8 - Improve onboarding 9 + - Show processing progress on sources screen 9 10 - Show the amount of tracks you have 10 11 - Show time and duration of the current track after hovering over the progress bar for a while 11 12 - Slightly improved tap/click events on tracks
+20 -1
src/Applications/Brain/Sources/Processing.elm
··· 168 168 -------- 169 169 , case List.isEmpty (List.filter Maybe.isJust tagsContext.receivedTags) of 170 170 True -> 171 - [] 171 + let 172 + progress = 173 + [ ( "progress", Encode.float 0.05 ) 174 + , ( "sourceId", Encode.string tagsContext.sourceId ) 175 + ] 176 + in 177 + [ GiveUI Alien.ReportProcessingProgress (Encode.object progress) 178 + ] 172 179 173 180 False -> 174 181 let ··· 176 183 tagsContext 177 184 |> tracksFromTagsContext 178 185 |> List.map (\track -> { track | insertedAt = model.currentTime }) 186 + 187 + amountLeft = 188 + List.length tagsContext.nextFilePaths 189 + 190 + progressPercentage = 191 + 0.05 + 0.95 * (1 - toFloat amountLeft / toFloat tagsContext.amount) 192 + 193 + progress = 194 + [ ( "progress", Encode.float progressPercentage ) 195 + , ( "sourceId", Encode.string tagsContext.sourceId ) 196 + ] 179 197 in 180 198 [ GiveUI Alien.AddTracks (Encode.list Tracks.Encoding.encodeTrack tracksToAdd) 199 + , GiveUI Alien.ReportProcessingProgress (Encode.object progress) 181 200 , AddTracks tracksToAdd 182 201 ] 183 202 )
+2 -1
src/Applications/Brain/Sources/Processing/Common.elm
··· 52 52 53 53 contextToTagsContext : Context -> ContextForTags 54 54 contextToTagsContext context = 55 - { nextFilePaths = context.filePaths 55 + { amount = List.length context.filePaths 56 + , nextFilePaths = context.filePaths 56 57 , receivedFilePaths = [] 57 58 , receivedTags = [] 58 59 , sourceId = context.source.id
+4 -3
src/Applications/Brain/Sources/Processing/Steps.elm
··· 43 43 {-| How much tags do we want to process 44 44 before we send them back to Elm. 45 45 46 - eg. After we got the tags for 50 tracks, 46 + eg. After we got the tags for 20 tracks, 47 47 we store these and continue with the rest. 48 48 49 49 -} 50 50 tagsBatchSize : Int 51 51 tagsBatchSize = 52 - 50 52 + 20 53 53 54 54 55 55 ··· 103 103 List.splitAt tagsBatchSize tagsCtx.nextFilePaths 104 104 105 105 newTagsCtx = 106 - { nextFilePaths = nextFiles 106 + { amount = tagsCtx.amount 107 + , nextFilePaths = nextFiles 107 108 , receivedFilePaths = filesToProcess 108 109 , receivedTags = [] 109 110 , sourceId = source.id
+5 -2
src/Applications/UI.elm
··· 1415 1415 1416 1416 newSources = 1417 1417 { sources 1418 - | isProcessing = List.map .id sourcesToProcess 1418 + | isProcessing = List.map (\{ id } -> ( id, 0 )) sourcesToProcess 1419 1419 , processingError = Nothing 1420 1420 , processingNotificationId = Just notificationId 1421 1421 } ··· 1791 1791 Just Alien.ReportProcessingError -> 1792 1792 SourcesMsg (Sources.ReportProcessingError event.data) 1793 1793 1794 + Just Alien.ReportProcessingProgress -> 1795 + SourcesMsg (Sources.ReportProcessingProgress event.data) 1796 + 1794 1797 Just Alien.SearchTracks -> 1795 1798 TracksMsg (Tracks.SetSearchResults event.data) 1796 1799 ··· 1964 1967 [ { amountOfSources = List.length model.sources.collection 1965 1968 , bgColor = model.backdrop.bgColor 1966 1969 , isOnIndexPage = model.page == Page.Index 1967 - , sourceIdsBeingProcessed = model.sources.isProcessing 1970 + , sourceIdsBeingProcessed = List.map Tuple.first model.sources.isProcessing 1968 1971 , viewport = model.viewport 1969 1972 } 1970 1973 |> Tracks.view model.tracks
+63 -6
src/Applications/UI/Sources.elm
··· 5 5 import Conditional exposing (ifThenElse) 6 6 import Coordinates exposing (Coordinates) 7 7 import Dict.Ext as Dict 8 + import Html as UnstyledHtml 9 + import Html.Attributes as UnstyledHtml 8 10 import Html.Events.Extra.Mouse as Mouse 9 11 import Html.Styled as Html exposing (Html, fromUnstyled, text) 10 12 import Html.Styled.Attributes exposing (href) 11 13 import Json.Decode as Json 14 + import List.Extra as List 12 15 import Material.Icons exposing (Coloring(..)) 13 16 import Material.Icons.Action as Icons 14 17 import Material.Icons.Alert as Icons ··· 40 43 { collection : List Source 41 44 , currentTime : Time.Posix 42 45 , form : Form.Model 43 - , isProcessing : List String 46 + , isProcessing : List ( String, Float ) 44 47 , processingError : Maybe { error : String, sourceId : String } 45 48 , processingNotificationId : Maybe Int 46 49 } ··· 67 70 | FinishedProcessing 68 71 | Process 69 72 | ReportProcessingError Json.Value 73 + | ReportProcessingProgress Json.Value 70 74 | StopProcessing 71 75 ----------------------------------------- 72 76 -- Children ··· 99 103 |> Return.repliesWithModel { model | isProcessing = [] } 100 104 101 105 FinishedProcessingSource sourceId -> 102 - return { model | isProcessing = List.filter ((/=) sourceId) model.isProcessing } 106 + return { model | isProcessing = List.filter (Tuple.first >> (/=) sourceId) model.isProcessing } 103 107 104 108 Process -> 105 109 model ··· 128 132 129 133 Err _ -> 130 134 "Could not decode processing error" 135 + |> ShowStickyErrorNotification 136 + |> returnReplyWithModel model 137 + 138 + ReportProcessingProgress json -> 139 + case 140 + Json.decodeValue 141 + (Json.map2 142 + (\p s -> 143 + { progress = p 144 + , sourceId = s 145 + } 146 + ) 147 + (Json.field "progress" Json.float) 148 + (Json.field "sourceId" Json.string) 149 + ) 150 + json 151 + of 152 + Ok { progress, sourceId } -> 153 + model.isProcessing 154 + |> List.map 155 + (\( sid, pro ) -> 156 + ifThenElse (sid == sourceId) 157 + ( sid, progress ) 158 + ( sid, pro ) 159 + ) 160 + |> (\isProcessing -> 161 + { model | isProcessing = isProcessing } 162 + ) 163 + |> return 164 + 165 + Err _ -> 166 + "Could not decode processing progress" 131 167 |> ShowStickyErrorNotification 132 168 |> returnReplyWithModel model 133 169 ··· 389 425 |> UI.Kit.intro 390 426 391 427 392 - sourceActions : List String -> Maybe { error : String, sourceId : String } -> Source -> List (UI.List.Action Msg) 428 + sourceActions : List ( String, Float ) -> Maybe { error : String, sourceId : String } -> Source -> List (UI.List.Action Msg) 393 429 sourceActions isProcessing processingError source = 394 430 List.append 395 - (case ( List.member source.id isProcessing, processingError ) of 396 - ( True, _ ) -> 431 + (case ( List.find (Tuple.first >> (==) source.id) isProcessing, processingError ) of 432 + ( Just ( _, progress ), _ ) -> 397 433 [ { color = Inherit 434 + , icon = 435 + \_ _ -> 436 + if progress < 0.05 then 437 + UnstyledHtml.span 438 + [ UnstyledHtml.class "div fw4 o-50 ph1" ] 439 + [ UnstyledHtml.text "Building File Tree" ] 440 + 441 + else 442 + progress 443 + |> (*) 100 444 + |> round 445 + |> String.fromInt 446 + |> (\s -> s ++ "%") 447 + |> UnstyledHtml.text 448 + |> List.singleton 449 + |> UnstyledHtml.span 450 + [ UnstyledHtml.class "div fw4 o-50 ph1" ] 451 + , msg = Nothing 452 + , title = "" 453 + } 454 + , { color = Inherit 398 455 , icon = Icons.sync 399 456 , msg = Nothing 400 457 , title = "Currently processing" 401 458 } 402 459 ] 403 460 404 - ( False, Just { error, sourceId } ) -> 461 + ( Nothing, Just { error, sourceId } ) -> 405 462 if sourceId == source.id then 406 463 [ { color = Color UI.Kit.colors.error 407 464 , icon = Icons.error_outline
+2
src/Library/Alien.elm
··· 71 71 | NotAuthenticated 72 72 | RemoveTracksByPath 73 73 | ReportProcessingError 74 + | ReportProcessingProgress 74 75 | UpdateSourceData 75 76 76 77 ··· 126 127 , ( "NOT_AUTHENTICATED", NotAuthenticated ) 127 128 , ( "REMOVE_TRACKS_BY_PATH", RemoveTracksByPath ) 128 129 , ( "REPORT_PROCESSING_ERROR", ReportProcessingError ) 130 + , ( "REPORT_PROCESSING_PROGRESS", ReportProcessingProgress ) 129 131 , ( "UPDATE_SOURCE_DATA", UpdateSourceData ) 130 132 ] 131 133
+2 -1
src/Library/Sources/Processing.elm
··· 55 55 56 56 57 57 type alias ContextForTags = 58 - { nextFilePaths : List String 58 + { amount : Int 59 + , nextFilePaths : List String 59 60 , receivedFilePaths : List String 60 61 , receivedTags : List (Maybe Tags) 61 62 , sourceId : String