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

Configure Feed

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

Fully implement grouping

+115 -33
+26 -10
src/Applications/UI/Tracks.elm
··· 80 80 Reply replies -> 81 81 returnRepliesWithModel model replies 82 82 83 - ShowTrackMenu track mouseEvent -> 84 - [ track ] 85 - |> ShowTracksContextMenu (Coordinates.fromTuple mouseEvent.clientPos) 86 - |> returnReplyWithModel model 87 - 88 - ShowViewMenu grouping mouseEvent -> 89 - grouping 90 - |> ShowTracksViewMenu (Coordinates.fromTuple mouseEvent.clientPos) 91 - |> returnReplyWithModel model 92 - 93 83 ScrollToNowPlaying -> 94 84 let 95 85 -- The index identifier might be out-of-date, ··· 219 209 { model | favouritesOnly = not model.favouritesOnly } 220 210 |> reviseCollection harvest 221 211 |> addReply SaveEnclosedUserData 212 + 213 + ----------------------------------------- 214 + -- Groups 215 + ----------------------------------------- 216 + DisableGrouping -> 217 + reviseCollection 218 + arrange 219 + { model | grouping = Nothing } 220 + 221 + GroupBy grouping -> 222 + reviseCollection 223 + arrange 224 + { model | grouping = Just grouping } 225 + 226 + ----------------------------------------- 227 + -- Menus 228 + ----------------------------------------- 229 + ShowTrackMenu track mouseEvent -> 230 + [ track ] 231 + |> ShowTracksContextMenu (Coordinates.fromTuple mouseEvent.clientPos) 232 + |> returnReplyWithModel model 233 + 234 + ShowViewMenu grouping mouseEvent -> 235 + grouping 236 + |> ShowTracksViewMenu (Coordinates.fromTuple mouseEvent.clientPos) 237 + |> returnReplyWithModel model 222 238 223 239 ----------------------------------------- 224 240 -- Search
+17 -2
src/Applications/UI/Tracks/ContextMenu.elm
··· 9 9 import Tracks exposing (Grouping(..), IdentifiedTrack) 10 10 import UI.Core exposing (Msg(..)) 11 11 import UI.Queue.Core as Queue 12 + import UI.Tracks.Core as Tracks 12 13 13 14 14 15 ··· 53 54 Item 54 55 { icon = ifThenElse isActive Icons.clear Icons.terrain 55 56 , label = "Group by processing date" 56 - , msg = Bypass 57 57 , active = isActive 58 + 59 + -- 60 + , msg = 61 + if isActive then 62 + TracksMsg Tracks.DisableGrouping 63 + 64 + else 65 + TracksMsg (Tracks.GroupBy AddedOnGroups) 58 66 } 59 67 60 68 ··· 62 70 Item 63 71 { icon = ifThenElse isActive Icons.clear Icons.terrain 64 72 , label = "Group by track year" 65 - , msg = Bypass 66 73 , active = isActive 74 + 75 + -- 76 + , msg = 77 + if isActive then 78 + TracksMsg Tracks.DisableGrouping 79 + 80 + else 81 + TracksMsg (Tracks.GroupBy TrackYearGroups) 67 82 }
+10 -2
src/Applications/UI/Tracks/Core.elm
··· 39 39 | ScrollToNowPlaying 40 40 | SetEnabledSourceIds (List String) 41 41 | SetNowPlaying (Maybe IdentifiedTrack) 42 - | ShowTrackMenu IdentifiedTrack Mouse.Event 43 - | ShowViewMenu (Maybe Grouping) Mouse.Event 44 42 | SortBy SortBy 45 43 | ToggleHideDuplicates 46 44 ----------------------------------------- ··· 54 52 ----------------------------------------- 55 53 | ToggleFavourite Int 56 54 | ToggleFavouritesOnly 55 + ----------------------------------------- 56 + -- Groups 57 + ----------------------------------------- 58 + | DisableGrouping 59 + | GroupBy Grouping 60 + ----------------------------------------- 61 + -- Menus 62 + ----------------------------------------- 63 + | ShowTrackMenu IdentifiedTrack Mouse.Event 64 + | ShowViewMenu (Maybe Grouping) Mouse.Event 57 65 ----------------------------------------- 58 66 -- Search 59 67 -----------------------------------------
+1 -6
src/Applications/UI/Tracks/Scene/List.elm
··· 304 304 [ Html.fromUnstyled (Icons.terrain 16 Inherit) ] 305 305 , inline 306 306 [ T.dib, T.pl2, T.v_mid ] 307 - (if String.contains "1970" groupName then 308 - [ text "AGES AGO" ] 309 - 310 - else 311 - [ text groupName ] 312 - ) 307 + [ text groupName ] 313 308 ] 314 309 315 310
+61 -13
src/Library/Tracks/Collection/Internal/Arrange.elm
··· 1 1 module Tracks.Collection.Internal.Arrange exposing (arrange) 2 2 3 3 import Dict exposing (Dict) 4 + import Maybe.Extra as Maybe 4 5 import Time 5 6 import Time.Ext as Time 6 7 import Tracks exposing (..) ··· 18 19 ( deps, groupByInsertedAt deps collection ) 19 20 20 21 Just TrackYearGroups -> 21 - -- TODO 22 - collection.identified 23 - |> Sorting.sort deps.sortBy deps.sortDirection 24 - |> (\x -> { collection | arranged = x }) 25 - |> (\x -> ( deps, x )) 22 + ( deps, groupByYear deps collection ) 26 23 27 24 Nothing -> 28 25 collection.identified ··· 35 32 -- GROUPING 36 33 37 34 35 + setIndexInGroup : Int -> IdentifiedTrack -> IdentifiedTrack 36 + setIndexInGroup idx ( i, t ) = 37 + ( { i | group = Maybe.map (\g -> { g | index = idx }) i.group } 38 + , t 39 + ) 40 + 41 + 42 + 43 + -- GROUPING ░░ INSERTED AT 44 + 45 + 38 46 groupByInsertedAt : CollectionDependencies -> Collection -> Collection 39 47 groupByInsertedAt deps collection = 40 48 collection.identified 41 49 |> List.foldl groupByInsertedAt_ Dict.empty 42 50 |> Dict.values 43 51 |> List.reverse 44 - |> List.map (Sorting.sort deps.sortBy deps.sortDirection >> List.indexedMap setIndexInGroup) 45 - |> List.concat 52 + |> List.concatMap (Sorting.sort deps.sortBy deps.sortDirection >> List.indexedMap setIndexInGroup) 46 53 |> (\arranged -> { collection | arranged = arranged }) 47 54 48 55 ··· 82 89 |> Time.monthNumber 83 90 |> String.fromInt 84 91 |> String.padLeft 2 '0' 85 - |> (\m -> m ++ " / " ++ String.fromInt year) 92 + |> (\m -> 93 + m ++ " / " ++ String.fromInt year 94 + ) 95 + |> (\y -> 96 + if String.contains "1970" y then 97 + "AGES AGO" 86 98 99 + else 100 + y 101 + ) 87 102 88 - setIndexInGroup : Int -> IdentifiedTrack -> IdentifiedTrack 89 - setIndexInGroup idx ( i, t ) = 90 - ( { i | group = Maybe.map (\g -> { g | index = idx }) i.group } 91 - , t 92 - ) 103 + 104 + 105 + -- GROUPING ░░ YEAR 106 + 107 + 108 + groupByYear : CollectionDependencies -> Collection -> Collection 109 + groupByYear deps collection = 110 + collection.identified 111 + |> List.foldl groupByYear_ Dict.empty 112 + |> Dict.values 113 + |> List.reverse 114 + |> List.concatMap (Sorting.sort deps.sortBy deps.sortDirection >> List.indexedMap setIndexInGroup) 115 + |> (\arranged -> { collection | arranged = arranged }) 116 + 117 + 118 + groupByYear_ : IdentifiedTrack -> Dict Int (List IdentifiedTrack) -> Dict Int (List IdentifiedTrack) 119 + groupByYear_ ( i, t ) = 120 + let 121 + group = 122 + { name = Maybe.unwrap "0000 - Unknown" String.fromInt t.tags.year 123 + , index = 0 124 + } 125 + 126 + item = 127 + ( { i | group = Just group } 128 + , t 129 + ) 130 + in 131 + Dict.update 132 + (Maybe.withDefault 0 t.tags.year) 133 + (\maybeList -> 134 + case maybeList of 135 + Just list -> 136 + Just (item :: list) 137 + 138 + Nothing -> 139 + Just [ item ] 140 + )