From ce13e7e41ebb91b427d320ee7e94d40bed968e35 Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Sun, 20 Feb 2022 11:57:21 +0100 Subject: [PATCH] =?UTF-8?q?Housekeeping=20=F0=9F=A7=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Applications/Brain.elm | 2 +- .../Brain/Sources/Processing/State.elm | 2 +- src/Applications/Brain/Tracks/State.elm | 2 +- src/Applications/Brain/User/State.elm | 1 + src/Applications/UI.elm | 2 +- src/Applications/UI/Authentication/State.elm | 2 +- src/Applications/UI/Authentication/View.elm | 2 +- src/Applications/UI/ContextMenu.elm | 2 +- src/Applications/UI/DnD.elm | 2 +- src/Applications/UI/Navigation.elm | 4 +-- src/Applications/UI/Playlists/State.elm | 13 ++++--- src/Applications/UI/Queue/Fill.elm | 13 ++++--- src/Applications/UI/Queue/State.elm | 9 +++-- src/Applications/UI/Queue/View.elm | 2 +- src/Applications/UI/Settings.elm | 2 +- src/Applications/UI/Sources/View.elm | 4 +-- src/Applications/UI/Tracks/ContextMenu.elm | 4 +-- src/Applications/UI/Tracks/Covers.elm | 6 ++-- src/Applications/UI/Tracks/Scene/Covers.elm | 7 ++-- src/Applications/UI/Tracks/Scene/List.elm | 15 ++++---- src/Applications/UI/Tracks/View.elm | 11 +++--- src/Applications/UI/User/State/Import.elm | 3 +- src/Applications/UI/View.elm | 31 ++++++++--------- src/Library/Common.elm | 4 +-- src/Library/Conditional.elm | 9 +++-- .../Sources/Services/Azure/Authorization.elm | 2 +- src/Library/Sources/Services/AzureBlob.elm | 2 +- src/Library/Sources/Services/AzureFile.elm | 2 +- src/Library/Sources/Services/Dropbox.elm | 4 +-- src/Library/Sources/Services/Google.elm | 6 ++-- src/Library/String/Path.elm | 8 ++++- src/Library/Tracks.elm | 4 +-- .../Tracks/Collection/Internal/Harvest.elm | 25 +++++++------- .../Tracks/Collection/Internal/Identify.elm | 34 +++++++++---------- src/Library/Tracks/Favourites.elm | 23 ++++++------- 35 files changed, 127 insertions(+), 137 deletions(-) diff --git a/src/Applications/Brain.elm b/src/Applications/Brain.elm index 8dcac2af..3f10d07e 100644 --- a/src/Applications/Brain.elm +++ b/src/Applications/Brain.elm @@ -156,7 +156,7 @@ update msg = subscriptions : Model -> Sub Msg -subscriptions model = +subscriptions _ = Sub.batch [ Ports.fromAlien alien , Ports.makeArtworkTrackUrls MakeArtworkTrackUrls diff --git a/src/Applications/Brain/Sources/Processing/State.elm b/src/Applications/Brain/Sources/Processing/State.elm index 1583be21..53982918 100644 --- a/src/Applications/Brain/Sources/Processing/State.elm +++ b/src/Applications/Brain/Sources/Processing/State.elm @@ -168,7 +168,7 @@ treeStep context result model = case result of Ok response -> case model.processingStatus of - Processing ( source, tracks ) rest -> + Processing ( _, tracks ) rest -> return { model | processingStatus = Processing ( context.source, tracks ) rest } (Steps.takeTreeStep context response tracks model.currentTime) diff --git a/src/Applications/Brain/Tracks/State.elm b/src/Applications/Brain/Tracks/State.elm index 9dfc15a5..c2ed2914 100644 --- a/src/Applications/Brain/Tracks/State.elm +++ b/src/Applications/Brain/Tracks/State.elm @@ -237,7 +237,7 @@ syncTrackTags data model = result |> Result.withDefault [] |> List.foldl - (\{ path, sourceId } ( dict, acc ) -> + (\{ sourceId } ( dict, acc ) -> if List.member sourceId acc then ( dict, acc ) diff --git a/src/Applications/Brain/User/State.elm b/src/Applications/Brain/User/State.elm index d41f4cad..057d2fb6 100644 --- a/src/Applications/Brain/User/State.elm +++ b/src/Applications/Brain/User/State.elm @@ -561,6 +561,7 @@ saveHypaethralData bit model = case model.authMethod of -- 🚀 Just (Dropbox { accessToken, refreshToken }) -> + -- TODO: Refresh token [ ( "data", json ) , ( "file", file ) , ( "token", Json.string accessToken ) diff --git a/src/Applications/UI.elm b/src/Applications/UI.elm index dd767f2f..738f6ed0 100644 --- a/src/Applications/UI.elm +++ b/src/Applications/UI.elm @@ -525,7 +525,7 @@ update msg = subscriptions : Model -> Sub Msg -subscriptions model = +subscriptions _ = Sub.batch [ Ports.fromAlien alien diff --git a/src/Applications/UI/Authentication/State.elm b/src/Applications/UI/Authentication/State.elm index 38a0f6fd..97d7965a 100644 --- a/src/Applications/UI/Authentication/State.elm +++ b/src/Applications/UI/Authentication/State.elm @@ -713,7 +713,7 @@ input string model = confirmInput : Manager confirmInput model = case lens.get model of - InputScreen (Ipfs i) { value } -> + InputScreen (Ipfs _) { value } -> pingOtherIpfs (String.chopEnd "/" value) model InputScreen (RemoteStorage r) { value } -> diff --git a/src/Applications/UI/Authentication/View.elm b/src/Applications/UI/Authentication/View.elm index 7158d6f0..8ca3127b 100644 --- a/src/Applications/UI/Authentication/View.elm +++ b/src/Applications/UI/Authentication/View.elm @@ -146,7 +146,7 @@ view_ state = -- Content ----------------------------------------- , case state of - InputScreen method opts -> + InputScreen _ opts -> inputScreen opts NewEncryptionKeyScreen method pass -> diff --git a/src/Applications/UI/ContextMenu.elm b/src/Applications/UI/ContextMenu.elm index d4463eea..bd6a16f7 100644 --- a/src/Applications/UI/ContextMenu.elm +++ b/src/Applications/UI/ContextMenu.elm @@ -30,7 +30,7 @@ view viewportWidth m = top = coordinates.y - |> max (250 / 2 + 12) + |> max (height / 2 + 12) in brick [ style "left" (String.fromFloat left ++ "px") diff --git a/src/Applications/UI/DnD.elm b/src/Applications/UI/DnD.elm index 5b21bde3..4ae11ed2 100644 --- a/src/Applications/UI/DnD.elm +++ b/src/Applications/UI/DnD.elm @@ -98,7 +98,7 @@ update msg model = -- Response ------------------------------------ , case msg of - Start context -> + Start _ -> { initiated = True } _ -> diff --git a/src/Applications/UI/Navigation.elm b/src/Applications/UI/Navigation.elm index 727dd308..0d49c9d7 100644 --- a/src/Applications/UI/Navigation.elm +++ b/src/Applications/UI/Navigation.elm @@ -133,13 +133,13 @@ localItem : Int -> { amount : Int } -> ( Icon msg, Label, Action msg ) -> Html m localItem tabindex_ { amount } ( Icon icon, Label labelText labelType, action ) = slab (case action of - NavigateToPage page -> + NavigateToPage _ -> Html.a OpenLinkInNewPage _ -> Html.a - PerformMsg msg -> + PerformMsg _ -> Html.button ) [ case action of diff --git a/src/Applications/UI/Playlists/State.elm b/src/Applications/UI/Playlists/State.elm index cf112e84..3349c48a 100644 --- a/src/Applications/UI/Playlists/State.elm +++ b/src/Applications/UI/Playlists/State.elm @@ -56,13 +56,12 @@ addTracksToPlaylist { playlistName, tracks } model = model.playlists Nothing -> - (::) - { autoGenerated = False - , name = properPlaylistName - , public = False - , tracks = tracks - } - model.playlists + { autoGenerated = False + , name = properPlaylistName + , public = False + , tracks = tracks + } + :: model.playlists newModel = { model diff --git a/src/Applications/UI/Queue/Fill.elm b/src/Applications/UI/Queue/Fill.elm index fc699571..f30ed596 100644 --- a/src/Applications/UI/Queue/Fill.elm +++ b/src/Applications/UI/Queue/Fill.elm @@ -160,15 +160,14 @@ shuffled timestamp unfilteredTracks s = cleanAutoGenerated : Bool -> String -> List Item -> List Item cleanAutoGenerated shuffle trackId future = - case shuffle of - True -> - List.filterNot - (\i -> i.manualEntry == False && itemTrackId i == trackId) - future - - False -> + if shuffle then + List.filterNot + (\i -> i.manualEntry == False && itemTrackId i == trackId) future + else + future + -- ㊙️ diff --git a/src/Applications/UI/Queue/State.elm b/src/Applications/UI/Queue/State.elm index b857d622..069e01b5 100644 --- a/src/Applications/UI/Queue/State.elm +++ b/src/Applications/UI/Queue/State.elm @@ -143,12 +143,11 @@ fill model = } in -- Fill using the appropiate method - case m.shuffle of - False -> - { m | playingNext = Fill.ordered timestamp nonMissingTracks fillState } + if m.shuffle then + { m | playingNext = Fill.shuffled timestamp nonMissingTracks fillState } - True -> - { m | playingNext = Fill.shuffled timestamp nonMissingTracks fillState } + else + { m | playingNext = Fill.ordered timestamp nonMissingTracks fillState } ) |> preloadNext diff --git a/src/Applications/UI/Queue/View.elm b/src/Applications/UI/Queue/View.elm index 747e4b33..71ff54bd 100644 --- a/src/Applications/UI/Queue/View.elm +++ b/src/Applications/UI/Queue/View.elm @@ -274,7 +274,7 @@ historyView playedPreviously dnd = historyItem : Int -> Queue.Item -> UI.List.Item UI.Msg -historyItem idx ({ identifiedTrack, manualEntry } as item) = +historyItem idx ({ identifiedTrack } as item) = let ( _, track ) = identifiedTrack diff --git a/src/Applications/UI/Settings.elm b/src/Applications/UI/Settings.elm index 6ef71e54..fea366bc 100644 --- a/src/Applications/UI/Settings.elm +++ b/src/Applications/UI/Settings.elm @@ -267,7 +267,7 @@ backgroundImage chosenBackground = chunk [ "flex", "flex-wrap" ] (List.map - (\( filename, backdropLabel ) -> + (\( filename, _ ) -> let isActive = chosenBackground == Just filename diff --git a/src/Applications/UI/Sources/View.elm b/src/Applications/UI/Sources/View.elm index 55820805..022a1ee9 100644 --- a/src/Applications/UI/Sources/View.elm +++ b/src/Applications/UI/Sources/View.elm @@ -48,7 +48,7 @@ view page model = , sources = model.sources } - Edit sourceId -> + Edit _ -> lazyForm model <| Form.edit New -> @@ -60,7 +60,7 @@ view page model = NewThroughRedirect _ _ -> lazyForm model <| Form.new { onboarding = False } - Rename sourceId -> + Rename _ -> lazyForm model <| Form.rename ) diff --git a/src/Applications/UI/Tracks/ContextMenu.elm b/src/Applications/UI/Tracks/ContextMenu.elm index e35ca48b..9f75f536 100644 --- a/src/Applications/UI/Tracks/ContextMenu.elm +++ b/src/Applications/UI/Tracks/ContextMenu.elm @@ -71,7 +71,7 @@ alternativeMenuActions : -> List (ContextMenu.Item Msg) alternativeMenuActions timestamp sources tracks = case tracks of - [ ( i, t ) ] -> + [ ( _, t ) ] -> [ Item { icon = Icons.link , label = "Copy temporary url" @@ -98,7 +98,7 @@ cacheAction : -> ContextMenu.Item Msg cacheAction { cached, cachingInProgress } tracks = case tracks of - [ ( i, t ) as track ] -> + [ ( _, t ) ] -> if List.member t.id cached then Item { icon = Icons.offline_bolt diff --git a/src/Applications/UI/Tracks/Covers.elm b/src/Applications/UI/Tracks/Covers.elm index 115bed4c..8e032e8e 100644 --- a/src/Applications/UI/Tracks/Covers.elm +++ b/src/Applications/UI/Tracks/Covers.elm @@ -26,7 +26,7 @@ generate sortBy tracks = in tracks.arranged |> List.indexedFoldr - (\idx identifiedTrack { covers, gathering } -> + (\_ identifiedTrack { covers, gathering } -> let group = groupFn identifiedTrack @@ -308,7 +308,7 @@ makeCover sortBy_ gathering collection = makeCoverWithFallback sortBy_ closedGathering fallback :: collection -makeCoverWithFallback sortBy_ gathering fallback = +makeCoverWithFallback _ gathering fallback = let amountOfTracks = List.length gathering.accIds @@ -322,7 +322,7 @@ makeCoverWithFallback sortBy_ gathering fallback = |> Maybe.map Tuple.first |> Maybe.withDefault fallback - ( identifiers, track ) = + ( _, track ) = identifiedTrack ( largestAlbumSequence, largestArtistSequence ) = diff --git a/src/Applications/UI/Tracks/Scene/Covers.elm b/src/Applications/UI/Tracks/Scene/Covers.elm index 073df6d9..dd526973 100644 --- a/src/Applications/UI/Tracks/Scene/Covers.elm +++ b/src/Applications/UI/Tracks/Scene/Covers.elm @@ -90,10 +90,7 @@ collectionView deps = List.length deps.covers in brick - ((::) - (tabindex (ifThenElse deps.isVisible 0 -1)) - viewAttributes - ) + (tabindex (ifThenElse deps.isVisible 0 -1) :: viewAttributes) [ "flex-basis-0" , "flex-grow" , "outline-none" @@ -794,7 +791,7 @@ coverView { clickable, horizontal } { cachedCovers, nowPlaying } cover = metadataView : ItemViewOptions -> ItemDependencies -> Cover -> Html Msg -metadataView { clickable, horizontal } { cachedCovers, sortBy } cover = +metadataView { clickable, horizontal } { sortBy } cover = let { identifiedTrackCover } = cover diff --git a/src/Applications/UI/Tracks/Scene/List.elm b/src/Applications/UI/Tracks/Scene/List.elm index a7f65d53..437f76ae 100644 --- a/src/Applications/UI/Tracks/Scene/List.elm +++ b/src/Applications/UI/Tracks/Scene/List.elm @@ -51,10 +51,7 @@ type alias DerivedColors = view : Dependencies -> List IdentifiedTrack -> InfiniteList.Model -> Bool -> Maybe Queue.Item -> Maybe String -> SortBy -> SortDirection -> List Int -> Maybe (DnD.Model Int) -> Html Msg view deps harvest infiniteList favouritesOnly nowPlaying searchTerm sortBy sortDirection selectedTrackIndexes maybeDnD = brick - ((::) - (tabindex (ifThenElse deps.isVisible 0 -1)) - viewAttributes - ) + (tabindex (ifThenElse deps.isVisible 0 -1) :: viewAttributes) [ "flex-basis-0" , "flex-grow" , "outline-none" @@ -484,7 +481,7 @@ defaultItemView args _ idx identifiedTrack = playlistItemView : Bool -> Maybe Queue.Item -> Maybe String -> List Int -> DnD.Model Int -> Bool -> Bool -> DerivedColors -> Int -> Int -> IdentifiedTrack -> Html Msg -playlistItemView favouritesOnly nowPlaying searchTerm selectedTrackIndexes dnd showAlbum darkMode derivedColors _ idx identifiedTrack = +playlistItemView favouritesOnly nowPlaying _ selectedTrackIndexes dnd showAlbum darkMode derivedColors _ idx identifiedTrack = let ( identifiers, track ) = identifiedTrack @@ -700,7 +697,7 @@ rowHeight = rowStyles : Int -> { isMissing : Bool, isNowPlaying : Bool, isSelected : Bool } -> DerivedColors -> List (Html.Attribute msg) -rowStyles idx { isMissing, isNowPlaying, isSelected } derivedColors = +rowStyles _ { isMissing, isNowPlaying } derivedColors = let bgColor = if isNowPlaying then @@ -740,7 +737,7 @@ columnMinWidth = favouriteColumn : String -> Bool -> { isFavourite : Bool, indexInList : Int, isNowPlaying : Bool, isSelected : Bool } -> DerivedColors -> Html Msg favouriteColumn columnWidth favouritesOnly identifiers derivedColors = brick - ((++) + (List.append [ style "width" columnWidth , identifiers.indexInList |> ToggleFavourite @@ -767,7 +764,7 @@ favouriteColumn columnWidth favouritesOnly identifiers derivedColors = favouriteColumnStyles : Bool -> { isFavourite : Bool, indexInList : Int, isNowPlaying : Bool, isSelected : Bool } -> DerivedColors -> List (Html.Attribute msg) -favouriteColumnStyles favouritesOnly { isFavourite, isNowPlaying, isSelected } derivedColors = +favouriteColumnStyles favouritesOnly { isFavourite, isNowPlaying } derivedColors = let color = if isNowPlaying && isFavourite then @@ -805,7 +802,7 @@ playlistIndexColumn indexInPlaylist = otherColumn : String -> Bool -> String -> Html msg -otherColumn width isLast text_ = +otherColumn width _ text_ = brick (otherColumnStyles width) [ "pl-2" diff --git a/src/Applications/UI/Tracks/View.elm b/src/Applications/UI/Tracks/View.elm index f9035efd..8400aaca 100644 --- a/src/Applications/UI/Tracks/View.elm +++ b/src/Applications/UI/Tracks/View.elm @@ -237,12 +237,11 @@ navigation maybeGrouping favouritesOnly searchTerm selectedPlaylist isOnIndexPag , title "Toggle favourites-only" ] [ "cursor-pointer" ] - [ case favouritesOnly of - True -> - Icons.favorite 16 (Color UI.Kit.colorKit.base08) + [ if favouritesOnly then + Icons.favorite 16 (Color UI.Kit.colorKit.base08) - False -> - Icons.favorite_border 16 Inherit + else + Icons.favorite_border 16 Inherit ] -- 3 @@ -349,7 +348,7 @@ navigation maybeGrouping favouritesOnly searchTerm selectedPlaylist isOnIndexPag noTracksView : List String -> Int -> Int -> Int -> Html UI.Msg -noTracksView processingContext amountOfSources amountOfTracks amountOfFavourites = +noTracksView processingContext amountOfSources amountOfTracks _ = chunk [ "no-tracks-view" diff --git a/src/Applications/UI/User/State/Import.elm b/src/Applications/UI/User/State/Import.elm index e2b19e53..a394a18d 100644 --- a/src/Applications/UI/User/State/Import.elm +++ b/src/Applications/UI/User/State/Import.elm @@ -263,5 +263,6 @@ importEnclosed value model = ] ) - Err err -> + Err _ -> + -- TODO: Error handling Return.singleton model diff --git a/src/Applications/UI/View.elm b/src/Applications/UI/View.elm index 3c4ed04a..5b398489 100644 --- a/src/Applications/UI/View.elm +++ b/src/Applications/UI/View.elm @@ -298,23 +298,21 @@ overlay maybeAlfred maybeContextMenu = vessel : List (Html Msg) -> Html Msg vessel = - (>>) - (brick - [ style "-webkit-mask-image" "-webkit-radial-gradient(white, black)" ] - [ "bg-white" - , "flex" - , "flex-col" - , "flex-grow" - , "overflow-hidden" - , "relative" - , "rounded" + brick + [ style "-webkit-mask-image" "-webkit-radial-gradient(white, black)" ] + [ "bg-white" + , "flex" + , "flex-col" + , "flex-grow" + , "overflow-hidden" + , "relative" + , "rounded" - -- Dark mode - ------------ - , "dark:bg-darkest-hour" - ] - ) - (bricky + -- Dark mode + ------------ + , "dark:bg-darkest-hour" + ] + >> bricky [ style "min-height" "296px" ] [ "flex" , "flex-grow" @@ -326,4 +324,3 @@ vessel = , "lg:max-w-insulation" , "lg:min-w-3xl" ] - ) diff --git a/src/Library/Common.elm b/src/Library/Common.elm index 98cb8554..ec051f60 100644 --- a/src/Library/Common.elm +++ b/src/Library/Common.elm @@ -64,10 +64,10 @@ translateHttpResponse response = Http.NetworkError_ -> Err Http.NetworkError - Http.BadStatus_ m body -> + Http.BadStatus_ _ body -> Err (Http.BadBody body) - Http.GoodStatus_ m body -> + Http.GoodStatus_ _ body -> Ok body diff --git a/src/Library/Conditional.elm b/src/Library/Conditional.elm index a2789eff..03bd32dc 100644 --- a/src/Library/Conditional.elm +++ b/src/Library/Conditional.elm @@ -5,9 +5,8 @@ module Conditional exposing (ifThenElse) ifThenElse : Bool -> a -> a -> a ifThenElse bool x y = - case bool of - True -> - x + if bool then + x - False -> - y + else + y diff --git a/src/Library/Sources/Services/Azure/Authorization.elm b/src/Library/Sources/Services/Azure/Authorization.elm index 959cbe0a..8c5a8b0f 100755 --- a/src/Library/Sources/Services/Azure/Authorization.elm +++ b/src/Library/Sources/Services/Azure/Authorization.elm @@ -49,7 +49,7 @@ presignedUrl : -> String -> List ( String, String ) -> String -presignedUrl storageMethod computation httpMethod hoursToLive currentTime srcData pathToFile params = +presignedUrl storageMethod computation _ _ currentTime srcData pathToFile params = let azure = srcData diff --git a/src/Library/Sources/Services/AzureBlob.elm b/src/Library/Sources/Services/AzureBlob.elm index c7916556..1da75d20 100644 --- a/src/Library/Sources/Services/AzureBlob.elm +++ b/src/Library/Sources/Services/AzureBlob.elm @@ -164,5 +164,5 @@ We need this to play the track. -} makeTrackUrl : Time.Posix -> SourceData -> HttpMethod -> String -> String -makeTrackUrl currentTime srcData method pathToFile = +makeTrackUrl currentTime srcData _ pathToFile = presignedUrl Blob Read Get 48 currentTime srcData pathToFile [] diff --git a/src/Library/Sources/Services/AzureFile.elm b/src/Library/Sources/Services/AzureFile.elm index 5ecd4402..56a87dca 100644 --- a/src/Library/Sources/Services/AzureFile.elm +++ b/src/Library/Sources/Services/AzureFile.elm @@ -168,5 +168,5 @@ We need this to play the track. -} makeTrackUrl : Time.Posix -> SourceData -> HttpMethod -> String -> String -makeTrackUrl currentTime srcData method pathToFile = +makeTrackUrl currentTime srcData _ pathToFile = presignedUrl File Read Get 48 currentTime srcData pathToFile [] diff --git a/src/Library/Sources/Services/Dropbox.elm b/src/Library/Sources/Services/Dropbox.elm index dd1cda4a..a130e066 100644 --- a/src/Library/Sources/Services/Dropbox.elm +++ b/src/Library/Sources/Services/Dropbox.elm @@ -124,7 +124,7 @@ Or a specific directory in the bucket. -} makeTree : SourceData -> Marker -> Time.Posix -> (Result Http.Error String -> msg) -> Cmd msg -makeTree srcData marker currentTime resultMsg = +makeTree srcData marker _ resultMsg = let accessToken = Dict.fetch "accessToken" "" srcData @@ -226,5 +226,5 @@ We need this to play the track. -} makeTrackUrl : Time.Posix -> SourceData -> HttpMethod -> String -> String -makeTrackUrl currentTime srcData method pathToFile = +makeTrackUrl _ srcData _ pathToFile = "dropbox://" ++ Dict.fetch "accessToken" "" srcData ++ "@" ++ pathToFile diff --git a/src/Library/Sources/Services/Google.elm b/src/Library/Sources/Services/Google.elm index a85c13ff..9e13db65 100644 --- a/src/Library/Sources/Services/Google.elm +++ b/src/Library/Sources/Services/Google.elm @@ -142,7 +142,7 @@ prepare origin srcData _ resultMsg = queryParams = case maybeCode of -- Exchange authorization code for access token & request token - Just authCode -> + Just _ -> [ ( "client_id", Dict.fetch "clientId" "" srcData ) , ( "client_secret", Dict.fetch "clientSecret" "" srcData ) , ( "code", Dict.fetch "authCode" "" srcData ) @@ -182,7 +182,7 @@ Or a specific directory in the bucket. -} makeTree : SourceData -> Marker -> Time.Posix -> (Result Http.Error String -> msg) -> Cmd msg -makeTree srcData marker currentTime resultMsg = +makeTree srcData marker _ resultMsg = let accessToken = Dict.fetch "accessToken" "" srcData @@ -289,7 +289,7 @@ We need this to play the track. -} makeTrackUrl : Time.Posix -> SourceData -> HttpMethod -> String -> String -makeTrackUrl currentTime srcData method path = +makeTrackUrl _ srcData _ path = let file = String.Path.file path diff --git a/src/Library/String/Path.elm b/src/Library/String/Path.elm index 3881a17d..becbe6d9 100644 --- a/src/Library/String/Path.elm +++ b/src/Library/String/Path.elm @@ -26,11 +26,17 @@ addSuffix path = p ++ sep +{-| Drop an amount of path segments from the right side. + + >>> dropRight 5 "a/b/c/d/e/f" + "a" + +-} dropRight : Int -> String -> String dropRight int path = path |> String.split sep - |> (\l -> List.take (List.length l - 1) l) + |> (\l -> List.take (List.length l - int) l) |> String.join sep diff --git a/src/Library/Tracks.elm b/src/Library/Tracks.elm index 47d8ca3e..fa81d652 100644 --- a/src/Library/Tracks.elm +++ b/src/Library/Tracks.elm @@ -342,7 +342,7 @@ removeFromPlaylist tracks playlist = |> List.indexedFoldr (\idx t ( acc, remaining ) -> case List.partition ((==) (Just idx)) remaining of - ( match :: _, rem ) -> + ( _ :: _, rem ) -> ( acc, rem ) ( _, rem ) -> @@ -369,7 +369,7 @@ shouldRenderGroup identifiers = toPlaylistTracks : List IdentifiedTrack -> List PlaylistTrack toPlaylistTracks = List.map - (\( i, t ) -> + (\( _, t ) -> { album = t.tags.album , artist = t.tags.artist , title = t.tags.title diff --git a/src/Library/Tracks/Collection/Internal/Harvest.elm b/src/Library/Tracks/Collection/Internal/Harvest.elm index b6ba8761..ba56bed6 100644 --- a/src/Library/Tracks/Collection/Internal/Harvest.elm +++ b/src/Library/Tracks/Collection/Internal/Harvest.elm @@ -42,18 +42,17 @@ harvest ( deps, collection ) = ----------- , case deps.selectedPlaylist of Just playlist -> - case playlist.autoGenerated of - True -> - \( _, t ) -> - t.path - |> String.split "/" - |> List.head - |> Maybe.withDefault "" - |> (==) playlist.name - - False -> - \( i, _ ) -> - Maybe.isJust i.indexInPlaylist + if playlist.autoGenerated then + \( _, t ) -> + t.path + |> String.split "/" + |> List.head + |> Maybe.withDefault "" + |> (==) playlist.name + + else + \( i, _ ) -> + Maybe.isJust i.indexInPlaylist Nothing -> always True @@ -120,7 +119,7 @@ harvest ( deps, collection ) = ) ) ( Dict.empty, ( 0, Tracks.emptyIdentifiers ), [] ) - |> (\( a, b, c ) -> c) + |> (\( _, _, c ) -> c) |> (\h -> { collection | harvested = List.reverse h }) |> (\c -> ( deps, c )) diff --git a/src/Library/Tracks/Collection/Internal/Identify.elm b/src/Library/Tracks/Collection/Internal/Identify.elm index 3f44bd65..86514380 100644 --- a/src/Library/Tracks/Collection/Internal/Identify.elm +++ b/src/Library/Tracks/Collection/Internal/Identify.elm @@ -67,12 +67,11 @@ identifyTrack : -> ( List IdentifiedTrack, List String ) -> ( List IdentifiedTrack, List String ) identifyTrack enabledSourceIds favourites track = - case List.member track.sourceId enabledSourceIds of - True -> - partTwo favourites track + if List.member track.sourceId enabledSourceIds then + partTwo favourites track - False -> - identity + else + identity partTwo : @@ -105,25 +104,24 @@ partTwo favourites track ( acc, remainingFavourites ) = , track ) in - case isFav of + if isFav then -- -- A favourite -- - True -> - ( identifiedTrack :: acc - , remainingFavourites - |> List.findIndex isFavourite_ - |> Maybe.map (\idx -> List.removeAt idx remainingFavourites) - |> Maybe.withDefault remainingFavourites - ) - + ( identifiedTrack :: acc + , remainingFavourites + |> List.findIndex isFavourite_ + |> Maybe.map (\idx -> List.removeAt idx remainingFavourites) + |> Maybe.withDefault remainingFavourites + ) + + else -- -- Not a favourite -- - False -> - ( identifiedTrack :: acc - , remainingFavourites - ) + ( identifiedTrack :: acc + , remainingFavourites + ) diff --git a/src/Library/Tracks/Favourites.elm b/src/Library/Tracks/Favourites.elm index ff907ae0..9eb9f49c 100644 --- a/src/Library/Tracks/Favourites.elm +++ b/src/Library/Tracks/Favourites.elm @@ -56,18 +56,17 @@ toggleInFavouritesList ( i, t ) favourites = , title = t.tags.title } in - case i.isFavourite of - True -> - -- Remove from list - List.filterNot - (match favourite) - favourites - - False -> - -- Add to list - List.append - favourites - [ favourite ] + if i.isFavourite then + -- Remove from list + List.filterNot + (match favourite) + favourites + + else + -- Add to list + List.append + favourites + [ favourite ] -- knotmirror 0.0.1