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.

Add hide-duplicates setting

+69 -4
+22 -2
src/Applications/UI/Kit.elm
··· 1 - module UI.Kit exposing (ButtonType(..), button, buttonFocus, buttonLink, buttonWithColor, buttonWithOptions, canister, centeredContent, colorKit, colors, defaultFontFamilies, h1, h2, h3, headerFontFamilies, inlineIcon, inputFocus, insulationWidth, intro, label, link, logoBackdrop, navFocus, receptacle, select, textArea, textField, textFocus, vessel) 1 + module UI.Kit exposing (ButtonType(..), button, buttonFocus, buttonLink, buttonWithColor, buttonWithOptions, canister, centeredContent, checkbox, colorKit, colors, defaultFontFamilies, h1, h2, h3, headerFontFamilies, inlineIcon, inputFocus, insulationWidth, intro, label, link, logoBackdrop, navFocus, receptacle, select, textArea, textField, textFocus, vessel) 2 2 3 3 import Chunky exposing (..) 4 4 import Color ··· 6 6 import Css exposing (deg, em, none, num, pct, px, solid, url, zero) 7 7 import Css.Global 8 8 import Html.Styled as Html exposing (Html) 9 - import Html.Styled.Attributes exposing (css, href, style) 9 + import Html.Styled.Attributes exposing (checked, css, href, style, type_) 10 10 import Html.Styled.Events exposing (onClick, onInput) 11 11 import Material.Icons.Hardware as Icons 12 + import Material.Icons.Toggle as Icons 12 13 import Svg 13 14 import Tachyons.Classes as T 14 15 ··· 271 272 ] 272 273 273 274 275 + checkbox : { checked : Bool, toggleMsg : msg } -> Html msg 276 + checkbox opts = 277 + brick 278 + [ css checkboxStyles, onClick opts.toggleMsg ] 279 + [ T.dib, T.pointer, T.relative ] 280 + [ if opts.checked then 281 + Html.fromUnstyled (Icons.check_box colors.text 22) 282 + 283 + else 284 + Html.fromUnstyled (Icons.check_box_outline_blank colors.text 22) 285 + ] 286 + 287 + 274 288 h1 : String -> Html msg 275 289 h1 text = 276 290 slab ··· 476 490 [ Css.borderColor (Color.toElmCssColor buttonColor) 477 491 , Css.color (Color.toElmCssColor buttonColor) 478 492 , buttonFocus 493 + ] 494 + 495 + 496 + checkboxStyles : List Css.Style 497 + checkboxStyles = 498 + [ Css.left (Css.px -3) 479 499 ] 480 500 481 501
+9
src/Applications/UI/Settings.elm
··· 14 14 import UI.Page 15 15 import UI.Settings.ImportExport 16 16 import UI.Settings.Page as Settings exposing (..) 17 + import UI.Tracks.Core 17 18 18 19 19 20 ··· 84 85 ) 85 86 UI.Backdrop.options 86 87 ) 88 + 89 + -- Duplicates 90 + ------------- 91 + , chunk [ T.mb3, T.mt4 ] [ UI.Kit.label [] "Hide Duplicates" ] 92 + , UI.Kit.checkbox 93 + { checked = model.tracks.hideDuplicates 94 + , toggleMsg = UI.Core.TracksMsg UI.Tracks.Core.ToggleHideDuplicates 95 + } 87 96 ] 88 97 ]
+7
src/Applications/UI/Tracks.elm
··· 49 49 , enabledSourceIds = [] 50 50 , favourites = [] 51 51 , favouritesOnly = False 52 + , hideDuplicates = False 52 53 , infiniteList = InfiniteList.init 53 54 , nowPlaying = Nothing 54 55 , scene = List ··· 120 121 { model | sortBy = property, sortDirection = sortDir } 121 122 |> reviseCollection arrange 122 123 |> N5.addReply SaveEnclosedUserData 124 + 125 + ToggleHideDuplicates -> 126 + { model | hideDuplicates = not model.hideDuplicates } 127 + |> reviseCollection arrange 128 + |> N5.addReply SaveSettings 123 129 124 130 ----------------------------------------- 125 131 -- Collection ··· 233 239 ( { enabledSourceIds = model.enabledSourceIds 234 240 , favourites = model.favourites 235 241 , favouritesOnly = model.favouritesOnly 242 + , hideDuplicates = model.hideDuplicates 236 243 , nowPlaying = model.nowPlaying 237 244 , searchResults = model.searchResults 238 245 , sortBy = model.sortBy
+2
src/Applications/UI/Tracks/Core.elm
··· 15 15 , enabledSourceIds : List String 16 16 , favourites : List Favourite 17 17 , favouritesOnly : Bool 18 + , hideDuplicates : Bool 18 19 , infiniteList : InfiniteList.Model 19 20 , nowPlaying : Maybe IdentifiedTrack 20 21 , scene : Scene ··· 37 38 | SetEnabledSourceIds (List String) 38 39 | SetNowPlaying (Maybe IdentifiedTrack) 39 40 | SortBy SortBy 41 + | ToggleHideDuplicates 40 42 ----------------------------------------- 41 43 -- Collection 42 44 -----------------------------------------
+3 -1
src/Applications/UI/UserData.elm
··· 45 45 46 46 47 47 gatherSettings : UI.Core.Model -> Settings 48 - gatherSettings { backdrop } = 48 + gatherSettings { backdrop, tracks } = 49 49 { backgroundImage = backdrop.chosen 50 + , hideDuplicates = tracks.hideDuplicates 50 51 } 51 52 52 53 ··· 116 117 | collection = { emptyCollection | untouched = data.tracks } 117 118 , enabledSourceIds = Sources.enabledSourceIds data.sources 118 119 , favourites = data.favourites 120 + , hideDuplicates = Maybe.unwrap False .hideDuplicates data.settings 119 121 } 120 122 121 123 addReplyIfNecessary =
+6 -1
src/Library/Authentication.elm
··· 42 42 43 43 type alias Settings = 44 44 { backgroundImage : Maybe String 45 + , hideDuplicates : Bool 45 46 } 46 47 47 48 ··· 150 151 [ ( "backgroundImage" 151 152 , Maybe.unwrap Json.Encode.null Json.Encode.string settings.backgroundImage 152 153 ) 154 + , ( "hideDuplicates" 155 + , Json.Encode.bool settings.hideDuplicates 156 + ) 153 157 ] 154 158 155 159 ··· 165 169 settingsDecoder : Json.Decoder Settings 166 170 settingsDecoder = 167 171 Json.succeed Settings 168 - |> required "backgroundImage" (Json.maybe Json.string) 172 + |> optional "backgroundImage" (Json.maybe Json.string) Nothing 173 + |> optional "hideDuplicates" Json.bool False
+1
src/Library/Tracks.elm
··· 85 85 { enabledSourceIds : List String 86 86 , favourites : List Favourite 87 87 , favouritesOnly : Bool 88 + , hideDuplicates : Bool 88 89 , nowPlaying : Maybe IdentifiedTrack 89 90 , searchResults : Maybe (List String) 90 91 , sortBy : SortBy
+19
src/Library/Tracks/Collection/Internal/Harvest.elm
··· 49 49 in 50 50 harvested 51 51 |> List.filter theFilter 52 + |> (if deps.hideDuplicates then 53 + List.foldr 54 + (\( i, t ) ( seen, acc ) -> 55 + let 56 + s = 57 + String.toLower (t.tags.artist ++ "/" ++ t.tags.title) 58 + in 59 + if List.member s seen then 60 + ( seen, acc ) 61 + 62 + else 63 + ( s :: seen, ( i, t ) :: acc ) 64 + ) 65 + ( [], [] ) 66 + >> Tuple.second 67 + 68 + else 69 + identity 70 + ) 52 71 |> List.indexedMap (\idx tup -> Tuple.mapFirst (\i -> { i | indexInList = idx }) tup) 53 72 |> (\h -> { collection | harvested = h }) 54 73 |> (\c -> ( deps, c ))